Special Functions ↑

Contents: ↑

  1. Usage:

  2. GSL::Sf::Result class

  3. Modes

  4. Airy functions

  5. Bessel functins

  6. Clausen functins

  7. Coulomb functins

  8. Coupling coefficients

  9. Dawson coefficients

  10. Debye coefficients

  11. Dilogarithm

  12. Elementary operations

  13. Elliptic integrals

  14. Elliptic functions

  15. Error functions

  16. Exponential functions

  17. Exponential integrals

  18. Fermi-Dirac function

  19. Gamma function

  20. Gegenbauer functions

  21. Hypergeometric functions

  22. Laguerre functions

  23. Lambert W functions

  24. Legendre functions and spherical harmonics

  25. Logarithm and related functions

  26. Mathieu functions

  27. Power function

  28. Psi (digamma) function

  29. Synchrotron functions

  30. Transport functions

  31. Trigonometric functions

  32. Zeta functions

Usage ↑

Ruby/GSL provides all the (documented) GSL special functions as module functions under the GSL::Sf module. The prefix gsl_sf_ in C functions is replaced by the module identifier GSL::Sf::. For example, the regular Bessel function of 0-th order is evaluated as

y = GSL::Sf::bessel_J0(x)

or

include GSL::Sf
y = bessel_J0(x)

where the argument x can be a Numeric, GSL::Vector, GSL::Matrix, or an NArray object.

Example:

>> require("gsl")
=> true
>> x = 1.0
=> 1.0
>> Sf::bessel_J0(x)
=> 0.765197686557967
>> x = Vector[1, 2, 3, 4]
=> GSL::Vector
[ 1.000e+00 2.000e+00 3.000e+00 4.000e+00 ]
>> Sf::bessel_J0(x)
=> GSL::Vector
[ 7.652e-01 2.239e-01 -2.601e-01 -3.971e-01 ]
>> x = Matrix[1..4, 2, 2]
=> GSL::Matrix
[  1.000e+00  2.000e+00
   3.000e+00  4.000e+00 ]
>> Sf::bessel_J0(x)
=> GSL::Matrix
[  7.652e-01  2.239e-01
  -2.601e-01 -3.971e-01 ]
>> x = NArray[1.0, 2, 3, 4]
=> NArray.float(4):
[ 1.0, 2.0, 3.0, 4.0 ]
>> Sf::bessel_J0(x)
=> NArray.float(4):
[ 0.765198, 0.223891, -0.260052, -0.39715 ]

Result class ↑

The Ruby methods as wrappers of GSL functions with the suffix “_e” return GSL::Sf::Result objects which contain the function values as well as error information.

Result instance methods ↑





Modes ↑

The goal of the library is to achieve double precision accuracy wherever possible. However the cost of evaluating some special functions to double precision can be significant, particularly where very high order terms are required. In these cases a mode argument allows the accuracy of the function to be reduced in order to improve performance. The following precision levels are available for the mode argument, given by Fixnum constants under the GSL module,

The approximate mode provides the fastest evaluation at the lowest accuracy.

Airy Functions and Derivatives ↑





Derivatives of Airy Functions ↑





Zeros of Airy Functions ↑



Zeros of Derivatives of Airy Functions ↑



Bessel Functions ↑

Regular Cylindrical Bessel Functions ↑





Irregular Cylindrical Bessel Functions ↑





Regular Modified Cylindrical Bessel Functions ↑









Irregular Modified Cylindrical Bessel Functions ↑









Regular Spherical Bessel Functions ↑







Irregular Spherical Bessel Functions ↑






Regular Modified Spherical Bessel Functions ↑






Irregular Modified Spherical Bessel Functions ↑






Regular Bessel Function - Fractional Order ↑



Irregular Bessel Functions - Fractional Order ↑


Regular Modified Bessel Functions - Fractional Order ↑



Irregular Modified Bessel Functions - Fractional Order ↑




Zeros of Regular Bessel Functions ↑




Clausen Functions ↑


Coulomb Functions ↑



Coulomb Wave Functions ↑






Coulomb Wave Function Normalization Constant ↑



Coupling Coefficients ↑

The Wigner 3-j, 6-j and 9-j symbols give the coupling coefficients for combined angular momentum vectors. Since the arguments of the standard coupling coefficient functions are integer or half-integer, the arguments of the following functions are, by convention, integers equal to twice the actual spin value. For information on the 3-j coefficients see Abramowitz & Stegun, Section 27.9.




Dawson Function ↑

The Dawson integral is defined by exp(-x^2) int_0^x dt exp(t^2). A table of Dawson's integral can be found in Abramowitz & Stegun, Table 7.5.


Debye Functions ↑

The Debye functions are defined by the integral D_n(x) = n/x^n int_0^x dt (t^n/(e^t - 1)). For further information see Abramowitz & Stegun, Section 27.1.


Dilogarithm ↑

Real Argument ↑


Complex Argument ↑


Elementary Operations ↑

The following methods allow for the propagation of errors when combining quantities by multiplication.



Elliptic Integrals ↑

Legendre Form of Complete Elliptic Integrals ↑



Legendre Form of Incomplete Elliptic Integrals ↑




Carlson Forms ↑





