Mathematical Special Functions






Mathematical Special Functions

The TR1 library provides a number of advanced mathematical functions that operate on real floating-point values of type float, double, and long double. These functions are in the list of special functions specified in Figure of [Int92].

Just as with the basic math functions (Section 12.7), the partial synopsis[17] of the header gives one signature; the function descriptions give all of the explicitly required overloads. Additional overloads are available as needed to satisfy the new overload rules (Section 12.6).

[17] The complete synopsis is in Appendix A.5.

12.8.1. Header <math.h> Synopsis

     // LAGUERRE POLYNOMIALS
double laguerre(unsigned n, double x);
double assoc_laguerre(unsigned n, unsigned m, double x);

  // LEGENDRE FUNCTIONS
double legendre(unsigned l, double x);
double assoc_legendre(unsigned l, unsigned m, double x);
double sph_legendre(unsigned l, unsigned m, double theta);

  // GAMMA FUNCTIONS
double lgamma(double x);
double tgamma(double x);

  // BETA FUNCTION
double beta(double x, double y);

  // ERROR FUNCTIONS
double erf(double x);
double erfc(double x);

  // ELLIPTIC INTEGRALS
double ellint_1(double k, double phi);
double ellint_2(double k, double phi);
double ellint_3(double k, double nu, double phi)
double comp_ellint_1(double k);
double comp_ellint_2(double k);
double comp_ellint_3(double k, double nu);

  // HYPERGEOMETRIC FUNCTIONS
double hyperg(double a, double b, double c, double x);
double conf_hyperg(double a, double c, double x);

  // BESSEL FUNCTIONS
double cyl_bessel_i(double nu, double x);
double cyl_bessel_j(double nu, double x);
double cyl_bessel_k(double nu, double x);
double sph_bessel(unsigned n, double x);

  // NEUMANN FUNCTIONS
double cyl_neumann(double nu, double x);
double sph_neumann(unsigned n, double x);

  // EXPONENTIAL INTEGRAL
double expint(double x);

  // HERMITE POLYNOMIALS
double hermite(unsigned n, double x);

  // ZETA FUNCTION
double riemann_zeta(double x);

Laguerre Polynomials

double laguerre(unsigned n, double x);
float laguerre(unsigned n, float x);
long double laguerre(unsigned n, long double x);
float laguerref(unsigned n, float x);
long double laguerrel(unsigned n, long double x);

The functions return the Laguerre polynomial of n and x, defined as


A domain error occurs if x < 0. The effect of calling this function is implementation defined if n >= 128.

double assoc_laguerre(unsigned n, unsigned m, double x);
float assoc_laguerre(unsigned n, unsigned m, float x);
long double assoc_laguerre(
  unsigned n, unsigned m, long double x);
float assoc_laguerref(unsigned n, unsigned m, float x);
long double assoc_laguerrel(
  unsigned n, unsigned m, long double x);

The functions return the associated Laguerre polynomial of n, m, and x, defined as


A domain error occurs if x < 0. The effect of calling this function is implementation defined if n >= 128.

Legendre Polynomials

double legendre(unsigned l, double x);
float legendre(unsigned l, float x);
long double legendre(unsigned l, long double x);
float legendref(unsigned l, float x);
long double legendrel(unsigned l, long double x);

The functions return the Legendre function of l and x, defined as


A domain error occurs if |x| > 1. The effect of calling this function is implementation defined if l >= 128.

double assoc_legendre(unsigned l, unsigned m, double x);
float assoc_legendre(unsigned l, unsigned m, float x);
long double assoc_legendre(
  unsigned l, unsigned m, long double x);
float assoc_legendref(unsigned l, unsigned m, float x);
long double assoc_legendrel(
  unsigned l, unsigned m, long double x);

The functions return the associated Legendre function of l, m, and x, defined as


A domain error occurs if x < 0. The effect of calling this function is implementation defined if l >= 128.

double sph_legendre(unsigned l, unsigned m, double theta);
float sph_legendre(unsigned l, unsigned m, float theta);
long double sph_legendre(
  unsigned l, unsigned m, long double theta);
float sph_legendref(unsigned l, unsigned m, float theta);
long double sph_legendrel(
  unsigned l, unsigned m, long double theta);

The functions return the spherical associated Legendre function of l, m, and theta, defined as , where


A domain error occurs if |m| > l. The effect of calling this function is implementation defined if l >= 128.

Gamma Functions

double tgamma(double x);
float tgamma(float x);
long double tgamma(long double x);
float tgamma(float x);
long double tgamma(long double x);

The functions return the gamma function of x, defined as


A domain error occurs if x is a negative integer or if x == 0 and the implementation cannot represent the result.

double lgamma(double x);
float lgamma(float x);
long double lgamma(long double x);
float lgamma(float x);
long double lgamma(long double x);

The functions return the logarithm of the absolute value of the gamma function of x. A domain error occurs if x <= 0.

Beta Function

double beta(double x, double y);
float beta(float x, float y);
long double beta(long double x, long double y);
float betaf(float x, float y);
long double betal(long double x, long double y);

The functions return the beta function of x and y, defined as


Error Functions

double erf(double x);
float erf(float x);
long double erf(long double x);
float erff(float x);
long double erfl(long double x);

The functions return the error function of x, defined as


double erfc(double x);
float erfc(float x);
long double erfc(long double x);
float erfcf(float x);
long double erfcl(long double x);

The functions return the complementary error function of x, defined as


Elliptic Integrals

double ellint_1(double k, double phi);
float ellint_1(float k, float phi);
long double ellint_1(long double k, long double phi);
float ellint_1f(float k, float phi);
long double ellint_1l(long double k, long double phi);

The functions return the incomplete elliptic integral of the first kind of k and phi, defined as


