§
    fŠtj©0  ã                   ó  — d dl mZ d dlmc mZ d dlZddlm	Z	m
Z
mZmZmZmZmZmZ dd„Z ed¦  «        dd„¦   «         Z ed¦  «        dd	„¦   «         Z ed¦  «        dd
„¦   «         Zdd„Z ee¬¦  «        dd„¦   «         ZdS )é    ©ÚwrapsNé   )Ú_spherical_jnÚ_spherical_ynÚ_spherical_inÚ_spherical_knÚ_spherical_jn_dÚ_spherical_yn_dÚ_spherical_in_dÚ_spherical_kn_dc                 ó   ‡ ‡— ˆˆ fd„}|S )Nc                 óR   •‡ ‡— ˆ ˆfd„Št          ‰ ¦  «        dˆ ˆˆfd„	¦   «         }|S )Nc                 óp   •— t          j        | dz  dk    ‰‰ ¦  «        }|r| n|} ‰| | |¦  «        |z  S )Né   r   )ÚnpÚwhere)ÚnÚzÚ
derivativeÚsignÚfunÚsign_n_evens       €€ú]/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/scipy/special/_spherical_bessel.pyÚstandard_reflectionz>use_reflection.<locals>.decorator.<locals>.standard_reflection   sK   ø€ å”8˜A ™E QšJ¨°k°\ÑBÔBˆDà&Ð0�D�5�5¨DˆDà�3�q˜1˜"˜jÑ)Ô)¨DÑ0Ð0ó    Fc                 óþ   •‡‡— t          j        |¦  «        }t          j        |j        t           j        ¦  «        r ‰| |‰¦  «        S ‰€‰n‰Št          j        |j        dk    | |fˆˆfd„ˆˆfd„¦  «        d         S )Nr   c                 ó   •—  ‰| |‰¦  «        S ©N© )r   r   r   r   s     €€r   ú<lambda>zDuse_reflection.<locals>.decorator.<locals>.wrapper.<locals>.<lambda>    s   ø€ °°°A°q¸*Ñ0EÔ0E€ r   c                 ó   •—  ‰| |‰¦  «        S r   r    )r   r   r   Úf2s     €€r   r!   zDuse_reflection.<locals>.decorator.<locals>.wrapper.<locals>.<lambda>!   s   ø€ °°°1°a¸Ñ0DÔ0D€ r   r    )r   ÚasarrayÚ
issubdtypeÚdtypeÚcomplexfloatingÚxpxÚapply_whereÚreal)r   r   r   r#   r   Úreflection_funr   s     `@€€€r   Úwrapperz2use_reflection.<locals>.decorator.<locals>.wrapper   s›   øøø€ å”
˜1‘”ˆAåŒ}˜QœW¥bÔ&8Ñ9Ô9ð -Ø�s˜1˜a Ñ,Ô,Ð,à(6Ð(>Ð$Ð$ÀNˆBÝ”? 1¤6¨Q¢;°°A°Ø#EÐ#EÐ#EÐ#EÐ#EØ#DÐ#DÐ#DÐ#DÐ#DñFô FàFHôJð Jr   ©Fr   )r   r,   r   r+   r   s   ` @€€r   Ú	decoratorz!use_reflection.<locals>.decorator   sl   øøø€ ð	1ð 	1ð 	1ð 	1ð 	1ð 	1õ 
ˆs‰Œð		Jð 		Jð 		Jð 		Jð 		Jð 		Jð 		Jñ 
Œð		Jð ˆr   r    )r   r+   r.   s   `` r   Úuse_reflectionr/   	   s*   øø€ ð
ð ð ð ð ð ð* Ðr   Fc                 ó–   — t          j        | t          j        d¦  «        ¬¦  «        } |rt          | |¦  «        S t	          | |¦  «        S )a{	  Spherical Bessel function of the first kind or its derivative.

    Defined as [1]_,

    .. math:: j_n(z) = \sqrt{\frac{\pi}{2z}} J_{n + 1/2}(z),

    where :math:`J_n` is the Bessel function of the first kind.

    Parameters
    ----------
    n : int, array_like
        Order of the Bessel function (n >= 0).
    z : complex or float, array_like
        Argument of the Bessel function.
    derivative : bool, optional
        If True, the value of the derivative (rather than the function
        itself) is returned.

    Returns
    -------
    jn : ndarray

    Notes
    -----
    For real arguments greater than the order, the function is computed
    using the ascending recurrence [2]_. For small real or complex
    arguments, the definitional relation to the cylindrical Bessel function
    of the first kind is used.

    The derivative is computed using the relations [3]_,

    .. math::
        j_n'(z) = j_{n-1}(z) - \frac{n + 1}{z} j_n(z).

        j_0'(z) = -j_1(z)


    .. versionadded:: 0.18.0

    References
    ----------
    .. [1] https://dlmf.nist.gov/10.47.E3
    .. [2] https://dlmf.nist.gov/10.51.E1
    .. [3] https://dlmf.nist.gov/10.51.E2
    .. [AS] Milton Abramowitz and Irene A. Stegun, eds.
        Handbook of Mathematical Functions with Formulas,
        Graphs, and Mathematical Tables. New York: Dover, 1972.

    Examples
    --------
    The spherical Bessel functions of the first kind :math:`j_n` accept
    both real and complex second argument. They can return a complex type:

    >>> from scipy.special import spherical_jn
    >>> spherical_jn(0, 3+5j)
    (-9.878987731663194-8.021894345786002j)
    >>> type(spherical_jn(0, 3+5j))
    <class 'numpy.complex128'>

    We can verify the relation for the derivative from the Notes
    for :math:`n=3` in the interval :math:`[1, 2]`:

    >>> import numpy as np
    >>> x = np.arange(1.0, 2.0, 0.01)
    >>> np.allclose(spherical_jn(3, x, True),
    ...             spherical_jn(2, x) - 4/x * spherical_jn(3, x))
    True

    The first few :math:`j_n` with real argument:

    >>> import matplotlib.pyplot as plt
    >>> x = np.arange(0.0, 10.0, 0.01)
    >>> fig, ax = plt.subplots()
    >>> ax.set_ylim(-0.5, 1.5)
    >>> ax.set_title(r'Spherical Bessel functions $j_n$')
    >>> for n in np.arange(0, 4):
    ...     ax.plot(x, spherical_jn(n, x), label=rf'$j_{n}$')
    >>> plt.legend(loc='best')
    >>> plt.show()

    Úlong©r&   )r   r$   r&   r
   r   ©r   r   r   s      r   Úspherical_jnr4   &   sK   € õf 	Œ
