ApasScript.

Special Functions

erf

The error function erf(x) = (2/sqrt(pi)) * integral of e^(-t^2) from 0 to x.

erfc

The complementary error function 1 - erf(x), accurate for large x.

erfcx

The scaled complementary error function exp(x^2)*erfc(x). It stays a readable number where erfc itself is too small for a decimal (erfc(30) is below 10^-390; erfcx(30) is 0.0187958889).

logErfc

The natural logarithm of erfc(x), finite in the far tail where erfc itself is too small for a decimal: logErfc(30) is -903.974.

inverseErfc

The x with erfc(x) = p, for 0 < p < 2.

logGamma

ln(Gamma(x)) for x > 0 -- the log of the gamma function, without overflow for large x.

regularizedGammaP

The regularized lower incomplete gamma function P(a, x).

regularizedGammaQ

The regularized upper incomplete gamma function Q(a, x) = 1 - P(a, x).

inverseRegularizedGammaP

The x with P(a, x) = p.

regularizedBeta

The regularized incomplete beta function I_x(a, b).

regularizedBetaComplement

1 - I_x(a, b), computed directly so it stays accurate near 1.

inverseRegularizedBeta

The x with I_x(a, b) = p.

gamma

The gamma function Gamma(x), for real x that is not 0, -1, -2, ... . gamma(n+1) is n! for a whole n. Past the f64 range (near x = 171.6) a whole number prints as its factorial, gamma(200) as 199!, and a non-whole number in scientific form; each is still an exact or 50-digit number in arithmetic, and scientific(gamma(200), 10) or gammaBig(x, digits) gives the digits. Past the range of a float, works down to x = -700, up to x = 8000 when x is not whole, and up to 5001 when it is.

digamma

The digamma function psi(x), the derivative of ln(Gamma(x)), for real x that is not 0, -1, -2, ... .

zeta

The Riemann zeta function zeta(s) for real s other than 1: the sum of 1/n^s (continued to s <= 1).

Ei

The exponential integral Ei(x) for real x other than 0; for x > 0 the principal value of the integral of e^t/t.

E1

The exponential integral E1(x) = the integral of e^(-t)/t from x to infinity, for x > 0.

li

The logarithmic integral li(x) = Ei(ln x), for x > 0 and x other than 1.

Si

The sine integral Si(x) = the integral of sin(t)/t from 0 to x.

Ci

The cosine integral Ci(x) = -the integral of cos(t)/t from x to infinity, for x > 0.

Shi

The hyperbolic sine integral Shi(x) = the integral of sinh(t)/t from 0 to x.

Chi

The hyperbolic cosine integral Chi(x) = gamma + ln x + the integral of (cosh(t)-1)/t from 0 to x, for x > 0.

fresnelS

The Fresnel integral S(x) = the integral of sin(pi t^2/2) from 0 to x.

fresnelC

The Fresnel integral C(x) = the integral of cos(pi t^2/2) from 0 to x.

dilog

The dilogarithm Li2(x) = -the integral of ln(1-t)/t from 0 to x, for real x <= 1.

clausen

The Clausen function Cl2(x) = the sum of sin(k x)/k^2; Cl2(pi/2) is Catalan's constant.

ellipticK

The complete elliptic integral of the first kind K(m) = the integral of 1/sqrt(1 - m sin^2 t) from 0 to pi/2, for m < 1. The argument is m = k^2, not k.

ellipticE

The complete elliptic integral of the second kind E(m) = the integral of sqrt(1 - m sin^2 t) from 0 to pi/2, for m <= 1. The argument is m = k^2, not k.

ellipticF

The incomplete elliptic integral of the first kind F(phi, m) = the integral of 1/sqrt(1 - m sin^2 t) from 0 to phi. The second argument is m = k^2, not k.

lambertW

The principal branch of Lambert's W: the w with w*e^w = x, for x >= -1/e.

gammaBig

Gamma(x) worked out to `digits` significant digits (1 to 200), for real x that is not 0, -1, -2, ... . A whole-number argument is exact: gammaBig(200, 30) is 199! in full. The result is rounded to the digits asked for. Works for x down to -1000 at up to 20 digits, -700 at up to 50, -350 at up to 100, -150 at up to 150, -100 at up to 200; up to 8000 when x is not whole, and up to 5001 when it is.

logGammaBig

ln(Gamma(x)) worked out to `digits` significant digits (1 to 200), for x > 0. Use it when Gamma(x) itself is too many digits to write out.

digammaBig

The digamma function psi(x) worked out to `digits` significant digits (1 to 200), for real x that is not 0, -1, -2, ... . Works for x down to -20000.

expBig

e^x worked out to `digits` significant digits (1 to 1000). The result is rounded to the digits asked for. Works while the digits asked + the zeros of x or of the answer are at most 2300, and x is at most 48000 in size.

lnBig

The natural logarithm of x (x > 0) worked out to `digits` significant digits (1 to 1000). Works while the digits asked + the zeros of x or of the answer are at most 2500.

powBig

x^y worked out to `digits` significant digits (1 to 1000), for x > 0 (or x = 0 with y >= 0). Works while the digits asked + the zeros of x or of the answer are at most 1900, and y*ln(x) is at most 48000 in size.

sinBig

sin(x) worked out to `digits` significant digits (1 to 1000). Works while the digits asked + the zeros of x or of the answer are at most 1450, and x is at most 10^15 in size.

cosBig

cos(x) worked out to `digits` significant digits (1 to 1000). Works while the digits asked + the zeros of x are at most 1850, and x is at most 10^15 in size.