done: if (pcanc > 1.0e-12)
mtherr("hyperg", PLOSS);
return (psum);
}
/* Power series summation for confluent hypergeometric function */
staticdouble hy1f1p(a, b, x, err) double a, b, x; double *err;
{ double n, a0, sum, t, u, temp; double an, bn, maxt, pcanc;
/* set up for power series summation */
an = a;
bn = b;
a0 = 1.0;
sum = 1.0;
n = 1.0;
t = 1.0;
maxt = 0.0;
while (t > MACHEP) { if (bn == 0) /* check bn first since if both */
{
mtherr("hyperg", SING); return (MAXNUM); /* an and bn are zero it is */
} if (an == 0) /* a singularity */ return (sum); if (n > 200) goto pdone;
u = x * (an / (bn * n));
a0 *= u;
sum += a0;
t = fabs(a0); if (t > maxt)
maxt = t; /* if((maxt/fabs(sum))>1.0e17) { pcanc=1.0; gotoblowup; }
*/
an += 1.0;
bn += 1.0;
n += 1.0;
}
pdone:
/* estimate error due to roundoff and cancellation */ if (sum != 0.0)
maxt /= fabs(sum);
maxt *= MACHEP; /* this way avoids multiply overflow */
pcanc = fabs(MACHEP * n + maxt);
if (a < 0)
temp = exp(t) / gamma(a); else
temp = exp(t - lgam(a));
h2 *= temp;
err2 *= temp;
if (x < 0.0)
asum = h1; else
asum = h2;
acanc = fabs(err1) + fabs(err2);
if (b < 0) {
temp = gamma(b);
asum *= temp;
acanc *= fabs(temp);
}
if (asum != 0.0)
acanc /= fabs(asum);
acanc *= 30.0; /* fudge factor, since error of asymptotic formula
* often seems this much larger than advertised */
adone:
*err = acanc; return (asum);
}
/* hyp2f0() */
double hyp2f0(a, b, x, type, err) double a, b, x; int type; /* determines what converging factor to use */ double *err;
{ double a0, alast, t, tlast, maxt; double n, an, bn, u, sum, temp;
an = a;
bn = b;
a0 = 1.0e0;
alast = 1.0e0;
sum = 0.0;
n = 1.0e0;
t = 1.0e0;
tlast = 1.0e9;
maxt = 0.0;
do { if (an == 0) goto pdone; if (bn == 0) goto pdone;
u = an * (bn * x / n);
/* check for blowup */
temp = fabs(u); if ((temp > 1.0) && (maxt > (MAXNUM / temp))) goto error;
a0 *= u;
t = fabs(a0);
/* terminating condition for asymptotic series */ if (t > tlast) goto ndone;
tlast = t;
sum += alast; /* the sum is one term behind */
alast = a0;
if (n > 200) goto ndone;
an += 1.0e0;
bn += 1.0e0;
n += 1.0e0; if (t > maxt)
maxt = t;
} while (t > MACHEP);
pdone: /* series converged! */
/* estimate error due to roundoff and cancellation */
*err = fabs(MACHEP * (n + maxt));
alast = a0; goto done;
ndone: /* series did not converge */
/* The following "Converging factors" are supposed to improve accuracy,
* but do not actually seem to accomplish very much. */
n -= 1.0;
x = 1.0 / x;
switch (type) /* "type" given as subroutine argument */
{ case1:
alast *= (0.5 + (0.125 + 0.25 * b - 0.5 * a + 0.25 * x - 0.25 * n) / x); break;
case2:
alast *= 2.0 / 3.0 - b + 2.0 * a + x - n; break;
default:;
}
/* estimate error due to roundoff, cancellation, and nonconvergence */
*err = MACHEP * (n + maxt) + fabs(a0);
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.13Bemerkung:
(vorverarbeitet am 2026-06-10)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.