�1�BœH VÑ,Ô,Ð-Ñ-Ô-€AØð #Ý˜q !Ñ$Ô$Ð$å˜Q Ñ"Ô"Ð"r   éÿÿÿÿc                 ó–   — t          j        | t          j        d¦  «        ¬¦  «        } |rt          | |¦  «        S t	          | |¦  «        S )aG	  Spherical Bessel function of the second kind or its derivative.

    Defined as [1]_,

    .. math:: y_n(z) = \sqrt{\frac{\pi}{2z}} Y_{n + 1/2}(z),

    where :math:`Y_n` is the Bessel function of the second kind.

    Parameters
    ----------
    n : int, array_like
        Order of the Bessel function (n >= 0).
    z : complex or float, array_like
        Argument of the Bessel function.
    derivative : bool, optional
        If True, the value of the derivative (rather than the function
        itself) is returned.

    Returns
    -------
    yn : ndarray

    Notes
    -----
    For real arguments, the function is computed using the ascending
    recurrence [2]_.  For complex arguments, the definitional relation to
    the cylindrical Bessel function of the second kind is used.

    The derivative is computed using the relations [3]_,

    .. math::
        y_n' = y_{n-1} - \frac{n + 1}{z} y_n.

        y_0' = -y_1


    .. versionadded:: 0.18.0

    References
    ----------
    .. [1] https://dlmf.nist.gov/10.47.E4
    .. [2] https://dlmf.nist.gov/10.51.E1
    .. [3] https://dlmf.nist.gov/10.51.E2
    .. [AS] Milton Abramowitz and Irene A. Stegun, eds.
        Handbook of Mathematical Functions with Formulas,
        Graphs, and Mathematical Tables. New York: Dover, 1972.

    Examples
    --------
    The spherical Bessel functions of the second kind :math:`y_n` accept
    both real and complex second argument. They can return a complex type:

    >>> from scipy.special import spherical_yn
    >>> spherical_yn(0, 3+5j)
    (8.022343088587197-9.880052589376795j)
    >>> type(spherical_yn(0, 3+5j))
    <class 'numpy.complex128'>

    We can verify the relation for the derivative from the Notes
    for :math:`n=3` in the interval :math:`[1, 2]`:

    >>> import numpy as np
    >>> x = np.arange(1.0, 2.0, 0.01)
    >>> np.allclose(spherical_yn(3, x, True),
    ...             spherical_yn(2, x) - 4/x * spherical_yn(3, x))
    True

    The first few :math:`y_n` with real argument:

    >>> import matplotlib.pyplot as plt
    >>> x = np.arange(0.0, 10.0, 0.01)
    >>> fig, ax = plt.subplots()
    >>> ax.set_ylim(-2.0, 1.0)
    >>> ax.set_title(r'Spherical Bessel functions $y_n$')
    >>> for n in np.arange(0, 4):
    ...     ax.plot(x, spherical_yn(n, x), label=rf'$y_{n}$')
    >>> plt.legend(loc='best')
    >>> plt.show()

    r1   r2   )r   r$   r&   r   r   r3   s      r   Úspherical_ynr7   €   sK   € õd 	Œ
