Class Bessel
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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.
-
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- adoublerepresenting the argument for which the sequence of Bessel functions is to be evaluatedn- anintwhich specifies the order of the last element in the sequence- Returns:
- a
doublearray 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- adoublerepresenting the fractional order of the function.xnumust be less than one in absolute value.x- adoublerepresenting the argument for which the sequence of Bessel functions is to be evaluated.n- anintrepresenting the order of the last element in the sequence. If order is the highest order desired, setnto int(order).- Returns:
- a
doublearray 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 atxfor I=0 ton.
-
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- adoublerepresenting the fractional order of the function.vmust be less than one in absolute value.x- adoublerepresenting the argument for which the sequence of Bessel functions is to be evaluated.n- anintrepresenting the order of the last element in the sequence. If order is the highest order desired, setnto int(order).- Returns:
- a
doublearray of lengthn+1containing the values of the function through the series. Ifnis positive,Bessel.K[I]contains \(e^x\) times the value of the Bessel function of orderI+vatxfor I=0 ton. Ifnis negative,Bessel.K[I]contains \(e^x\) times the value of the Bessel function of orderv-Iatxfor I=0 ton.
-
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- adoublerepresenting the argument for which the sequence of Bessel functions is to be evaluatedn- anintwhich specifies the order of the last element in the sequence- Returns:
- a
doublearray of lengthn+1containing the values of the function through the series.Bessel.J[i]contains the value of the Bessel function of order i atxfor i=0 ton.
-
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- adoublerepresenting the lowest order desired.xnumust be at least zero and less than 1.x- adoublerepresenting the argument for which the sequence of Bessel functions is to be evaluatedn- anintrepresenting the order of the last element in the sequence. If order is the highest order desired, setntoint(order).- Returns:
- a
doublearray of lengthn+1containing the values of the function through the series.Bessel.J[I]contains the value of the Bessel function of order I+v atxfor I=0 ton.
-
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
xmust 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- adoublerepresenting the argument of the Bessel functions to be evaluatedn- is theintorder of the last element in the sequence- Returns:
- a
doublearray of lengthn+1containing 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
xnuis 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 \) =
xnumust 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- adoublerepresenting the lowest order desired.xnumust be at least zero and less than 1x- adoublerepresenting the argument of the Bessel functions to be evaluatedn- is theintorder of the last element in the sequence- Returns:
- a
doublearray of lengthn+1containing the values of the function through the series.Bessel.I[i]contains the value of the Bessel function of orderi+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, thenYis set toNaN. In addition,xmust 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- adoublerepresenting the lowest order desired.xnumust be at least zero and less than 1x- adoublerepresenting the argument for which the sequence of Bessel functions is to be evaluatedn- anintsuch thatn+1elements will be evaluated in the sequence- Returns:
- a
doublearray of lengthn+1containing the values of the function through the series.Bessel.K[I]contains the value of the Bessel function of order I+v atxfor I=0 ton.
-