root 3bf41bf355 update 1 vuosi sitten
..
article 3bf41bf355 update 1 vuosi sitten
build 3bf41bf355 update 1 vuosi sitten
cephes 3bf41bf355 update 1 vuosi sitten
test 3bf41bf355 update 1 vuosi sitten
.babelrc 3bf41bf355 update 1 vuosi sitten
CONTRIBUTING.md 3bf41bf355 update 1 vuosi sitten
LICENSE 3bf41bf355 update 1 vuosi sitten
README.md 3bf41bf355 update 1 vuosi sitten
cephes-browser.js 3bf41bf355 update 1 vuosi sitten
cephes-wrapper.js 3bf41bf355 update 1 vuosi sitten
cephes.js 3bf41bf355 update 1 vuosi sitten
cephes.wasm 3bf41bf355 update 1 vuosi sitten
cephes.wasm.base64.json 3bf41bf355 update 1 vuosi sitten
index.js 3bf41bf355 update 1 vuosi sitten
package.json 3bf41bf355 update 1 vuosi sitten

README.md

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.

Note that there are a few cephes functions that are not exposed here, as some of them are quite hard to make consumable in JavaScript using WebAssembly. Feel free to send a pull request if you need one of them.

Install

npm install cephes

If 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.js

In 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 = ephes.polevl(1.1, arrayInput, arrayInput.length - 1);

Table of Content

Function Description Documentation
Arithmetic and Algebraic
signbit(x) Returns the sign bit c-doc  •  js-doc
isnan(x) Check if Not-A-Number c-doc  •  js-doc
isfinite(x) Check if finite 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
frexp(x) Extract exponent c-doc  •  js-doc
ldexp(x, pw2) Add integer to exponent 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
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);

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.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, 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);

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.

const ret = cephes.smirnovi(n, p);

double = cephes.kolmogi(p: double)

kolmogi is the "Functional inverse of Kolmogorov statistic for two-sided test.". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#kolmogi.

const ret = cephes.kolmogi(p);

double = cephes.nbdtri(k: int, n: int, p: double)

nbdtri is the "Inverse Negative binomial distribution". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#nbdtri.

const ret = cephes.nbdtri(k, n, p);

double = cephes.stdtri(k: int, p: double)

stdtri is the "Functional inverse of Student's t distribution". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#stdtri.

const ret = cephes.stdtri(k, p);

double = cephes.bdtr(k: int, n: int, p: double)

bdtr is the "Binomial distribution". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#bdtr.

const ret = cephes.bdtr(k, n, p);

double = cephes.bdtrc(k: int, n: int, p: double)

bdtrc is the "Complemented binomial". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#bdtrc.

const ret = cephes.bdtrc(k, n, p);

double = cephes.bdtri(k: int, n: int, y: double)

bdtri is the "Inverse binomial". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#bdtri.

const ret = cephes.bdtri(k, n, y);

double = cephes.chdtr(df: double, x: double)

chdtr is the "Chi square distribution". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#chdtr.

const ret = cephes.chdtr(df, x);

double = cephes.chdtrc(df: double, x: double)

chdtrc is the "Complemented Chi square". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#chdtrc.

const ret = cephes.chdtrc(df, x);

double = cephes.chdtri(df: double, y: double)

chdtri is the "Inverse Chi square". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#chdtri.

const ret = cephes.chdtri(df, y);

double = cephes.fdtr(ia: int, ib: int, x: double)

fdtr is the "F distribution". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#fdtr.

const ret = cephes.fdtr(ia, ib, x);

double = cephes.fdtrc(ia: int, ib: int, x: double)

fdtrc is the "Complemented F". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#fdtrc.

const ret = cephes.fdtrc(ia, ib, x);

double = cephes.fdtri(ia: int, ib: int, y: double)

fdtri is the "Inverse F distribution". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#fdtri.

const ret = cephes.fdtri(ia, ib, y);

double = cephes.gdtr(a: double, b: double, x: double)

gdtr is the "Gamma distribution". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#gdtr.

const ret = cephes.gdtr(a, b, x);

double = cephes.gdtrc(a: double, b: double, x: double)

gdtrc is the "Complemented gamma". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#gdtrc.

const ret = cephes.gdtrc(a, b, x);

double = cephes.nbdtr(k: int, n: int, p: double)

nbdtr is the "Negative binomial distribution". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#nbdtr.

const ret = cephes.nbdtr(k, n, p);

double = cephes.nbdtrc(k: int, n: int, p: double)

nbdtrc is the "Complemented negative binomial". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#nbdtrc.

const ret = cephes.nbdtrc(k, n, p);

double = cephes.ndtr(a: double)

ndtr is the "Normal distribution". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#ndtr.

const ret = cephes.ndtr(a);

double = cephes.ndtri(y0: double)

ndtri is the "Inverse normal distribution". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#ndtri.

const ret = cephes.ndtri(y0);

double = cephes.pdtr(k: int, m: double)

pdtr is the "Poisson distribution". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#pdtr.

const ret = cephes.pdtr(k, m);

double = cephes.pdtrc(k: int, m: double)

pdtrc is the "Complemented Poisson". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#pdtrc.

const ret = cephes.pdtrc(k, m);

double = cephes.pdtri(k: int, y: double)

pdtri is the "Inverse Poisson distribution". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#pdtri.

const ret = cephes.pdtri(k, y);

double = cephes.stdtr(k: int, t: double)

stdtr is the "Student's t distribution". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#stdtr.

const ret = cephes.stdtr(k, t);

Miscellaneous

double = cephes.plancki(w: double, T: double)

plancki is the "Integral of Planck's black body radiation formula". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#plancki.

const ret = cephes.plancki(w, T);

double = cephes.planckc(w: double, T: double)

planckc is the "Complemented Planck radiation integral". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#planckc.

const ret = cephes.planckc(w, T);

double = cephes.planckd(w: double, T: double)

planckd is the "Planck's black body radiation formula". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#planckd.

const ret = cephes.planckd(w, T);

double = cephes.planckw(T: double)

planckw is the "Wavelength, w, of maximum radiation at given temperature T.". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#planckw.

const ret = cephes.planckw(T);

double = cephes.spence(x: double)

spence is the "Dilogarithm". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#spence.

const ret = cephes.spence(x);

double = cephes.zetac(x: double)

zetac is the "Riemann Zeta function". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#zetac.

const ret = cephes.zetac(x);

double = cephes.zeta(x: double, q: double)

zeta is the "Two argument zeta function". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#zeta.

const ret = cephes.zeta(x, q);

double = cephes.struve(v: double, x: double)

struve is the "Struve function". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#struve.

const ret = cephes.struve(v, x);

Polynomials and Power Series

double = cephes.p1evl(x: double, coef: Float64Array, N: int)

p1evl is the "Evaluate polynomial when coefficient of x is 1.0.". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#p1evl.

const ret = cephes.p1evl(x, new Float64Array(coef), N);

double = cephes.polylog(n: int, x: double)

polylog is the "The polylogarithm of order n". You can read the full documentation at http://www.netlib.org/cephes/doubldoc.html#polylog.

const ret = cephes.polylog(n, x);

LICENSE

The cephes library, that this module wraps, can be found at http://www.netlib.org/cephes/. The cephes library from the NetLib website, doesn't have any license. However, the author Stephen Moshier, has kindly given permission for it to be included in a BSD-licensed package.

Please see the LICENSE file, for all the details.