IMLCV.tools.bessel_jn
=====================

.. py:module:: IMLCV.tools.bessel_jn


Attributes
----------

.. autoapisummary::

   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
   IMLCV.tools.bessel_jn.DR20
   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
   IMLCV.tools.bessel_jn.Z2
   IMLCV.tools.bessel_jn.PIO4
   IMLCV.tools.bessel_jn.THPIO4
   IMLCV.tools.bessel_jn.SQ2OPI


Functions
---------

.. autoapisummary::

   IMLCV.tools.bessel_jn.j1_small
   IMLCV.tools.bessel_jn.j1_large
   IMLCV.tools.bessel_jn.j1
   IMLCV.tools.bessel_jn.j0_small
   IMLCV.tools.bessel_jn.j0_large
   IMLCV.tools.bessel_jn.j0
   IMLCV.tools.bessel_jn._besseljn_power_series
   IMLCV.tools.bessel_jn._besseljn_backward_recurrence
   IMLCV.tools.bessel_jn.besseljn_backward_recurrence_cutoff
   IMLCV.tools.bessel_jn._besseljn_forward_recurrence
   IMLCV.tools.bessel_jn.bessel_jn
   IMLCV.tools.bessel_jn.besseljn_jvp


Module Contents
---------------

.. py:data:: PP0

.. py:data:: PQ0

.. py:data:: QP0

.. py:data:: QQ0

.. py:data:: YP0

.. py:data:: YQ0

.. py:data:: DR10
   :value: 5.783185962946784


.. py:data:: DR20
   :value: 30.471262343662087


.. py:data:: RP0

.. py:data:: RQ0

.. py:data:: RP1

.. py:data:: RQ1

.. py:data:: PP1

.. py:data:: PQ1

.. py:data:: QP1

.. py:data:: QQ1

.. py:data:: YP1

.. py:data:: YQ1

.. py:data:: Z1
   :value: 14.681970642123893


.. py:data:: Z2
   :value: 49.2184563216946


.. py:data:: PIO4
   :value: 0.7853981633974483


.. py:data:: THPIO4
   :value: 2.356194490192345


.. py:data:: SQ2OPI
   :value: 0.7978845608028654


.. py:function:: j1_small(x)

   Implementation of J1 for x < 5


.. py:function:: j1_large(x)

   Implementation of J1 for x > 5


.. py:function:: 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.

   :param x: The sampling point(s) at which the Bessel function of the first kind are
   :param computed.:

   :returns: An array of shape `x.shape` containing the values of the Bessel function


.. py:function:: j0_small(x)

   Implementation of J0 for x < 5


.. py:function:: j0_large(x)

   Implementation of J0 for x >= 5


.. py:function:: 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.

   :param z: The sampling point(s) at which the Bessel function of the first kind are
   :param computed.:

   :returns: An array of shape `x.shape` containing the values of the Bessel function


.. py:function:: _besseljn_power_series(z, v: int, maxiter: int = 100)

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


.. py:function:: _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


.. py:function:: besseljn_backward_recurrence_cutoff(v, z)

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


.. py:function:: _besseljn_forward_recurrence(z, v: int)

   This is a stripped down version of the proposed Bessel function


.. py:function:: 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.
             F. W. J. 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.




.. py:function:: besseljn_jvp(v, primals, tangents)

