Namespace JXG.Math.ProbFuncs
↳ JXG.Math.ProbFuncs
Defined in: probfuncs.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Probability functions, e.g.
|
Method Attributes | Method Name and Description |
---|---|
<private> <static> |
JXG.Math.ProbFuncs._underflow(a)
|
<static> |
JXG.Math.ProbFuncs.erf(x)
Error function
SYNOPSIS:
double x, y, erf();
y = erf( x );
DESCRIPTION:
The integral is
x
-
2 | | 2
erf(x) = -------- | exp( - t ) dt.
|
<static> |
JXG.Math.ProbFuncs.erfc(a)
Complementary error function
SYNOPSIS:
double x, y, erfc();
y = erfc( x );
DESCRIPTION:
1 - erf(x) =
inf.
|
<private> <static> |
JXG.Math.ProbFuncs.erfce(x)
Exponentially scaled erfc function
exp(x^2) erfc(x)
valid for x > 1.
|
<static> |
JXG.Math.ProbFuncs.erfi(x)
Inverse of error function erf.
|
<private> <static> |
JXG.Math.ProbFuncs.expx2(x, sign)
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.
|
<static> |
JXG.Math.ProbFuncs.ndtr(a)
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.
|
<static> |
JXG.Math.ProbFuncs.ndtri(y0)
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.
|
<private> <static> |
JXG.Math.ProbFuncs.p1evl(x, coef, N)
Evaluate polynomial when coefficient of x is 1.0.
|
<private> <static> |
JXG.Math.ProbFuncs.polevl(x, coef, N)
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 +.
|
Namespace Detail
JXG.Math.ProbFuncs
Probability functions, e.g. error function,
see: https://en.wikipedia.org/wiki/Error_function
Ported from
by https://github.com/jeremybarnes/cephes/blob/master/cprob/ndtr.c,
Cephes Math Library Release 2.9: November, 2000
Copyright 1984, 1987, 1988, 1992, 2000 by Stephen L. Moshier
Method Detail
<private> <static>
{Number}
JXG.Math.ProbFuncs._underflow(a)
- Parameters:
- {Number} a
- Returns:
- {Number}
<static>
{Number}
JXG.Math.ProbFuncs.erf(x)
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:
- {Number} x
- Returns:
- {Number}
<static>
{Number}
JXG.Math.ProbFuncs.erfc(a)
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:
- {Number} a
- Returns:
- {Number}
<private> <static>
{Number}
JXG.Math.ProbFuncs.erfce(x)
Exponentially scaled erfc function
exp(x^2) erfc(x)
valid for x > 1.
Use with ndtr and expx2.
- Parameters:
- {Number} x
- Returns:
- {Number}
<static>
{Number}
JXG.Math.ProbFuncs.erfi(x)
Inverse of error function erf.
- Parameters:
- {Number} x
- Returns:
- {Number}
<private> <static>
{Number}
JXG.Math.ProbFuncs.expx2(x, sign)
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:
- {Number} x
- {Number} sign
- (int)
- Returns:
- {Number}
<static>
{Number}
JXG.Math.ProbFuncs.ndtr(a)
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:
- {Number} a
- Returns:
- {Number}
<static>
{Number}
JXG.Math.ProbFuncs.ndtri(y0)
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:
- {Number} y0
- Returns:
- {Number}
<private> <static>
{Number}
JXG.Math.ProbFuncs.p1evl(x, coef, N)
Evaluate polynomial when coefficient of x is 1.0.
Otherwise same as polevl.
- Parameters:
- {Number} x
- {Number} coef
- {Number} N
- Returns:
- {Number}
<private> <static>
{Number}
JXG.Math.ProbFuncs.polevl(x, coef, N)
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:
- {Number} x
- {Number} coef
- {Number} N
- Returns:
- {Number}