These are some more exotic mathematical functions, which are sometimes useful. Currently they only have real-valued versions.
erf
returns the error function of x. The error
function is defined as
@ifnottex
erf (x) = 2/sqrt(pi) * integral from 0 to x of exp(-t^2) dt
erfc
returns 1.0 - erf(x)
, but computed in a
fashion that avoids round-off error when x is large.
lgamma
returns the natural logarithm of the absolute value of
the gamma function of x. The gamma function is defined as
@ifnottex
gamma (x) = integral from 0 to @infinity{} of t^(x-1) e^-t dt
The sign of the gamma function is stored in the global variable
signgam, which is declared in `math.h'. It is 1
if
the intermediate result was positive or zero, and, -1
if it was
negative.
To compute the real gamma function you can use the tgamma
function or you can compute the values as follows:
lgam = lgamma(x); gam = signgam*exp(lgam);
The gamma function has singularities at the nonpositive integers.
lgamma
will raise the zero divide exception if evaluated at a
singularity.
lgamma_r
is just like lgamma
, but it stores the sign of
the intermediate result in the variable pointed to by signp
instead of in the signgam global.
lgamma
etc. It is better to use lgamma
since for one the
name reflects better the actual computation and lgamma
is also
standardized in ISO C 9x while gamma
is not.
tgamma
applies the gamma function to x. The gamma
function is defined as
@ifnottex
gamma (x) = integral from 0 to @infinity{} of t^(x-1) e^-t dt
This function was introduced in ISO C 9x.
j0
returns the Bessel function of the first kind of order 0 of
x. It may signal underflow if x is too large.
j1
returns the Bessel function of the first kind of order 1 of
x. It may signal underflow if x is too large.
jn
returns the Bessel function of the first kind of order
n of x. It may signal underflow if x is too large.
y0
returns the Bessel function of the second kind of order 0 of
x. It may signal underflow if x is too large. If x
is negative, y0
signals a domain error; if it is zero,
y0
signals overflow and returns @math{-@infinity}.
y1
returns the Bessel function of the second kind of order 1 of
x. It may signal underflow if x is too large. If x
is negative, y1
signals a domain error; if it is zero,
y1
signals overflow and returns @math{-@infinity}.
yn
returns the Bessel function of the second kind of order n of
x. It may signal underflow if x is too large. If x
is negative, yn
signals a domain error; if it is zero,
yn
signals overflow and returns @math{-@infinity}.
Go to the first, previous, next, last section, table of contents.