IMLCV.tools.bessel_jn#

Attributes#

Functions#

j1_small(x)

Implementation of J1 for x < 5

j1_large(x)

Implementation of J1 for x > 5

j1(z)

Bessel function of the first kind of order one and a real argument

j0_small(x)

Implementation of J0 for x < 5

j0_large(x)

Implementation of J0 for x >= 5

j0(z)

Bessel function of the first kind of order zero and a real argument

_besseljn_power_series(z, v[, maxiter])

Power series expansion of the Bessel function of the first kind at z << v

_besseljn_backward_recurrence(z, v, n_iter)

Implementation of Miller's backward recurrence algorithm for computing Bessel function of the first kind at x < v

besseljn_backward_recurrence_cutoff(v, z)

Helper function to determine when backward recurrence reaches overflow based on the dtype of the input

_besseljn_forward_recurrence(z, v)

This is a stripped down version of the proposed Bessel function

bessel_jn(v, z)

Bessel function uses a range of computational techniques to achieve accuracy in three

besseljn_jvp(v, primals, tangents)

Module Contents#

IMLCV.tools.bessel_jn.PP0#
IMLCV.tools.bessel_jn.PQ0#
IMLCV.tools.bessel_jn.QP0#
IMLCV.tools.bessel_jn.QQ0#
IMLCV.tools.bessel_jn.YP0#
IMLCV.tools.bessel_jn.YQ0#
IMLCV.tools.bessel_jn.DR10 = 5.783185962946784#
IMLCV.tools.bessel_jn.DR20 = 30.471262343662087#
IMLCV.tools.bessel_jn.RP0#
IMLCV.tools.bessel_jn.RQ0#
IMLCV.tools.bessel_jn.RP1#
IMLCV.tools.bessel_jn.RQ1#
IMLCV.tools.bessel_jn.PP1#
IMLCV.tools.bessel_jn.PQ1#
IMLCV.tools.bessel_jn.QP1#
IMLCV.tools.bessel_jn.QQ1#
IMLCV.tools.bessel_jn.YP1#
IMLCV.tools.bessel_jn.YQ1#
IMLCV.tools.bessel_jn.Z1 = 14.681970642123893#
IMLCV.tools.bessel_jn.Z2 = 49.2184563216946#
IMLCV.tools.bessel_jn.PIO4 = 0.7853981633974483#
IMLCV.tools.bessel_jn.THPIO4 = 2.356194490192345#
IMLCV.tools.bessel_jn.SQ2OPI = 0.7978845608028654#
IMLCV.tools.bessel_jn.j1_small(x)#

Implementation of J1 for x < 5

IMLCV.tools.bessel_jn.j1_large(x)#

Implementation of J1 for x > 5

IMLCV.tools.bessel_jn.j1(z)#

Bessel function of the first kind of order one and a real argument - using the implementation from CEPHES, translated to Jax, to match scipy to machine precision.

Reference: Cephes mathematical library.

Parameters:
  • x – The sampling point(s) at which the Bessel function of the first kind are

  • computed.

Returns:

An array of shape x.shape containing the values of the Bessel function

IMLCV.tools.bessel_jn.j0_small(x)#

Implementation of J0 for x < 5

IMLCV.tools.bessel_jn.j0_large(x)#

Implementation of J0 for x >= 5

IMLCV.tools.bessel_jn.j0(z)#

Bessel function of the first kind of order zero and a real argument - using the implementation from CEPHES, translated to Jax, to match scipy to machine precision.

Reference: Cephes Mathematical Library.

Parameters:
  • z – The sampling point(s) at which the Bessel function of the first kind are

  • computed.

Returns:

An array of shape x.shape containing the values of the Bessel function

IMLCV.tools.bessel_jn._besseljn_power_series(z, v: int, maxiter: int = 100)#

Power series expansion of the Bessel function of the first kind at z << v

IMLCV.tools.bessel_jn._besseljn_backward_recurrence(z, v: int, n_iter: int)#

Implementation of Miller’s backward recurrence algorithm for computing Bessel function of the first kind at x < v

IMLCV.tools.bessel_jn.besseljn_backward_recurrence_cutoff(v, z)#

Helper function to determine when backward recurrence reaches overflow based on the dtype of the input argument

IMLCV.tools.bessel_jn._besseljn_forward_recurrence(z, v: int)#

This is a stripped down version of the proposed Bessel function

IMLCV.tools.bessel_jn.bessel_jn(v, z)#

Bessel function uses a range of computational techniques to achieve accuracy in three regimes

  1. when x << nu:

    Power series expansion is used to compute small values of x.

    Reference:

    [Equation 6.5.1] https://iate.oac.uncor.edu/~mario/materia/nr/numrec/f6-5.pdf

  2. when x < nu

    Miller’s algorithm is used compute values of the Bessel function for the first order which is stable for x < nu.

    References:

    [Miller’s Algorithm; Equation 5.5.16] https://iate.oac.uncor.edu/~mario/materia/nr/numrec/f5-5.pdf W. Gautschi (1967) Computational aspects of three-term recurrence relations.

    SIAM Rev. 9 (1), pp. 24–82.

        1. Olver and D. J. Sookne (1972) Note on backward recurrence algorithms.

    Math. Comp. 26 (120), pp. 941–947.

  3. when x >= nu

    Forward recurrence relation is used to compute values of the Bessel function for the first order, which is stable so long as x > nu.

    Reference:

    Shanjie Zhang and Jian-Ming Jin. Computation of special functions. Wiley-Interscience, 1996.

IMLCV.tools.bessel_jn.besseljn_jvp(v, primals, tangents)#