Methods
Own
(private, static) _underflow(a) → {Number}
Parameters
| Name | Type | Description |
|---|---|---|
a |
Number |
Returns
- Type
- Number
Details
- Source
- math/probfuncs.js, line 322
(static) erf(x) → {Number}
Error function
SYNOPSIS:
double x, y, erf();
y = erf( x );
DESCRIPTION:
The integral is
x
-
2 | | 2
erf(x) = -------- | exp( - t ) dt.
sqrt(pi) | |
-
0
For 0 <= |x| < 1, erf(x) = x * P4(x**2)/Q5(x**2); otherwise
erf(x) = 1 - erfc(x).
ACCURACY:
Relative error:
arithmetic domain # trials peak rms
DEC 0,1 14000 4.7e-17 1.5e-17
IEEE 0,1 30000 3.7e-16 1.0e-16
Parameters
| Name | Type | Description |
|---|---|---|
x |
Number |
Returns
- Type
- Number
Details
- Source
- math/probfuncs.js, line 487
(static) erfc(a) → {Number}
Complementary error function
SYNOPSIS:
double x, y, erfc();
y = erfc( x );
DESCRIPTION:
1 - erf(x) =
inf.
-
2 | | 2
erfc(x) = -------- | exp( - t ) dt
sqrt(pi) | |
-
x
For small x, erfc(x) = 1 - erf(x); otherwise rational
approximations are computed.
A special function expx2.c is used to suppress error amplification
in computing exp(-x^2).
ACCURACY:
Relative error:
arithmetic domain # trials peak rms
IEEE 0,26.6417 30000 1.3e-15 2.2e-16
ERROR MESSAGES:
message condition value returned
erfc underflow x > 9.231948545 (DEC) 0.0
Parameters
| Name | Type | Description |
|---|---|---|
a |
Number |
Returns
- Type
- Number
Details
- Source
- math/probfuncs.js, line 380
(private, static) erfce(x) → {Number}
Exponentially scaled erfc function
exp(x^2) erfc(x)
valid for x > 1.
Use with ndtr and expx2.
Parameters
| Name | Type | Description |
|---|---|---|
x |
Number |
Returns
- Type
- Number
Details
- Source
- math/probfuncs.js, line 434
(static) erfi(x) → {Number}
Inverse of error function erf.
Parameters
| Name | Type | Description |
|---|---|---|
x |
Number |
Returns
- Type
- Number
Details
- Source
- math/probfuncs.js, line 639
(private, static) expx2(x, sign) → {Number}
Exponential of squared argument
SYNOPSIS:
double x, y, expx2();
int sign;
y = expx2( x, sign );
DESCRIPTION:
Computes y = exp(x*x) while suppressing error amplification
that would ordinarily arise from the inexactness of the
exponential argument x*x.
If sign < 0, the result is inverted; i.e., y = exp(-x*x) .
ACCURACY:
Relative error:
arithmetic domain # trials peak rms
IEEE -26.6, 26.6 10^7 3.9e-16 8.9e-17
Parameters
| Name | Type | Description |
|---|---|---|
x |
Number | |
sign |
Number | (int) |
Returns
- Type
- Number
Details
- Source
- math/probfuncs.js, line 128
(static) ndtr(a) → {Number}
Normal distribution function
SYNOPSIS:
y = ndtr( x );
DESCRIPTION:
Returns the area under the Gaussian probability density
function, integrated from minus infinity to x:
x
-
1 | | 2
ndtr(x) = --------- | exp( - t /2 ) dt
sqrt(2pi) | |
-
-inf.
= ( 1 + erf(z) ) / 2
= erfc(z) / 2
where z = x/sqrt(2). Computation is via the functions
erf and erfc with care to avoid error amplification in computing exp(-x^2).
ACCURACY:
Relative error:
arithmetic domain # trials peak rms
IEEE -13,0 30000 1.3e-15 2.2e-16
ERROR MESSAGES:
message condition value returned
erfc underflow x > 37.519379347 0.0
Parameters
| Name | Type | Description |
|---|---|---|
a |
Number |
Returns
- Type
- Number
Details
- Source
- math/probfuncs.js, line 295
(static) ndtri(y0) → {Number}
Inverse of Normal distribution function
SYNOPSIS:
double x, y, ndtri();
x = ndtri( y );
DESCRIPTION:
Returns the argument, x, for which the area under the
Gaussian probability density function (integrated from
minus infinity to x) is equal to y.
For small arguments 0 < y < exp(-2), the program computes
z = sqrt( -2.0 * log(y) ); then the approximation is
x = z - log(z)/z - (1/z) P(1/z) / Q(1/z).
There are two rational functions P/Q, one for 0 < y < exp(-32)
and the other for y up to exp(-2). For larger arguments,
w = y - 0.5, and x/sqrt(2pi) = w + w**3 R(w**2)/S(w**2)).
ACCURACY:
Relative error:
arithmetic domain # trials peak rms
DEC 0.125, 1 5500 9.5e-17 2.1e-17
DEC 6e-39, 0.135 3500 5.7e-17 1.3e-17
IEEE 0.125, 1 20000 7.2e-16 1.3e-16
IEEE 3e-308, 0.135 50000 4.6e-16 9.8e-17
ERROR MESSAGES:
message condition value returned
ndtri domain x <= 0 -MAXNUM
ndtri domain x >= 1 MAXNUM
Parameters
| Name | Type | Description |
|---|---|---|
y0 |
Number |
Returns
- Type
- Number
Details
- Source
- math/probfuncs.js, line 587
(private, static) p1evl(x, coef, N) → {Number}
Evaluate polynomial when coefficient of x is 1.0. Otherwise same as polevl.
Parameters
| Name | Type | Description |
|---|---|---|
x |
Number | |
coef |
Number | |
N |
Number |
Returns
- Type
- Number
Details
- Source
- math/probfuncs.js, line 234
(private, static) polevl(x, coef, N) → {Number}
Evaluate polynomial
SYNOPSIS:
int N;
double x, y, coef[N+1], polevl[];
y = polevl( x, coef, N );
DESCRIPTION:
Evaluates polynomial of degree N:
2 N
y = C + C x + C x +...+ C x
0 1 2 N
Coefficients are stored in reverse order:
coef[0] = C , ..., coef[N] = C .
N 0
The function p1evl() assumes that coef[N] = 1.0 and is
omitted from the array. Its calling arguments are
otherwise the same as polevl().
SPEED:
In the interest of speed, there are no checks for out
of bounds arithmetic. This routine is used by most of
the functions in the library. Depending on available
equipment features, the user may wish to rewrite the
program in microcode or assembly language.
Parameters
| Name | Type | Description |
|---|---|---|
x |
Number | |
coef |
Number | |
N |
Number |
Returns
- Type
- Number
Details
- Source
- math/probfuncs.js, line 208
Inherited
none