public class BesselJ extends java.lang.Object implements UnivariateFunction
This implementation is based on the rjbesl Fortran routine at Netlib.
From the Fortran code:
This program is based on a program written by David J. Sookne (2) that computes values of the Bessel functions J or I of real argument and integer order. Modifications include the restriction of the computation to the J Bessel function of non-negative real argument, the extension of the computation to arbitrary positive order, and the elimination of most underflow.
References:
Modifier and Type | Class and Description |
---|---|
static class |
BesselJ.BesselJResult
Encapsulates the results returned by
rjBesl(double, double, int) . |
Modifier and Type | Field and Description |
---|---|
private static double |
ENMTEN
Smallest ABS(X) such that X/4 does not underflow
|
private static double |
ENSIG
Decimal significance desired.
|
private static double |
ENTEN
10.0^K, where K is the largest integer such that ENTEN is
machine-representable in working precision
|
private static double[] |
FACT
First 25 factorials as doubles
|
private double |
order
Order of the function computed when
value(double) is used |
private static double |
PI2
-2 / pi
|
private static double |
RTNSIG
10.0 ** (-K) for the smallest integer K such that K >= NSIG/4
|
private static double |
TOWPI1
first few significant digits of 2pi
|
private static double |
TWOPI
TOWPI1 + TWOPI2
|
private static double |
TWOPI2
2pi - TWOPI1 to working precision
|
private static double |
X_MAX
Upper limit on the magnitude of x.
|
private static double |
X_MIN
Minimum acceptable value for x
|
Constructor and Description |
---|
BesselJ(double order)
Create a new BesselJ with the given order.
|
Modifier and Type | Method and Description |
---|---|
static BesselJ.BesselJResult |
rjBesl(double x,
double alpha,
int nb)
Calculates Bessel functions \(J_{n+alpha}(x)\) for
non-negative argument x, and non-negative order n + alpha.
|
double |
value(double x)
Returns the value of the constructed Bessel function of the first kind,
for the passed argument.
|
static double |
value(double order,
double x)
Returns the first Bessel function, \(J_{order}(x)\).
|
private static final double PI2
private static final double TOWPI1
private static final double TWOPI2
private static final double TWOPI
private static final double ENTEN
private static final double ENSIG
private static final double RTNSIG
private static final double ENMTEN
private static final double X_MIN
private static final double X_MAX
private static final double[] FACT
private final double order
value(double)
is usedpublic BesselJ(double order)
order
- order of the function computed when using value(double)
.public double value(double x) throws MathIllegalArgumentException, ConvergenceException
value
in interface UnivariateFunction
x
- ArgumentMathIllegalArgumentException
- if x
is too large relative to order
ConvergenceException
- if the algorithm fails to convergepublic static double value(double order, double x) throws MathIllegalArgumentException, ConvergenceException
order
- Order of the Bessel functionx
- ArgumentMathIllegalArgumentException
- if x
is too large relative to order
ConvergenceException
- if the algorithm fails to convergepublic static BesselJ.BesselJResult rjBesl(double x, double alpha, int nb)
Before using the output vector, the user should check that nVals = nb, i.e., all orders have been calculated to the desired accuracy. See BesselResult class javadoc for details on return values.
x
- non-negative real argument for which J's are to be calculatedalpha
- fractional part of order for which J's or exponentially
scaled J's (\(J\cdot e^{x}\)) are to be calculated. 0 <= alpha < 1.0.nb
- integer number of functions to be calculated, nb > 0. The first
function calculated is of order alpha, and the last is of order
nb - 1 + alpha.