�1�BœH VÑ,Ô,Ð-Ñ-Ô-€AØð #Ý˜q !Ñ$Ô$Ð$å˜Q Ñ"Ô"Ð"r   c                 ó–   — t          j        | t          j        d¦  «        ¬¦  «        } |rt          | |¦  «        S t	          | |¦  «        S )aô  Modified spherical Bessel function of the first kind or its derivative.

    Defined as [1]_,

    .. math:: i_n(z) = \sqrt{\frac{\pi}{2z}} I_{n + 1/2}(z),

    where :math:`I_n` is the modified Bessel function of the first kind.

    Parameters
    ----------
    n : int, array_like
        Order of the Bessel function (n >= 0).
    z : complex or float, array_like
        Argument of the Bessel function.
    derivative : bool, optional
        If True, the value of the derivative (rather than the function
        itself) is returned.

    Returns
    -------
    in : ndarray

    Notes
    -----
    The function is computed using its definitional relation to the
    modified cylindrical Bessel function of the first kind.

    The derivative is computed using the relations [2]_,

    .. math::
        i_n' = i_{n-1} - \frac{n + 1}{z} i_n.

        i_1' = i_0


    .. versionadded:: 0.18.0

    References
    ----------
    .. [1] https://dlmf.nist.gov/10.47.E7
    .. [2] https://dlmf.nist.gov/10.51.E5
    .. [AS] Milton Abramowitz and Irene A. Stegun, eds.
        Handbook of Mathematical Functions with Formulas,
        Graphs, and Mathematical Tables. New York: Dover, 1972.

    Examples
    --------
    The modified spherical Bessel functions of the first kind :math:`i_n`
    accept both real and complex second argument.
    They can return a complex type:

    >>> from scipy.special import spherical_in
    >>> spherical_in(0, 3+5j)
    (-1.1689867793369182-1.2697305267234222j)
    >>> type(spherical_in(0, 3+5j))
    <class 'numpy.complex128'>

    We can verify the relation for the derivative from the Notes
    for :math:`n=3` in the interval :math:`[1, 2]`:

    >>> import numpy as np
    >>> x = np.arange(1.0, 2.0, 0.01)
    >>> np.allclose(spherical_in(3, x, True),
    ...             spherical_in(2, x) - 4/x * spherical_in(3, x))
    True

    The first few :math:`i_n` with real argument:

    >>> import matplotlib.pyplot as plt
    >>> x = np.arange(0.0, 6.0, 0.01)
    >>> fig, ax = plt.subplots()
    >>> ax.set_ylim(-0.5, 5.0)
    >>> ax.set_title(r'Modified spherical Bessel functions $i_n$')
    >>> for n in np.arange(0, 4):
    ...     ax.plot(x, spherical_in(n, x), label=rf'$i_{n}$')
    >>> plt.legend(loc='best')
    >>> plt.show()

    r1   r2   )r   r$   r&   r   r   r3   s      r   Úspherical_inr9   Ù   óK   € õb 	Œ
