These are some more exotic mathematical functions which are sometimes useful. Currently they only have real-valued versions.
double function>erf/function> (double x) float function>erff/function> (float x) long double function>erfl/function> (long double x) erf returns the error function of x. The error function is defined as
erf (x) = 2/sqrt(pi) * integral from 0 to x of exp(-t^2) dt
double function>erfc/function> (double x) float function>erfcf/function> (float x) long double function>erfcl/function> (long double x) erfc returns 1.0 - erf(x), but computed in a fashion that avoids round-off error when x is large.
double function>lgamma/function> (double x) float function>lgammaf/function> (float x) long double function>lgammal/function> (long double x) lgamma returns the natural logarithm of the absolute value of the gamma function of x. The gamma function is defined as
gamma (x) = integral from 0 to oo 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, or -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 non-positive integers. lgamma will raise the zero divide exception if evaluated at a singularity.
double function>lgamma_r/function> (double x, int *signp) float function>lgammaf_r/function> (float x, int *signp) long double function>lgammal_r/function> (long double x, int *signp) 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. This means it is reentrant.
double function>gamma/function> (double x) float function>gammaf/function> (float x) long double function>gammal/function> (long double x) These functions exist for compatibility reasons. They are equivalent to lgamma etc. It is better to use lgamma since for one the name reflects better the actual computation, moreover lgamma is standardized in ISO C99 while gamma is not.
double function>tgamma/function> (double x) float function>tgammaf/function> (float x) long double function>tgammal/function> (long double x) tgamma applies the gamma function to x. The gamma function is defined as
gamma (x) = integral from 0 to oo of t^(x-1) e^-t dt
This function was introduced in ISO C99.
double function>j0/function> (double x) float function>j0f/function> (float x) long double function>j0l/function> (long double x) j0 returns the Bessel function of the first kind of order 0 of x. It may signal underflow if x is too large.
double function>j1/function> (double x) float function>j1f/function> (float x) long double function>j1l/function> (long double x) j1 returns the Bessel function of the first kind of order 1 of x. It may signal underflow if x is too large.
double function>jn/function> (int n, double x) float function>jnf/function> (int n, float x) long double function>jnl/function> (int n, long double x) jn returns the Bessel function of the first kind of order n of x. It may signal underflow if x is too large.
double function>y0/function> (double x) float function>y0f/function> (float x) long double function>y0l/function> (long double x) 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 -oo.
double function>y1/function> (double x) float function>y1f/function> (float x) long double function>y1l/function> (long double x) 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 -oo.
double function>yn/function> (int n, double x) float function>ynf/function> (int n, float x) long double function>ynl/function> (int n, long double x) 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 -oo.