node-cephes
This is a WebAssembly packaging of the cephes library. The cephes library contains C implementations of most special functions, distributions, and other hard-to-implement mathematical functions.
Install
npm install cephesIf you are looking on GitHub, you will notice some files are missing. These are statically built from the cephes library. See the CONTRIBUTING.md file, for how to build them.
Usage
Cephes is a WebAssembly module but is very small and fast to compile, as it doesn't depend on any runtime libraries. In Node.js it is therefore compiled synchronously and all you need to do is require the module.
const cephes = require('cephes'); // Node.jsIn the browser, it is, for good practice, compiled asynchronously. You must
therefore wait for the .compiled promise to be resolved.
const cephes = require('cephes'); // Browser
await cephes.compiled;Note that the .compiled promise is also available in Node.js, but it is
simply a dummy promise that resolves immediately.
The JavaScript interface
There are three variations of functions to be aware of:
1. Plain numeric function
These don't require anything special.
const value = cephes.zeta(2, 1);2. Functions that return more than one value
In C, these functions return a primary value and then return extra value using pointer arguments. In JavaScript this is implemented as a function that returns an array of length 2. The first element is the primary returned value, the second is an object of the extra returned values.
const [value, {ai, aip, bi, bip}] = cephes.airy(-1);3. Functions that consumes an array
Some functions consumes an array of values, these must be TypedArrays of
the appropriate type. These functions will typically also require a variation
of .length value as a parameter, like you would do in C. Be aware, that in
some cases it may not be exactly the .length of the TypedArray, but may be
one less or one more. Check the specific function documentation to be sure.
const arrayInput = new Float64Array([2.2, 3.3, 4.4]);
const value = cephes.polevl(1.1, arrayInput, arrayInput.length - 1);4. Functions that use Complex numbers
Some functions use complex numbers. We have a convenience method in cephes (createComplex), which takes a real and imaginary part. Note most of the complex functions store the value in one of the arguments. For convenience, the last argument is returned by the function.
Here is an example with csin.
// Create the resulting complex
const w = cephes.createComplex();
// Run the function
cephes.csin(cephes.createComplex(0.5, 0.5), w);
// Output update of value to console
console.log(w.toString()); // Expect 0.5406126857131534 + 0.4573041531842493iTable of Content
| Function | Description | Documentation |
|---|---|---|
| Arithmetic and Algebraic | ||
signbit(x) |
Returns the sign bit | c-doc • js-doc |
csinh(z, w) |
Complex hyperbolic sine | c-doc • js-doc |
casinh(z, w) |
Complex inverse hyperbolic sine | c-doc • js-doc |
ccosh(z, w) |
Complex hyperbolic cosine | c-doc • js-doc |
cacosh(z, w) |
Complex inverse hyperbolic cosine | c-doc • js-doc |
ctanh(z, w) |
Complex hyperbolic tangent | c-doc • js-doc |
catanh(z, w) |
Complex inverse hyperbolic tangent | c-doc • js-doc |
cpow(a, z, w) |
Complex power function | c-doc • js-doc |
cneg(a) |
Complex negative | c-doc • js-doc |
isnan(x) |
Check if Not-A-Number | c-doc • js-doc |
isfinite(x) |
Check if finite | c-doc • js-doc |
sqrt(x) |
Square root | c-doc • js-doc |
cbrt(x) |
Cube root | c-doc • js-doc |
polevl(x, coef, N) |
Evaluate polynomial | c-doc • js-doc |
chbevl(x, array, n) |
Evaluate Chebyshev series | c-doc • js-doc |
round(x) |
Round to nearest integer value | c-doc • js-doc |
ceil(x) |
Truncate upward to integer | c-doc • js-doc |
floor(x) |
Truncate downward to integer | c-doc • js-doc |
frexp(x) |
Extract exponent | c-doc • js-doc |
ldexp(x, pw2) |
Add integer to exponent | c-doc • js-doc |
fabs(x) |
Absolute value | c-doc • js-doc |
| Exponential and Trigonometric | ||
expx2(x, sign) |
Exponential of squared argument | c-doc • js-doc |
radian(d, m, s) |
Degrees, minutes, seconds to radians | c-doc • js-doc |
sincos(x, flg) |
Circular sine and cosine of argument in degrees | c-doc • js-doc |
cot(x) |
Circular cotangent | c-doc • js-doc |
cotdg(x) |
Circular cotangent of argument in degrees | c-doc • js-doc |
log1p(x) |
Relative error approximations for log(1 + x) | c-doc • js-doc |
expm1(x) |
Relative error approximations for exp(x) - 1 | c-doc • js-doc |
cosm1(x) |
Relative error approximations for cos(x) - 1 | c-doc • js-doc |
acos(x) |
Arc cosine | c-doc • js-doc |
acosh(x) |
Arc hyperbolic cosine | c-doc • js-doc |
asinh(xx) |
Arc hyperbolic sine | c-doc • js-doc |
atanh(x) |
Arc hyperbolic tangent | c-doc • js-doc |
asin(x) |
Arcsine | c-doc • js-doc |
atan(x) |
Arctangent | c-doc • js-doc |
atan2(y, x) |
Quadrant correct arctangent | c-doc • js-doc |
cos(x) |
Cosine | c-doc • js-doc |
cosdg(x) |
Cosine of arg in degrees | c-doc • js-doc |
exp(x) |
Exponential, base e | c-doc • js-doc |
exp2(x) |
Exponential, base 2 | c-doc • js-doc |
exp10(x) |
Exponential, base 10 | c-doc • js-doc |
cosh(x) |
Hyperbolic cosine | c-doc • js-doc |
sinh(x) |
Hyperbolic sine | c-doc • js-doc |
tanh(x) |
Hyperbolic tangent | c-doc • js-doc |
log(x) |
Logarithm, base e | c-doc • js-doc |
log2(x) |
Logarithm, base 2 | c-doc • js-doc |
log10(x) |
Logarithm, base 10 | c-doc • js-doc |
pow(x, y) |
Power | c-doc • js-doc |
powi(x, nn) |
Integer Power | c-doc • js-doc |
sin(x) |
Sine | c-doc • js-doc |
sindg(x) |
Sine of arg in degrees | c-doc • js-doc |
tan(x) |
Tangent | c-doc • js-doc |
tandg(x) |
Tangent of arg in degrees | c-doc • js-doc |
| Exponential integral | ||
ei(x) |
Exponential integral | c-doc • js-doc |
expn(n, x) |
Exponential integral | c-doc • js-doc |
shichi(x) |
Hyperbolic cosine integral | c-doc • js-doc |
sici(x) |
Cosine integral | c-doc • js-doc |
| Gamma | ||
lbeta(a, b) |
Natural log of |beta|. | c-doc • js-doc |
beta(a, b) |
Beta | c-doc • js-doc |
fac(i) |
Factorial | c-doc • js-doc |
gamma(x) |
Gamma | c-doc • js-doc |
lgam(x) |
Logarithm of gamma function | c-doc • js-doc |
incbet(aa, bb, xx) |
Incomplete beta integral | c-doc • js-doc |
incbi(aa, bb, yy0) |
Inverse beta integral | c-doc • js-doc |
igam(a, x) |
Incomplete gamma integral | c-doc • js-doc |
igamc(a, x) |
Complemented gamma integral | c-doc • js-doc |
igami(a, y0) |
Inverse gamma integral | c-doc • js-doc |
psi(x) |
Psi (digamma) function | c-doc • js-doc |
rgamma(x) |
Reciprocal Gamma | c-doc • js-doc |
| Error function | ||
erf(x) |
Error function | c-doc • js-doc |
erfc(a) |
Complemented error function | c-doc • js-doc |
dawsn(xx) |
Dawson's integral | c-doc • js-doc |
fresnl(xxa) |
Fresnel integral | c-doc • js-doc |
| Bessel | ||
airy(x) |
Airy | c-doc • js-doc |
j0(x) |
Bessel, order 0 | c-doc • js-doc |
j1(x) |
Bessel, order 1 | c-doc • js-doc |
jn(n, x) |
Bessel, order n | c-doc • js-doc |
jv(n, x) |
Bessel, noninteger order | c-doc • js-doc |
y0(x) |
Bessel, second kind, order 0 | c-doc • js-doc |
y1(x) |
Bessel, second kind, order 1 | c-doc • js-doc |
yn(n, x) |
Bessel, second kind, order n | c-doc • js-doc |
yv(v, x) |
Bessel, noninteger order | c-doc • js-doc |
i0(x) |
Modified Bessel, order 0 | c-doc • js-doc |
i0e(x) |
Exponentially scaled i0 | c-doc • js-doc |
i1(x) |
Modified Bessel, order 1 | c-doc • js-doc |
i1e(x) |
Exponentially scaled i1 | c-doc • js-doc |
iv(v, x) |
Modified Bessel, nonint. order | c-doc • js-doc |
k0(x) |
Mod. Bessel, 3rd kind, order 0 | c-doc • js-doc |
k0e(x) |
Exponentially scaled k0 | c-doc • js-doc |
k1(x) |
Mod. Bessel, 3rd kind, order 1 | c-doc • js-doc |
k1e(x) |
Exponentially scaled k1 | c-doc • js-doc |
kn(nn, x) |
Mod. Bessel, 3rd kind, order n | c-doc • js-doc |
| Hypergeometric | ||
hyperg(a, b, x) |
Confluent hypergeometric | c-doc • js-doc |
hyp2f1(a, b, c, x) |
Gauss hypergeometric function | c-doc • js-doc |
| Elliptic | ||
ellpe(x) |
Complete elliptic integral | c-doc • js-doc |
ellie(phi, m) |
Incomplete elliptic integral | c-doc • js-doc |
ellpk(x) |
Complete elliptic integral | c-doc • js-doc |
ellik(phi, m) |
Incomplete elliptic integral | c-doc • js-doc |
ellpj(u, m) |
Jacobian elliptic function | c-doc • js-doc |
| Probability | ||
btdtr(a, b, x) |
Beta distribution | c-doc • js-doc |
smirnov(n, e) |
Exact Smirnov statistic, for one-sided test. | c-doc • js-doc |
kolmogorov(y) |
Kolmogorov's limiting distribution of two-sided test. | c-doc • js-doc |
smirnovi(n, p) |
Functional inverse of Smirnov distribution. | c-doc • js-doc |
kolmogi(p) |
Functional inverse of Kolmogorov statistic for two-sided test. | c-doc • js-doc |
nbdtri(k, n, p) |
Inverse Negative binomial distribution | c-doc • js-doc |
stdtri(k, p) |
Functional inverse of Student's t distribution | c-doc • js-doc |
bdtr(k, n, p) |
Binomial distribution | c-doc • js-doc |
bdtrc(k, n, p) |
Complemented binomial | c-doc • js-doc |
bdtri(k, n, y) |
Inverse binomial | c-doc • js-doc |
chdtr(df, x) |
Chi square distribution | c-doc • js-doc |
chdtrc(df, x) |
Complemented Chi square | c-doc • js-doc |
chdtri(df, y) |
Inverse Chi square | c-doc • js-doc |
fdtr(ia, ib, x) |
F distribution | c-doc • js-doc |
fdtrc(ia, ib, x) |
Complemented F | c-doc • js-doc |
fdtri(ia, ib, y) |
Inverse F distribution | c-doc • js-doc |
gdtr(a, b, x) |
Gamma distribution | c-doc • js-doc |
gdtrc(a, b, x) |
Complemented gamma | c-doc • js-doc |
nbdtr(k, n, p) |
Negative binomial distribution | c-doc • js-doc |
nbdtrc(k, n, p) |
Complemented negative binomial | c-doc • js-doc |
ndtr(a) |
Normal distribution | c-doc • js-doc |
ndtri(y0) |
Inverse normal distribution | c-doc • js-doc |
pdtr(k, m) |
Poisson distribution | c-doc • js-doc |
pdtrc(k, m) |
Complemented Poisson | c-doc • js-doc |
pdtri(k, y) |
Inverse Poisson distribution | c-doc • js-doc |
stdtr(k, t) |
Student's t distribution | c-doc • js-doc |
| Miscellaneous | ||
plancki(w, T) |
Integral of Planck's black body radiation formula | c-doc • js-doc |
planckc(w, T) |
Complemented Planck radiation integral | c-doc • js-doc |
planckd(w, T) |
Planck's black body radiation formula | c-doc • js-doc |
planckw(T) |
Wavelength, w, of maximum radiation at given temperature T. | c-doc • js-doc |
spence(x) |
Dilogarithm | c-doc • js-doc |
zetac(x) |
Riemann Zeta function | c-doc • js-doc |
zeta(x, q) |
Two argument zeta function | c-doc • js-doc |
struve(v, x) |
Struve function | c-doc • js-doc |
| Numerical Integration | ||
simpsn(f, delta) |
Simpson's rule | c-doc • js-doc |
| Complex Arithmetic | ||
cadd(a, b, c) |
Complex addition | c-doc • js-doc |
csub(a, b, c) |
Subtraction | c-doc • js-doc |
cmul(a, b, c) |
Multiplication | c-doc • js-doc |
cdiv(a, b, c) |
Division | c-doc • js-doc |
csqrt(z, w) |
Square root | c-doc • js-doc |
| Complex Exponential and Trigonometric | ||
cexp(z, w) |
Exponential | c-doc • js-doc |
clog(z, w) |
Logarithm | c-doc • js-doc |
ccos(z, w) |
Cosine | c-doc • js-doc |
cacos(z, w) |
Arc cosine | c-doc • js-doc |
csin(z, w) |
Sine | c-doc • js-doc |
casin(z, w) |
Arc sine | c-doc • js-doc |
ctan(z, w) |
Tangent | c-doc • js-doc |
catan(z, w) |
Arc tangent | c-doc • js-doc |
ccot(z, w) |
Cotangent | c-doc • js-doc |
| Polynomials and Power Series | ||
p1evl(x, coef, N) |
Evaluate polynomial when coefficient of x is 1.0. | c-doc • js-doc |
polylog(n, x) |
The polylogarithm of order n | c-doc • js-doc |
Documentation
Arithmetic and Algebraic
int = cephes.signbit(x: double)
signbit is the "Returns the sign bit". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#signbit.
const ret = cephes.signbit(x);cephes.csinh(z: Complex, w: Complex)
csinh is the "Complex hyperbolic sine". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#csinh.
cephes.csinh(z, w);cephes.casinh(z: Complex, w: Complex)
casinh is the "Complex inverse hyperbolic sine". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#casinh.
cephes.casinh(z, w);cephes.ccosh(z: Complex, w: Complex)
ccosh is the "Complex hyperbolic cosine". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#ccosh.
cephes.ccosh(z, w);cephes.cacosh(z: Complex, w: Complex)
cacosh is the "Complex inverse hyperbolic cosine". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#cacosh.
cephes.cacosh(z, w);cephes.ctanh(z: Complex, w: Complex)
ctanh is the "Complex hyperbolic tangent". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#ctanh.
cephes.ctanh(z, w);cephes.catanh(z: Complex, w: Complex)
catanh is the "Complex inverse hyperbolic tangent". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#catanh.
cephes.catanh(z, w);cephes.cpow(a: Complex, z: Complex, w: Complex)
cpow is the "Complex power function". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#cpow.
cephes.cpow(a, z, w);cephes.cneg(a: Complex)
cneg is the "Complex negative". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#cneg.
cephes.cneg(a);int = cephes.isnan(x: double)
isnan is the "Check if Not-A-Number". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#isnan.
const ret = cephes.isnan(x);int = cephes.isfinite(x: double)
isfinite is the "Check if finite". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#isfinite.
const ret = cephes.isfinite(x);double = cephes.sqrt(x: double)
sqrt is the "Square root". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#sqrt.
const ret = cephes.sqrt(x);double = cephes.cbrt(x: double)
cbrt is the "Cube root". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#cbrt.
const ret = cephes.cbrt(x);double = cephes.polevl(x: double, coef: Float64Array, N: int)
polevl is the "Evaluate polynomial". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#polevl.
const ret = cephes.polevl(x, new Float64Array(coef), N);double = cephes.chbevl(x: double, array: Float64Array, n: int)
chbevl is the "Evaluate Chebyshev series". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#chbevl.
const ret = cephes.chbevl(x, new Float64Array(array), n);double = cephes.round(x: double)
round is the "Round to nearest integer value". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#round.
const ret = cephes.round(x);double = cephes.ceil(x: double)
ceil is the "Truncate upward to integer". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#ceil.
const ret = cephes.ceil(x);double = cephes.floor(x: double)
floor is the "Truncate downward to integer". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#floor.
const ret = cephes.floor(x);[double, extra] = cephes.frexp(x: double)
frexp is the "Extract exponent". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#frexp.
const [ret, extra] = cephes.frexp(x);The extra object contains the following values:
const {
pw2: int
} = extra;double = cephes.ldexp(x: double, pw2: int)
ldexp is the "Add integer to exponent". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#ldexp.
const ret = cephes.ldexp(x, pw2);double = cephes.fabs(x: double)
fabs is the "Absolute value". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#fabs.
const ret = cephes.fabs(x);Exponential and Trigonometric
double = cephes.expx2(x: double, sign: int)
expx2 is the "Exponential of squared argument". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#expx2.
const ret = cephes.expx2(x, sign);double = cephes.radian(d: double, m: double, s: double)
radian is the "Degrees, minutes, seconds to radians". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#radian.
const ret = cephes.radian(d, m, s);[int, extra] = cephes.sincos(x: double, flg: int)
sincos is the "Circular sine and cosine of argument in degrees". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#sincos.
const [ret, extra] = cephes.sincos(x, flg);The extra object contains the following values:
const {
s: double,
c: double
} = extra;double = cephes.cot(x: double)
cot is the "Circular cotangent". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#cot.
const ret = cephes.cot(x);double = cephes.cotdg(x: double)
cotdg is the "Circular cotangent of argument in degrees". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#cotdg.
const ret = cephes.cotdg(x);double = cephes.log1p(x: double)
log1p is the "Relative error approximations for log(1 + x)". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#log1p.
const ret = cephes.log1p(x);double = cephes.expm1(x: double)
expm1 is the "Relative error approximations for exp(x) - 1". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#expm1.
const ret = cephes.expm1(x);double = cephes.cosm1(x: double)
cosm1 is the "Relative error approximations for cos(x) - 1". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#cosm1.
const ret = cephes.cosm1(x);double = cephes.acos(x: double)
acos is the "Arc cosine". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#acos.
const ret = cephes.acos(x);double = cephes.acosh(x: double)
acosh is the "Arc hyperbolic cosine". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#acosh.
const ret = cephes.acosh(x);double = cephes.asinh(xx: double)
asinh is the "Arc hyperbolic sine". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#asinh.
const ret = cephes.asinh(xx);double = cephes.atanh(x: double)
atanh is the "Arc hyperbolic tangent". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#atanh.
const ret = cephes.atanh(x);double = cephes.asin(x: double)
asin is the "Arcsine". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#asin.
const ret = cephes.asin(x);double = cephes.atan(x: double)
atan is the "Arctangent". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#atan.
const ret = cephes.atan(x);double = cephes.atan2(y: double, x: double)
atan2 is the "Quadrant correct arctangent". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#atan2.
const ret = cephes.atan2(y, x);double = cephes.cos(x: double)
cos is the "Cosine". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#cos.
const ret = cephes.cos(x);double = cephes.cosdg(x: double)
cosdg is the "Cosine of arg in degrees". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#cosdg.
const ret = cephes.cosdg(x);double = cephes.exp(x: double)
exp is the "Exponential, base e". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#exp.
const ret = cephes.exp(x);double = cephes.exp2(x: double)
exp2 is the "Exponential, base 2". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#exp2.
const ret = cephes.exp2(x);double = cephes.exp10(x: double)
exp10 is the "Exponential, base 10". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#exp10.
const ret = cephes.exp10(x);double = cephes.cosh(x: double)
cosh is the "Hyperbolic cosine". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#cosh.
const ret = cephes.cosh(x);double = cephes.sinh(x: double)
sinh is the "Hyperbolic sine". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#sinh.
const ret = cephes.sinh(x);double = cephes.tanh(x: double)
tanh is the "Hyperbolic tangent". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#tanh.
const ret = cephes.tanh(x);double = cephes.log(x: double)
log is the "Logarithm, base e". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#log.
const ret = cephes.log(x);double = cephes.log2(x: double)
log2 is the "Logarithm, base 2". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#log2.
const ret = cephes.log2(x);double = cephes.log10(x: double)
log10 is the "Logarithm, base 10". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#log10.
const ret = cephes.log10(x);double = cephes.pow(x: double, y: double)
pow is the "Power". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#pow.
const ret = cephes.pow(x, y);double = cephes.powi(x: double, nn: int)
powi is the "Integer Power". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#powi.
const ret = cephes.powi(x, nn);double = cephes.sin(x: double)
sin is the "Sine". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#sin.
const ret = cephes.sin(x);double = cephes.sindg(x: double)
sindg is the "Sine of arg in degrees". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#sindg.
const ret = cephes.sindg(x);double = cephes.tan(x: double)
tan is the "Tangent". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#tan.
const ret = cephes.tan(x);double = cephes.tandg(x: double)
tandg is the "Tangent of arg in degrees". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#tandg.
const ret = cephes.tandg(x);Exponential integral
double = cephes.ei(x: double)
ei is the "Exponential integral". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#ei.
const ret = cephes.ei(x);double = cephes.expn(n: int, x: double)
expn is the "Exponential integral". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#expn.
const ret = cephes.expn(n, x);[int, extra] = cephes.shichi(x: double)
shichi is the "Hyperbolic cosine integral". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#shichi.
const [ret, extra] = cephes.shichi(x);The extra object contains the following values:
const {
si: double,
ci: double
} = extra;[int, extra] = cephes.sici(x: double)
sici is the "Cosine integral". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#sici.
const [ret, extra] = cephes.sici(x);The extra object contains the following values:
const {
si: double,
ci: double
} = extra;Gamma
double = cephes.lbeta(a: double, b: double)
lbeta is the "Natural log of |beta|.". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#lbeta.
const ret = cephes.lbeta(a, b);double = cephes.beta(a: double, b: double)
beta is the "Beta". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#beta.
const ret = cephes.beta(a, b);double = cephes.fac(i: int)
fac is the "Factorial". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#fac.
const ret = cephes.fac(i);double = cephes.gamma(x: double)
gamma is the "Gamma". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#gamma.
const ret = cephes.gamma(x);double = cephes.lgam(x: double)
lgam is the "Logarithm of gamma function". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#lgam.
const ret = cephes.lgam(x);double = cephes.incbet(aa: double, bb: double, xx: double)
incbet is the "Incomplete beta integral". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#incbet.
const ret = cephes.incbet(aa, bb, xx);double = cephes.incbi(aa: double, bb: double, yy0: double)
incbi is the "Inverse beta integral". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#incbi.
const ret = cephes.incbi(aa, bb, yy0);double = cephes.igam(a: double, x: double)
igam is the "Incomplete gamma integral". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#igam.
const ret = cephes.igam(a, x);double = cephes.igamc(a: double, x: double)
igamc is the "Complemented gamma integral". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#igamc.
const ret = cephes.igamc(a, x);double = cephes.igami(a: double, y0: double)
igami is the "Inverse gamma integral". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#igami.
const ret = cephes.igami(a, y0);double = cephes.psi(x: double)
psi is the "Psi (digamma) function". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#psi.
const ret = cephes.psi(x);double = cephes.rgamma(x: double)
rgamma is the "Reciprocal Gamma". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#rgamma.
const ret = cephes.rgamma(x);Error function
double = cephes.erf(x: double)
erf is the "Error function". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#erf.
const ret = cephes.erf(x);double = cephes.erfc(a: double)
erfc is the "Complemented error function". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#erfc.
const ret = cephes.erfc(a);double = cephes.dawsn(xx: double)
dawsn is the "Dawson's integral". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#dawsn.
const ret = cephes.dawsn(xx);[int, extra] = cephes.fresnl(xxa: double)
fresnl is the "Fresnel integral". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#fresnl.
const [ret, extra] = cephes.fresnl(xxa);The extra object contains the following values:
const {
ssa: double,
cca: double
} = extra;Bessel
[int, extra] = cephes.airy(x: double)
airy is the "Airy". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#airy.
const [ret, extra] = cephes.airy(x);The extra object contains the following values:
const {
ai: double,
aip: double,
bi: double,
bip: double
} = extra;double = cephes.j0(x: double)
j0 is the "Bessel, order 0". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#j0.
const ret = cephes.j0(x);double = cephes.j1(x: double)
j1 is the "Bessel, order 1". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#j1.
const ret = cephes.j1(x);double = cephes.jn(n: int, x: double)
jn is the "Bessel, order n". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#jn.
const ret = cephes.jn(n, x);double = cephes.jv(n: double, x: double)
jv is the "Bessel, noninteger order". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#jv.
const ret = cephes.jv(n, x);double = cephes.y0(x: double)
y0 is the "Bessel, second kind, order 0". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#y0.
const ret = cephes.y0(x);double = cephes.y1(x: double)
y1 is the "Bessel, second kind, order 1". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#y1.
const ret = cephes.y1(x);double = cephes.yn(n: int, x: double)
yn is the "Bessel, second kind, order n". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#yn.
const ret = cephes.yn(n, x);double = cephes.yv(v: double, x: double)
yv is the "Bessel, noninteger order". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#yv.
const ret = cephes.yv(v, x);double = cephes.i0(x: double)
i0 is the "Modified Bessel, order 0". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#i0.
const ret = cephes.i0(x);double = cephes.i0e(x: double)
i0e is the "Exponentially scaled i0". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#i0e.
const ret = cephes.i0e(x);double = cephes.i1(x: double)
i1 is the "Modified Bessel, order 1". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#i1.
const ret = cephes.i1(x);double = cephes.i1e(x: double)
i1e is the "Exponentially scaled i1". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#i1e.
const ret = cephes.i1e(x);double = cephes.iv(v: double, x: double)
iv is the "Modified Bessel, nonint. order". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#iv.
const ret = cephes.iv(v, x);double = cephes.k0(x: double)
k0 is the "Mod. Bessel, 3rd kind, order 0". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#k0.
const ret = cephes.k0(x);double = cephes.k0e(x: double)
k0e is the "Exponentially scaled k0". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#k0e.
const ret = cephes.k0e(x);double = cephes.k1(x: double)
k1 is the "Mod. Bessel, 3rd kind, order 1". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#k1.
const ret = cephes.k1(x);double = cephes.k1e(x: double)
k1e is the "Exponentially scaled k1". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#k1e.
const ret = cephes.k1e(x);double = cephes.kn(nn: int, x: double)
kn is the "Mod. Bessel, 3rd kind, order n". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#kn.
const ret = cephes.kn(nn, x);Hypergeometric
double = cephes.hyperg(a: double, b: double, x: double)
hyperg is the "Confluent hypergeometric". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#hyperg.
const ret = cephes.hyperg(a, b, x);double = cephes.hyp2f1(a: double, b: double, c: double, x: double)
hyp2f1 is the "Gauss hypergeometric function". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#hyp2f1.
const ret = cephes.hyp2f1(a, b, c, x);Elliptic
double = cephes.ellpe(x: double)
ellpe is the "Complete elliptic integral". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#ellpe.
const ret = cephes.ellpe(x);double = cephes.ellie(phi: double, m: double)
ellie is the "Incomplete elliptic integral". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#ellie.
const ret = cephes.ellie(phi, m);double = cephes.ellpk(x: double)
ellpk is the "Complete elliptic integral". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#ellpk.
const ret = cephes.ellpk(x);double = cephes.ellik(phi: double, m: double)
ellik is the "Incomplete elliptic integral". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#ellik.
const ret = cephes.ellik(phi, m);[int, extra] = cephes.ellpj(u: double, m: double)
ellpj is the "Jacobian elliptic function". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#ellpj.
const [ret, extra] = cephes.ellpj(u, m);The extra object contains the following values:
const {
sn: double,
cn: double,
dn: double,
ph: double
} = extra;Probability
double = cephes.btdtr(a: double, b: double, x: double)
btdtr is the "Beta distribution". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#btdtr.
const ret = cephes.btdtr(a, b, x);double = cephes.smirnov(n: int, e: double)
smirnov is the "Exact Smirnov statistic, for one-sided test.". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#smirnov.
const ret = cephes.smirnov(n, e);double = cephes.kolmogorov(y: double)
kolmogorov is the "Kolmogorov's limiting distribution of two-sided test.". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#kolmogorov.
const ret = cephes.kolmogorov(y);double = cephes.smirnovi(n: int, p: double)
smirnovi is the "Functional inverse of Smirnov distribution.". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#smirnovi.