�1�BœH VÑ,Ô,Ð-Ñ-Ô-€AØð #Ý˜q !Ñ$Ô$Ð$å˜Q Ñ"Ô"Ð"r   c                 ó6   — t          | |dz   |¬¦  «        j        S )Ny                )r   )Úspherical_knr*   r3   s      r   Úspherical_kn_reflectionr=   1  s    € õ ˜˜1˜r™6¨jÐ9Ñ9Ô9Ô>Ð>r   )r+   c                 ó–   — t          j        | t          j        d¦  «        ¬¦  «        } |rt          | |¦  «        S t	          | |¦  «        S )aþ  Modified spherical Bessel function of the second kind or its derivative.

    Defined as [1]_,

    .. math:: k_n(z) = \sqrt{\frac{\pi}{2z}} K_{n + 1/2}(z),

    where :math:`K_n` is the modified Bessel function of the second kind.

    Parameters
    ----------
    n : int, array_like
        Order of the Bessel function (n >= 0).
    z : complex or float, array_like
        Argument of the Bessel function.
    derivative : bool, optional
        If True, the value of the derivative (rather than the function
        itself) is returned.

    Returns
    -------
    kn : ndarray

    Notes
    -----
    The function is computed using its definitional relation to the
    modified cylindrical Bessel function of the second kind.

    The derivative is computed using the relations [2]_,

    .. math::
        k_n' = -k_{n-1} - \frac{n + 1}{z} k_n.

        k_0' = -k_1


    .. versionadded:: 0.18.0

    References
    ----------
    .. [1] https://dlmf.nist.gov/10.47.E9
    .. [2] https://dlmf.nist.gov/10.51.E5
    .. [AS] Milton Abramowitz and Irene A. Stegun, eds.
        Handbook of Mathematical Functions with Formulas,
        Graphs, and Mathematical Tables. New York: Dover, 1972.

    Examples
    --------
    The modified spherical Bessel functions of the second kind :math:`k_n`
    accept both real and complex second argument.
    They can return a complex type:

    >>> from scipy.special import spherical_kn
    >>> spherical_kn(0, 3+5j)
    (0.012985785614001561+0.003354691603137546j)
    >>> type(spherical_kn(0, 3+5j))
    <class 'numpy.complex128'>

    We can verify the relation for the derivative from the Notes
    for :math:`n=3` in the interval :math:`[1, 2]`:

    >>> import numpy as np
    >>> x = np.arange(1.0, 2.0, 0.01)
    >>> np.allclose(spherical_kn(3, x, True),
    ...             - 4/x * spherical_kn(3, x) - spherical_kn(2, x))
    True

    The first few :math:`k_n` with real argument:

    >>> import matplotlib.pyplot as plt
    >>> x = np.arange(0.0, 4.0, 0.01)
    >>> fig, ax = plt.subplots()
    >>> ax.set_ylim(0.0, 5.0)
    >>> ax.set_title(r'Modified spherical Bessel functions $k_n$')
    >>> for n in np.arange(0, 4):
    ...     ax.plot(x, spherical_kn(n, x), label=rf'$k_{n}$')
    >>> plt.legend(loc='best')
    >>> plt.show()

    r1   r2   )r   r$   r&   r   r	   r3   s      r   r<   r<   8  r:   r   )NNr-   )Ú	functoolsr   Úscipy._lib.array_api_extraÚ_libÚarray_api_extrar(   Únumpyr   Ú_ufuncsr   r   r   r	   r
   r   r   r   r/   r4   r7   r9   r=   r<   r    r   r   ú<module>rE      s™  ðØ Ð Ð Ð Ð Ð Ø (Ð (Ð (Ð (Ð (Ð (Ð (Ð (Ð (Ø Ð Ð Ð ð8ð 8ð 8ð 8ð 8ð 8ð 8ð 8ð 8ð 8ð 8ð 8ð 8ð 8ð 8ð 8ð 8ð 8ð 8ð 8ð
ð ð ð ð: €�ÑÔðV#ð V#ð V#ñ ÔðV#ðr €�ÑÔðU#ð U#ð U#ñ ÔðU#ðp €�ÑÔðT#ð T#ð T#ñ ÔðT#ðn?ð ?ð ?ð ?ð €Ð6Ð7Ñ7Ô7ðT#ð T#ð T#ñ 8Ô7ðT#ð T#ð T#r   