Elliptic Functions (Jacobi) ↑


Error Functions ↑




Probability functions ↑




Exponential Functions ↑




Relative Exponential Functions ↑





Exponentiation With Error Estimate ↑





Exponential Integrals ↑

Exponential Integral ↑




Ei(x) ↑


Hyperbolic Integrals ↑



Ei_3(x) ↑


Trigonometric Integrals ↑



Arctangent Integral ↑


Fermi-Dirac Functions ↑

Complete Fermi-Dirac Integrals ↑

The complete Fermi-Dirac integral F_j(x) is given by,

F_j(x)   := (1/r Gamma(j+1)) int_0^infty dt (t^j / (exp(t-x) + 1))








Incomplete Fermi-Dirac Integrals ↑


Gamma Function ↑

The Gamma function is defined by the following integral,

Gamma(x) = int_0^infty dt  t^{x-1} exp(-t)

Further information on the Gamma function can be found in Abramowitz & Stegun, Chapter 6.
























Gegenbauer Functions ↑




Hypergeometric Functions ↑













Laguerre Functions ↑

The Laguerre polynomials are defined in terms of confluent hypergeometric functions as L^a_n(x) = ((a+1)_n / n!) 1F1(-n,a+1,x).



Lambert W Functions ↑

Lambert's W functions, W(x), are defined to be solutions of the equation W(x) exp(W(x)) = x. This function has multiple branches for x < 0; however, it has only two real-valued branches. We define W_0(x) to be the principal branch, where W > -1 for x < 0, and W_{-1}(x) to be the other real branch, where W < -1 for x < 0.



Legendre Functions and Spherical Harmonics ↑

Legendre Polynomials ↑







Associated Legendre Polynomials and Spherical Harmonics ↑

The following functions compute the associated Legendre Polynomials P_l^m(x). Note that this function grows combinatorially with l and can overflow for l larger than about 150. There is no trouble for small m, but overflow occurs when m and l are both large. Rather than allow overflows, these functions refuse to calculate P_l^m(x) and return GSL::EOVRFLW when they can sense that l and m are too big. If you want to calculate a spherical harmonic, then do not use these functions. Instead use GSL::Sf::legendre_sphPlm() below, which uses a similar recursion, but with the normalized functions.






Conical Functions ↑

The Conical Functions P^mu_{-(1/2)+i lambda}(x), Q^mu_{-(1/2)+i lambda} are described in Abramowitz & Stegun, Section 8.12.






Radial Functions for Hyperbolic Space ↑

The following spherical functions are specializations of Legendre functions which give the regular eigenfunctions of the Laplacian on a 3-dimensional hyperbolic space H3d. Of particular interest is the flat limit, lambda to infty, eta to 0, lambda eta fixed.





Logarithm and Related Functions ↑






Mathieu functions ↑

The methods described in this section compute the angular and radial Mathieu functions, and their characteristic values. Mathieu functions are the solutions of the following two differential equations: The angular Mathieu functions ce_r(x,q), se_r(x,q) are the even and odd periodic solutions of the first equation, which is known as Mathieu's equation. These exist only for the discrete sequence of characteristic values a=a_r(q) (even-periodic) and a=b_r(q) (odd-periodic).

The radial Mathieu functions Mc^{(j)}_{r}(z,q), Ms^{(j)}_{r}(z,q) are the solutions of the second equation, which is referred to as Mathieu's modified equation. The radial Mathieu functions of the first, second, third and fourth kind are denoted by the parameter j, which takes the value 1, 2, 3 or 4.

For more information on the Mathieu functions, see Abramowitz and Stegun, Chapter 20.

Mathieu Function Workspace ↑

The Mathieu functions can be computed for a single order or for multiple orders, using array-based routines.


Mathieu Function Characteristic Values ↑



Angular Mathieu Functions ↑



Radial Mathieu Functions ↑



Power Functions ↑


Psi (Digamma) Function ↑

The polygamma functions of order m defined by psi^{(m)}(x) = (d/dx)^m psi(x) = (d/dx)^{m+1} log(Gamma(x)), where psi(x) = Gamma'(x)/Gamma(x) is known as the digamma function.

Digamma Function ↑




Trigamma Function ↑



Polygamma Function ↑


Synchrotron Functions ↑



Transport Functions ↑

The transport functions J(n,x) are defined by the integral representations J(n,x) := int_0^x dt t^n e^t /(e^t - 1)^2.


Trigonometric Functions ↑

Circular Trigonometric Functions ↑



Trigonometric Functions for Complex Arguments ↑


Hyperbolic Trigonometric Functions ↑


Conversion Functions ↑


Restriction Functions ↑



Trigonometric Functions With Error Estimates ↑



Zeta Functions ↑

Riemann Zeta Function ↑

The Riemann zeta function is defined by the infinite sum zeta(s) = sum_{k=1}^infty k^{-s}.



Riemann Zeta Function Minus One ↑



Hurwitz Zeta Function ↑

The Hurwitz zeta function is defined by zeta(s,q) = sum_0^infty (k+q)^{-s}.


Eta Function ↑

The eta function is defined by eta(s) = (1-2^{1-s}) zeta(s).



prev next

Reference index top