Special Functions Next: Previous: Sums and Products Up: Arithmetic



Special Functions

[j ierr] = besselj (alpha, x, opt) Loadable Function
[y ierr] = bessely (alpha, x, opt) Loadable Function
[i ierr] = besseli (alpha, x, opt) Loadable Function
[k ierr] = besselk (alpha, x, opt) Loadable Function
[h ierr] = besselh (alpha, k, x, opt) Loadable Function
Compute Bessel or Hankel functions of various kinds:
besselj
Bessel functions of the first kind.
bessely
Bessel functions of the second kind.
besseli
Modified Bessel functions of the first kind.
besselk
Modified Bessel functions of the second kind.
besselh
Compute Hankel functions of the first (k = 1) or second (k = 2) kind.

If the argument opt is supplied the result is scaled by the exp (-I*x) for k = 1 or exp (I*x) for k = 2.

If alpha is a scalar the result is the same size as x. If x is a scalar the result is the same size as alpha. If alpha is a row vector and x is a column vector the result is a matrix with length (x) rows and length (alpha) columns. Otherwise alpha and x must conform and the result will be the same size.

The value of alpha must be real. The value of x may be complex.

If requested ierr contains the following status information and is the same size as the result.

  1. Normal return.
  2. Input error return NaN.
  3. Overflow return Inf.
  4. Loss of significance by argument reduction results in less than half of machine accuracy.
  5. Complete loss of significance by argument reduction return NaN.
  6. Error--no computation algorithm termination condition not met, return NaN.

[a ierr] = airy (k, z, opt) Loadable Function
Compute Airy functions of the first and second kind and their derivatives.
            K   Function   Scale factor (if a third argument is supplied)
           ---  --------   ----------------------------------------------
            0   Ai (Z)     exp ((2/3) * Z * sqrt (Z))
            1   dAi(Z)/dZ  exp ((2/3) * Z * sqrt (Z))
            2   Bi (Z)     exp (-abs (real ((2/3) * Z *sqrt (Z))))
            3   dBi(Z)/dZ  exp (-abs (real ((2/3) * Z *sqrt (Z))))
          

The function call airy (z) is equivalent to airy (0 z).

The result is the same size as z.

If requested ierr contains the following status information and is the same size as the result.

  1. Normal return.
  2. Input error return NaN.
  3. Overflow return Inf.
  4. Loss of significance by argument reduction results in less than half of machine accuracy.
  5. Complete loss of significance by argument reduction return NaN.
  6. Error--no computation algorithm termination condition not met, return NaN

beta (a b) Mapping Function
Return the Beta function
          beta (a b) = gamma (a) * gamma (b) / gamma (a + b).
          

betainc (x a, b) Mapping Function
Return the incomplete Beta function
                                                x
                                               /
          betainc (x a, b) = beta (a, b)^(-1) | t^(a-1) (1-t)^(b-1) dt.
                                               /
                                            t=0
          

If x has more than one component both a and b must be scalars. If x is a scalar a and b must be of compatible dimensions.

bincoeff (n k) Mapping Function
Return the binomial coefficient of n and k defined as
           /   \
           | n |    n (n-1) (n-2) ... (n-k+1)
           |   |  = -------------------------
           | k |               k!
           \   /
          

For example

          bincoeff (5 2)
          => 10
          

erf (z) Mapping Function
Computes the error function
                                   z
                                  /
          erf (z) = (2/sqrt (pi)) | e^(-t^2) dt
                                  /
                               t=0
          

erfc (z) Mapping Function
Computes the complementary error function 1 - erf (z).

erfinv (z) Mapping Function
Computes the inverse of the error function.

gamma (z) Mapping Function
Computes the Gamma function
                      infinity
                      /
          gamma (z) = | t^(z-1) exp (-t) dt.
                      /
                   t=0
          

gammainc (x a) Mapping Function
Computes the incomplete gamma function
                                          x
                                1        /
          gammainc (x a) = ---------    | exp (-t) t^(a-1) dt
                            gamma (a)    /
                                      t=0
          

If a is scalar then gammainc (x, a) is returned for each element of x and vice versa.

If neither x nor a is scalar the sizes of x and a must agree and gammainc is applied element-by-element.

lgamma (a x) Mapping Function
gammaln (a x) Mapping Function
Return the natural logarithm of the gamma function.

cross (x y, dim) Function File
Computes the vector cross product of the two 3-dimensional vectors x and y.
          cross ([11,0], [0,1,1])
          => [ 1; -1; 1 ]
          

If x and y are matrices the cross product is applied along the first dimension with 3 elements. The optional argument dim is used to force the cross product to be calculated along the dimension defiend by dim.

commutation_matrix (m n) Function File
Return the commutation matrix K(mn) which is the unique m*n by m*n matrix such that K(mn) * vec(A) = vec(A') for all m by n matrices A.

If only one argument m is given K(mm) is returned.

See Magnus and Neudecker (1988) Matrix differential calculus with applications in statistics and econometrics.

duplication_matrix (n) Function File
Return the duplication matrix Dn which is the unique n^2 by n*(n+1)/2 matrix such that Dn vech (A) = vec (A) for all symmetric n by n matrices A.

See Magnus and Neudecker (1988) Matrix differential calculus with applications in statistics and econometrics.