A domain error occurs if |k| > 1.

double ellint_2(double k, double phi);
float ellint_2(float k, float phi);
long double ellint_2(long double k, long double phi);
float ellint_2f(float k, float phi);
long double ellint_2l(long double k, long double phi);

The functions return the incomplete elliptic integral of the second kind of k and phi, defined as


A domain error occurs if |k| > 1.

double ellint_3(double k, double nu, double phi)
float ellint_3(float k, float nu, float phi)
long double ellint_3(
  long double k, long double nu, long double phi)
float ellint_3f(float k, float nu, float phi)
long double ellint_3l(
  long double k, long double nu, long double phi)

The functions return the incomplete elliptic integral of the second kind of nu, k, and phi, defined as


A domain error occurs if |k| > 1.

double comp_ellint_1(double k);
float comp_ellint_1(float k);
long double comp_ellint_1(long double k);
float comp_ellint_1f(float k);
long double comp_ellint_1l(long double k);

The functions return the complete elliptic integral of the first kind of k, defined as


double comp_ellint_2(double k);
float comp_ellint_2(float k);
long double comp_ellint_2(long double k);
float comp_ellint_2f(float k);
long double comp_ellint_2l(long double k);

The functions return the complete elliptic integral of the second kind of k, defined as


double comp_ellint_3(double k, double nu);
float comp_ellint_3(float k, float nu);
long double comp_ellint_3(long double k, long double nu);
float comp_ellint_3f(float k, float nu);
long double comp_ellint_3l(long double k, long double nu);

The functions return the complete elliptic integral of the third kind of k and n, defined as


Hypergeometric Functions

double hyperg(double a, double b, double c, double x);
float hypergf(float a, float b, float c, float x);
long double hypergl(long double a, long double b,
  long double c, long double x);
float hyperg(float a, float b, float c, float x);
long double hyperg(long double a, long double b,
  long double c, long double x);

The functions return the hypergeometric function of a, b, c, and x, defined as


double conf_hyperg(double a, double c, double x);
float conf_hyperg(float a, float c, float x);
long double conf_hyperg(
  long double a, long double c, long double x);
float conf_hypergf(float a, float c, float x);
long double conf_hypergl(
  long double a, long double c, long double x);

The functions return the confluent hypergeometric function of a, c, and x, defined as


Bessel Functions

double cyl_bessel_i(double nu, double x);
float cyl_bessel_i(float nu, float x);
long double cyl_bessel_i(long double nu, long double x);
float cyl_bessel_if(float nu, float x);
long double cyl_bessel_il(long double nu, long double x);

The functions return the regular modified cylindrical Bessel function of nu and x, defined as


A domain error occurs if x < 0. The effect of calling this function is implementation defined if nu >= 128.

double cyl_bessel_j(double nu, double x);
float cyl_bessel_j(float nu, float x);
long double cyl_bessel_j(long double nu, long double x);
float cyl_bessel_jf(float nu, float x);
long double cyl_bessel_jl(long double nu, long double x);

The functions return the cylindrical Bessel function of the first kind of nu and x, defined as


A domain error occurs if x < 0. The effect of calling this function is implementation defined if nu >= 128.

double cyl_bessel_k(double nu, double x);
float cyl_bessel_k(float nu, float x);
long double cyl_bessel_k(long double nu, long double x);
float cyl_bessel_kf(float nu, float x);
long double cyl_bessel_kl(long double nu, long double x);

The functions return the irregular modified cylindrical Bessel function of nu and x, defined as


A domain error occurs if x < 0. The effect of calling this function is implementation defined if nu >= 128.

double sph_bessel(unsigned n, double x);
float sph_bessel(unsigned n, float x);
long double sph_bessel(unsigned n, long double x);
float sph_besself(unsigned n, float x);
long double sph_bessell(unsigned n, long double x);

The functions return the spherical Bessel function of the first kind of n and x, defined as


A domain error occurs if x < 0. The effect of calling this function is implementation defined if n >= 128.

Neumann Functions

double cyl_neumann(double nu, double x);
float cyl_neumann(float nu, float x);
long double cyl_neumann(long double nu, long double x);
float cyl_neumannf(float nu, float x);
long double cyl_neumannl(long double nu, long double x);

The functions return the cylindrical Neumann function, also known as the cylindrical Bessel function of the second kind, of nu and x, defined as


A domain error occurs if x < 0. The effect of calling this function is implementation defined if n >= 128.

double sph_neumann(unsigned n, double x);
float sph_neumann(unsigned n, float x);
long double sph_neumann(unsigned n, long double x);
float sph_neumannf(unsigned n, float x);
long double sph_neumannl(unsigned n, long double x);

The functions return the spherical Neumann function, also known as the spherical Bessel function of the second kind, of n and x, defined as


A domain error occurs if x < 0. The effect of calling this function is implementation defined if n >= 128.

Exponential Integral

double expint(double x);
float expint(float x);
long double expint(long double x);
float expintf(float x);
long double expintl(long double x);

The functions return the exponential integral of x, defined as


Hermite Polynomials

double hermite(unsigned n, double x);
float hermite(unsigned n, float x);
long double hermite(unsigned n, long double x);
float hermitef(unsigned n, float x);
long double hermitel(unsigned n, long double x);

The functions return the Hermite polynomial of n and x, defined as


The effect of calling this function is implementation defined if n >= 128.

Zeta Function

double riemann_zeta(double x);
float riemann_zeta(float x);
long double riemann_zeta(long double x);
float riemann_zetaf(float x);
long double riemann_zetal(long double x);

The functions return the Riemann zeta function of x, defined as




 Python   SQL   Java   php   Perl 
 game development   web development   internet   *nix   graphics   hardware 
 telecommunications   C++ 
 Flash   Active Directory   Windows