Package com.imsl.math

Class Bessel

java.lang.Object
com.imsl.math.Bessel

public class Bessel extends Object
Collection of Bessel functions.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    static double[]
    I(double xnu, double x, int n)
    Evaluates a sequence of modified Bessel functions of the first kind with real order and real argument.
    static double[]
    I(double x, int n)
    Evaluates a sequence of modified Bessel functions of the first kind with integer order and real argument.
    static double[]
    J(double xnu, double x, int n)
    Evaluate a sequence of Bessel functions of the first kind with real order and real positive argument.
    static double[]
    J(double x, int n)
    Evaluates a sequence of Bessel functions of the first kind with integer order and real argument.
    static double[]
    K(double xnu, double x, int n)
    Evaluates a sequence of modified Bessel functions of the third kind with fractional order and real argument.
    static double[]
    K(double x, int n)
    Evaluates a sequence of modified Bessel functions of the third kind with integer order and real argument.
    static double[]
    scaledK(double v, double x, int n)
    Evaluate a sequence of exponentially scaled modified Bessel functions of the third kind with fractional order and real argument.
    static double[]
    Y(double xnu, double x, int n)
    Evaluate a sequence of Bessel functions of the second kind with real nonnegative order and real positive argument.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • K

      public static double[] K(double x, int n)
      Evaluates a sequence of modified Bessel functions of the third kind with integer order and real argument. This function uses \(e^x K_{\nu+k-1}\) for \(k = 1, \ldots, n\) and \(\nu = 0\). For the definition of \(K_v (x)\), see above.
      Parameters:
      x - a double representing the argument for which the sequence of Bessel functions is to be evaluated
      n - an int which specifies the order of the last element in the sequence
      Returns:
      a double array of length n+1 containing the values of the function through the series
    • K

      public static double[] K(double xnu, double x, int n)
      Evaluates a sequence of modified Bessel functions of the third kind with fractional order and real argument. The Bessel function \(K_v (x)\) is defined to be

      $$K_\nu (x) = \frac{\pi}{2}e^{\nu \pi i/2} \left[ {i\,J_\nu (ix) - Y_\nu (ix)} \right] \,\,\,\, \rm{for} - \pi \lt \arg \,x \le \frac{\pi}{2}$$

      Currently, xnu (represented by \(\nu\) in the above equation) is restricted to be less than one in absolute value. A total of n values is stored in the result, K.

      K\(\left[ {\rm{0}} \right] = K_v (x)\), K\(\left[ {\rm{1}} \right] = K_{v + 1} (x) \), \(\ldots\), K\( \left[ {n - 1} \right] = K_{v + n - 1} (x)\).

      This method is based on the work of Cody (1983).

      Parameters:
      xnu - a double representing the fractional order of the function. xnu must be less than one in absolute value.
      x - a double representing the argument for which the sequence of Bessel functions is to be evaluated.
      n - an int representing the order of the last element in the sequence. If order is the highest order desired, set n to int(order).
      Returns:
      a double array of length n+1 containing the values of the function through the series. Bessel.K[I] contains the value of the Bessel function of order I+v at x for I=0 to n.
    • scaledK

      public static double[] scaledK(double v, double x, int n)
      Evaluate a sequence of exponentially scaled modified Bessel functions of the third kind with fractional order and real argument. This function evaluates \(e^xK_{v + i -1} (x)\), for i=1,...,n where K is the modified Bessel function of the third kind. Currently, v is restricted to be less than 1 in absolute value. A total of \(|n|+1\) elements are returned in the array. This code is particularly useful for calculating sequences for large x provided n = x. (Overflow becomes a problem if \(n \lt \lt x\).) n must not be zero, and x must be greater than zero. \(|v| \) must be less than 1. Also, when \(|n|\) is large compared with x, \(|v+n|\) must not be so large that $$ e^x K_{\nu+n}(x) \approx e^x \frac{\Gamma(|\nu+n|}{2(x/2)^{|\nu+n|}} $$ overflows. The code is based on work of Cody (1983).
      Parameters:
      v - a double representing the fractional order of the function. v must be less than one in absolute value.
      x - a double representing the argument for which the sequence of Bessel functions is to be evaluated.
      n - an int representing the order of the last element in the sequence. If order is the highest order desired, set n to int(order).
      Returns:
      a double array of length n+1 containing the values of the function through the series. If n is positive, Bessel.K[I] contains \(e^x\) times the value of the Bessel function of order I+v at x for I=0 to n. If n is negative, Bessel.K[I] contains \(e^x\) times the value of the Bessel function of order v-I at x for I=0 to n.
    • J

      public static double[] J(double x, int n)
      Evaluates a sequence of Bessel functions of the first kind with integer order and real argument. The Bessel function \(J_n (x) \), is defined to be

      $$J_n \left( x \right) = {1 \over \pi }\int_0^\pi {\,\cos \left( {x\,\sin \,\theta - n\,\theta } \right)\,} d\,\theta$$

      The algorithm is based on a code due to Sookne (1973b) that uses backward recursion with strict error control.
      Parameters:
      x - a double representing the argument for which the sequence of Bessel functions is to be evaluated
      n - an int which specifies the order of the last element in the sequence
      Returns:
      a double array of length n+1 containing the values of the function through the series. Bessel.J[i] contains the value of the Bessel function of order i at x for i=0 to n.
    • J

      public static double[] J(double xnu, double x, int n)
      Evaluate a sequence of Bessel functions of the first kind with real order and real positive argument. The Bessel function \(J_v (x) \), is defined to be

      $$J_\nu (x) = {{(x/2)^\nu } \over {\sqrt \pi \Gamma (\nu + 1/2)}}\int_0^\pi {\,\,\cos \left( {x\,\cos \,\theta } \right)\sin ^{2\nu } \theta \,\,d\,\theta }$$

      This code is based on the work of Gautschi (1964) and Skovgaard (1975). It uses backward recursion.
      Parameters:
      xnu - a double representing the lowest order desired. xnu must be at least zero and less than 1.
      x - a double representing the argument for which the sequence of Bessel functions is to be evaluated
      n - an int representing the order of the last element in the sequence. If order is the highest order desired, set n to int(order).
      Returns:
      a double array of length n+1 containing the values of the function through the series. Bessel.J[I] contains the value of the Bessel function of order I+v at x for I=0 to n.
    • I

      public static double[] I(double x, int n)
      Evaluates a sequence of modified Bessel functions of the first kind with integer order and real argument. The Bessel function \(I_n (x)\) is defined to be

      $$I_n \left( x \right) = {1 \over \pi }\int_0^\pi {\,e^{x\,\cos \,\theta}} \,\cos \left( {n\,\theta } \right)\,d\,\theta$$

      The input x must satisfy \({\rm{|x| }} \le {\rm{ log(b) }}\) where b is the largest representable floating-point number. The algorithm is based on a code due to Sookne (1973b), which uses backward recursion.

      Parameters:
      x - a double representing the argument of the Bessel functions to be evaluated
      n - is the int order of the last element in the sequence
      Returns:
      a double array of length n+1 containing the values of the function through the series. Bessel.I[i] contains the value of the Bessel function of order i.
    • I

      public static double[] I(double xnu, double x, int n)
      Evaluates a sequence of modified Bessel functions of the first kind with real order and real argument. The Bessel function \(I_v (x) \), is defined to be

      $$I_\nu (x) = {1 \over \pi }\int_0^\pi {e^{x\cos \theta } } \cos (\nu \theta )d\,\theta - {{\sin (\nu \pi )} \over \pi }\int_0^\infty {e^{ - x\cosh t - vt} } dt$$

      Here, argument xnu is represented by \(\nu\) in the above equation.

      The input x must be nonnegative and less than or equal to log(b) (b is the largest representable number). The argument \(\nu \) = xnu must satisfy \({\rm{0 }} \le {\rm{ }}\nu {\rm{ }} \le {\rm{ 1}}\).

      This function is based on a code due to Cody (1983), which uses backward recursion.

      Parameters:
      xnu - a double representing the lowest order desired. xnu must be at least zero and less than 1
      x - a double representing the argument of the Bessel functions to be evaluated
      n - is the int order of the last element in the sequence
      Returns:
      a double array of length n+1 containing the values of the function through the series. Bessel.I[i] contains the value of the Bessel function of order i+xnu.
    • Y

      public static double[] Y(double xnu, double x, int n)
      Evaluate a sequence of Bessel functions of the second kind with real nonnegative order and real positive argument. The Bessel function \(Y_v (x)\) is defined to be

      $$Y_\nu (x) = {1 \over \pi }\int_0^\pi {\cos (x\sin \theta - \nu \theta )d\,\theta }$$

      $$\, - \frac{1}{\pi }\int_0^\infty {\,\left[ {e^{\nu t} + e^{ - \nu t} \,\cos \left( {\nu \pi } \right)} \right]} \,e^{ - x\,\sinh \,t} \,dt$$

      The variable xnu (represented by \(\nu \) in the above equation) must satisfy \(0 \le \nu \lt 1\). If this condition is not met, then Y is set to NaN. In addition, x must be in \( \left[ {x_m ,x_M } \right]\) where \(x_m = 6(16^{ - 32} )\) and \(x_m = 16^9\). If \(x \lt x_m\), then the largest representable number is returned; and if \(x \lt x_M\), then zero is returned.

      The algorithm is based on work of Cody and others, (see Cody et al. 1976; Cody 1969; NATS FUNPACK 1976). It uses a special series expansion for small arguments. For moderate arguments, an analytic continuation in the argument based on Taylor series with special rational minimax approximations providing starting values is employed. An asymptotic expansion is used for large arguments.

      Parameters:
      xnu - a double representing the lowest order desired. xnu must be at least zero and less than 1
      x - a double representing the argument for which the sequence of Bessel functions is to be evaluated
      n - an int such that n+1 elements will be evaluated in the sequence
      Returns:
      a double array of length n+1 containing the values of the function through the series. Bessel.K[I] contains the value of the Bessel function of order I+v at x for I=0 to n.