
    (phZH                        S SK r S SKrS SKrSSKJr  SSKJrJrJ	r	J
r
  SSKJrJrJrJr  / SQr " S S5      r\" \	S	S S
9r	\	R$                  S 5       r\	R(                  S 5       r\" \SS S
9r\R$                  S 5       r\R*                  S 5       r\R,                  S 5       r\R(                  S 5       r\" \SSSS S9r\R$                  S 5       r\R.                  S 5       r\R(                  S 5       r\" \SSSS S9r\R$                  S 5       r\R.                  S 5       r\R*                  S 5       r\R,                  S 5       r\R(                  S 5       r\" \SS S
9r\R$                  S  5       r\R(                  S! 5       r\" \S"S S
9r\R$                  S# 5       r\R*                  S$ 5       r\R,                  S% 5       r\R(                  S& 5       r\" \
S'S(S S)9r
\
R$                  S* 5       r\
R(                  S+ 5       r\" \S,S(S S)9r\R$                  S- 5       r\R*                  S. 5       r\R,                  S/ 5       r\R(                  S0 5       rg)1    N   _nonneg_int_or_fail)
legendre_passoc_legendre_psph_legendre_p
sph_harm_y)legendre_p_allassoc_legendre_p_allsph_legendre_p_allsph_harm_y_all)r   r   r   r
   r	   r   r   r   c                   `    \ rS rSrSSS.S jjr\S 5       rS rS rS	 r	S
 r
S rS rS rSrg)
MultiUFunc   NF)force_complex_outputc                   [        U[        R                  5      (       d  [        U[        R                  R
                  5      (       a  UR                  5       nO7[        U[        R                  R                  5      (       a  UnO[        S5      e[        5       nU H[  n[        U[        R                  5      (       d  [        SU 35      eUR                  [        S UR                   5       5      5        M]     [        U5      S:  a  [        S5      eXl        X l        X0l        X@l        S U l        S U l        S U l        S U l        S U l        g )Nz7ufunc_or_ufuncs should be a ufunc or a ufunc collectionz2All ufuncs must have type `numpy.ufunc`. Received c              3   H   #    U  H  oR                  S 5      S   v   M     g7f)z->r   N)split).0xs     M/var/www/html/venv/lib/python3.13/site-packages/scipy/special/_multiufuncs.py	<genexpr>&MultiUFunc.__init__.<locals>.<genexpr>+   s     .UAwwt}Q/?s    "r   z*All ufuncs must take the same input types.c                      g)N r   argskwargss     r   <lambda>%MultiUFunc.__init__.<locals>.<lambda>6   s    2    c                      0 $ Nr   r   s     r   r   r    7   s    Rr!   )
isinstancenpufunccollectionsabcMappingvaluesIterable
ValueErrorsetadd	frozensettypeslen_ufunc_or_ufuncs_MultiUFunc__doc!_MultiUFunc__force_complex_output_default_kwargs_resolve_out_shapes_finalize_out_key_ufunc_default_args_ufunc_default_kwargs)selfufunc_or_ufuncsdocr   default_kwargsufuncs_iterseen_input_typesr&   s           r   __init__MultiUFunc.__init__   s"   /28844/;??+B+BCC-446O[__-E-EFF-  "5 6 6
  #u$!%22$ &22A1B&D E E $$Y.U.U%UV	 %
 #$q( !MNN /
&:#-#' !	#= %?"r!   c                     U R                   $ r#   )r3   )r;   s    r   __doc__MultiUFunc.__doc__9   s    zzr!   c                     Xl         g)z3Set `key` method by decorating a function.
        N)r8   r;   funcs     r   _override_keyMultiUFunc._override_key=   s	     	r!   c                     Xl         g r#   )r9   rG   s     r   _override_ufunc_default_args'MultiUFunc._override_ufunc_default_argsB   s    #' r!   c                     Xl         g r#   )r:   rG   s     r   _override_ufunc_default_kwargs)MultiUFunc._override_ufunc_default_kwargsE   s    %)"r!   c                 F    UR                   c  SUl         SUl        Xl        g)z9Set `resolve_out_shapes` method by decorating a function.Nz2Resolve to output shapes based on relevant inputs.resolve_out_shapes)rD   __name__r6   rG   s     r   _override_resolve_out_shapes'MultiUFunc._override_resolve_out_shapesH   s#    <<H L,#' r!   c                     Xl         g r#   )r7   rG   s     r   _override_finalize_out!MultiUFunc._override_finalize_outP   s    !r!   c                     [        U R                  [        R                  5      (       a  U R                  $ U R                  " S0 UD6nU R                  U   $ )z.Resolve to a ufunc based on keyword arguments.r   )r$   r2   r%   r&   r8   )r;   r   	ufunc_keys      r   _resolve_ufuncMultiUFunc._resolve_ufuncS   sI     d++RXX66(((II''	$$Y//r!   c                    U R                   U-  nXR                  " S0 UD6-  nU R                  " S0 UD6nXR                  * S   Vs/ s H  n[        R
                  " U5      PM     nnU R                  " S0 UD6nU R                  Gb7  [        S U 5       5      nU R                  " / US UR                  *  QUQUR                  P70 UD6n[        S U 5       5      n	[        US5      (       a2  XR                  S-  -   n
UR                  U
5      n
XR                  * S  nO][        R                  " U	6 n[        R                  " U[        R                  5      (       d  [        R                  nUR                  U4-  nU R                   (       a  [        S U 5       5      n[        S [#        X5       5       5      nXS'   U" U0 UD6nU R$                  b  U R%                  U5      nU$ s  snf )	Nc              3   N   #    U  H  n[         R                  " U5      v   M     g 7fr#   )r%   shaper   	ufunc_args     r   r   &MultiUFunc.__call__.<locals>.<genexpr>i   s     $U*YRXXi%8%8*   #%c              3      #    U  HA  n[        US 5      (       a  UR                  O[        R                  " [        U5      5      v   MC     g7f)dtypeN)hasattrre   r%   typer`   s     r   r   rb   n   s?      %B6@ 9@	78S8SY__*,((4	?*C&D6@s   A	Aresolve_dtypesr#   c              3   P   #    U  H  n[         R                  " S U5      v   M     g7f)y              ?N)r%   result_type)r   ufunc_out_dtypes     r   r   rb   ~   s&      )R@P_ *,O)L)L@Ps   $&c              3   N   #    U  H  u  p[         R                  " XS 9v   M     g7f))re   N)r%   empty)r   ufunc_out_shaperk   s      r   r   rb      s&      DB =O HBrc   outr   )r5   r9   r[   ninr%   asarrayr:   r6   tuplenoutrf   rh   rj   
issubdtypeinexactfloat64r4   zipr7   )r;   r   r   r&   arg
ufunc_argsufunc_kwargsufunc_arg_shapesufunc_out_shapesufunc_arg_dtypesufunc_dtypesufunc_out_dtypesrk   ro   s                 r   __call__MultiUFunc.__call__\   s   %%.((2622##-f- 26yyjk1BC1B#bjjo1B
C11;F;$$0$$U*$UU#77  Bk		z9J  B9I BKP:: B:@ B  % %B6@%B  B u.///**w2FF$33LA#/#= "$..2B"CorzzBB&(jjO#(::0B#B **#( )R@P)R $R   D/BD DC #&Z0<0*$$S)C
O Ds    G()	__doc__force_complex_outputr5   r7   r8   r6   r9   r:   r2   r#   )rS   
__module____qualname____firstlineno__rA   propertyrD   rI   rL   rO   rT   rW   r[   r   __static_attributes__r   r!   r   r   r      sI    @&+@@  
(*("0/r!   r   a  sph_legendre_p(n, m, theta, *, diff_n=0)

    Spherical Legendre polynomial of the first kind.

    Parameters
    ----------
    n : ArrayLike[int]
        Degree of the spherical Legendre polynomial. Must have ``n >= 0``.
    m : ArrayLike[int]
        Order of the spherical Legendre polynomial.
    theta : ArrayLike[float]
        Input value.
    diff_n : Optional[int]
        A non-negative integer. Compute and return all derivatives up
        to order ``diff_n``. Default is 0.

    Returns
    -------
    p : ndarray or tuple[ndarray]
        Spherical Legendre polynomial with ``diff_n`` derivatives.

    Notes
    -----
    The spherical counterpart of an (unnormalized) associated Legendre polynomial has
    the additional factor

    .. math::

        \sqrt{\frac{(2 n + 1) (n - m)!}{4 \pi (n + m)!}}

    It is the same as the spherical harmonic :math:`Y_{n}^{m}(\theta, \phi)`
    with :math:`\phi = 0`.
    diff_nc                 X    [        U SSS9n SU s=::  a  S::  d  O  [        SU  S35      eU $ Nr   Fstrictr      Gdiff_n is currently only implemented for orders 0, 1, and 2, received: .r   r,   r   s    r   _r      B     %@F! $
 	
 Mr!   c                 2    [         R                  " U SS5      $ Nr   r%   moveaxisro   s    r   r   r          ;;sB""r!   a|  sph_legendre_p_all(n, m, theta, *, diff_n=0)

    All spherical Legendre polynomials of the first kind up to the
    specified degree ``n`` and order ``m``.

    Output shape is ``(n + 1, 2 * m + 1, ...)``. The entry at ``(j, i)``
    corresponds to degree ``j`` and order ``i`` for all  ``0 <= j <= n``
    and ``-m <= i <= m``.

    See Also
    --------
    sph_legendre_p
    c                 X    [        U SSS9n SU s=::  a  S::  d  O  [        SU  S35      eU $ r   r   r   s    r   r   r      r   r!   c                     SS/S/-   0$ Naxesr   )r   r   r   r   r   s    r   r   r      s    RDJ<'((r!   c                     [        U [        R                  5      (       a  U S:  a  [        S5      eU S-   S[	        U5      -  S-   4U-   US-   4-   4$ )Nr   !n must be a non-negative integer.r   r   )r$   numbersIntegralr,   abs)nmtheta_shapers   r   s        r   r   r      sU    a))**q1u<==UAAJN#k1VaZMACCr!   c                 2    [         R                  " U SS5      $ r   r   r   s    r   r   r      r   r!   a  assoc_legendre_p(n, m, z, *, branch_cut=2, norm=False, diff_n=0)

    Associated Legendre polynomial of the first kind.

    Parameters
    ----------
    n : ArrayLike[int]
        Degree of the associated Legendre polynomial. Must have ``n >= 0``.
    m : ArrayLike[int]
        order of the associated Legendre polynomial.
    z : ArrayLike[float | complex]
        Input value.
    branch_cut : Optional[ArrayLike[int]]
        Selects branch cut. Must be 2 (default) or 3.
        2: cut on the real axis ``|z| > 1``
        3: cut on the real axis ``-1 < z < 1``
    norm : Optional[bool]
        If ``True``, compute the normalized associated Legendre polynomial.
        Default is ``False``.
    diff_n : Optional[int]
        A non-negative integer. Compute and return all derivatives up
        to order ``diff_n``. Default is 0.

    Returns
    -------
    p : ndarray or tuple[ndarray]
        Associated Legendre polynomial with ``diff_n`` derivatives.

    Notes
    -----
    The normalized counterpart of an (unnormalized) associated Legendre
    polynomial has the additional factor

    .. math::

        \sqrt{\frac{(2 n + 1) (n - m)!}{2 (n + m)!}}
    r   F
branch_cutnormr   c                 Z    [        USSS9nSUs=::  a  S::  d  O  [        SU S35      eX4$ r   r   r   s      r   r   r     sE     %@F! $
 	
 <r!   c                     U 4$ r#   r   r   s      r   r   r   (  
    ;r!   c                 2    [         R                  " U SS5      $ r   r   r   s    r   r   r   -  r   r!   a  assoc_legendre_p_all(n, m, z, *, branch_cut=2, norm=False, diff_n=0)

    All associated Legendre polynomials of the first kind up to the
    specified degree ``n`` and order ``m``.

    Output shape is ``(n + 1, 2 * m + 1, ...)``. The entry at ``(j, i)``
    corresponds to degree ``j`` and order ``i`` for all  ``0 <= j <= n``
    and ``-m <= i <= m``.

    See Also
    --------
    assoc_legendre_p
    c                     [        U[        R                  5      (       a  US:  d  [        SU S35      eSUs=::  a  S::  d  O  [        SU S35      eX4$ Nr   z1diff_n must be a non-negative integer, received: r   r   r   )r$   r   r   r,   r   s      r   r   r   D  sl     0 011!?xqI
 	
 ! $
 	
 <r!   c                     U 4$ r#   r   r   s      r   r   r   S  r   r!   c                     SSS/S/-   0$ r   r   r   s      r   r   r   X  s    RH
|+,,r!   c                 6   US   n[        U [        R                  5      (       a  U S:  a  [        S5      e[        U[        R                  5      (       a  US:  a  [        S5      eU S-   S[	        U5      -  S-   4[
        R                  " X#5      -   US-   4-   4$ )Nr   r   r   z!m must be a non-negative integer.r   r   r$   r   r   r,   r   r%   broadcast_shapes)r   r   z_shapebranch_cut_shapers   r   r   s          r   r   r   ]  s    HFa))**q1u<==a))**q1u<==UAAJN#
G67:@1*G I Ir!   c                 2    [         R                  " U SS5      $ r   r   r   s    r   r   r   j  r   r!   a  legendre_p(n, z, *, diff_n=0)

    Legendre polynomial of the first kind.

    Parameters
    ----------
    n : ArrayLike[int]
        Degree of the Legendre polynomial. Must have ``n >= 0``.
    z : ArrayLike[float]
        Input value.
    diff_n : Optional[int]
        A non-negative integer. Compute and return all derivatives up
        to order ``diff_n``. Default is 0.

    Returns
    -------
    p : ndarray or tuple[ndarray]
        Legendre polynomial with ``diff_n`` derivatives.

    See Also
    --------
    legendre

    References
    ----------
    .. [1] Zhang, Shanjie and Jin, Jianming. "Computation of Special
           Functions", John Wiley and Sons, 1996.
           https://people.sc.fsu.edu/~jburkardt/f77_src/special_functions/special_functions.html
    c                     [        U [        R                  5      (       a  U S:  a  [        SU  S35      eSU s=::  a  S::  d  O  [	        SU  S35      eU $ r   )r$   r   r   r,   NotImplementedErrorr   s    r   r   r     sh    vw//00fqj?xqI
 	
 !! $
 	
 Mr!   c                 2    [         R                  " U SS5      $ r   r   r   s    r   r   r     r   r!   a  legendre_p_all(n, z, *, diff_n=0)

    All Legendre polynomials of the first kind up to the
    specified degree ``n``.

    Output shape is ``(n + 1, ...)``. The entry at ``j``
    corresponds to degree ``j`` for all  ``0 <= j <= n``.

    See Also
    --------
    legendre_p
    c                 X    [        U SSS9n SU s=::  a  S::  d  O  [        SU  S35      eU $ r   r   r   s    r   r   r     r   r!   c                     SSS/0$ )Nr   r   )r   r   r   r   s    r   r   r     s    RM""r!   c                 >    [        U SSS9n X S-   4U-   US-   4-   4-  $ )Nr   Fr   r   r   )r   r   rs   r   s       r   r   r     s2    As51AE8g%!5777r!   c                 2    [         R                  " U SS5      $ r   r   r   s    r   r   r     r   r!   a  sph_harm_y(n, m, theta, phi, *, diff_n=0)

    Spherical harmonics. They are defined as

    .. math::

        Y_n^m(\theta,\phi) = \sqrt{\frac{2 n + 1}{4 \pi} \frac{(n - m)!}{(n + m)!}}
            P_n^m(\cos(\theta)) e^{i m \phi}

    where :math:`P_n^m` are the (unnormalized) associated Legendre polynomials.

    Parameters
    ----------
    n : ArrayLike[int]
        Degree of the harmonic. Must have ``n >= 0``. This is
        often denoted by ``l`` (lower case L) in descriptions of
        spherical harmonics.
    m : ArrayLike[int]
        Order of the harmonic.
    theta : ArrayLike[float]
        Polar (colatitudinal) coordinate; must be in ``[0, pi]``.
    phi : ArrayLike[float]
        Azimuthal (longitudinal) coordinate; must be in ``[0, 2*pi]``.
    diff_n : Optional[int]
        A non-negative integer. Compute and return all derivatives up
        to order ``diff_n``. Default is 0.

    Returns
    -------
    y : ndarray[complex] or tuple[ndarray[complex]]
       Spherical harmonics with ``diff_n`` derivatives.

    Notes
    -----
    There are different conventions for the meanings of the input
    arguments ``theta`` and ``phi``. In SciPy ``theta`` is the
    polar angle and ``phi`` is the azimuthal angle. It is common to
    see the opposite convention, that is, ``theta`` as the azimuthal angle
    and ``phi`` as the polar angle.

    Note that SciPy's spherical harmonics include the Condon-Shortley
    phase [2]_ because it is part of `sph_legendre_p`.

    With SciPy's conventions, the first several spherical harmonics
    are

    .. math::

        Y_0^0(\theta, \phi) &= \frac{1}{2} \sqrt{\frac{1}{\pi}} \\
        Y_1^{-1}(\theta, \phi) &= \frac{1}{2} \sqrt{\frac{3}{2\pi}}
                                    e^{-i\phi} \sin(\theta) \\
        Y_1^0(\theta, \phi) &= \frac{1}{2} \sqrt{\frac{3}{\pi}}
                                 \cos(\theta) \\
        Y_1^1(\theta, \phi) &= -\frac{1}{2} \sqrt{\frac{3}{2\pi}}
                                 e^{i\phi} \sin(\theta).

    References
    ----------
    .. [1] Digital Library of Mathematical Functions, 14.30.
           https://dlmf.nist.gov/14.30
    .. [2] https://en.wikipedia.org/wiki/Spherical_harmonics#Condon.E2.80.93Shortley_phase
    T)r   r   c                 X    [        U SSS9n SU s=::  a  S::  d  O  [        SU  S35      eU $ r   r   r   s    r   r   r     r   r!   c                     U R                   S   S:X  a  U S   $ U R                   S   S:X  a  U S   U SSS/SS/4   4$ U R                   S   S:X  a$  U S   U SSS/SS/4   U SSS/SS//SS/SS//4   4$ g Nr   r   ).r   r   r   .r      r_   r   s    r   r   r         		"9~		"9~s3AA#6777		"IC!Q!Q$7 8q!fq!f%AA'778: 	: 	r!   aX  sph_harm_y_all(n, m, theta, phi, *, diff_n=0)

    All spherical harmonics up to the specified degree ``n`` and order ``m``.

    Output shape is ``(n + 1, 2 * m + 1, ...)``. The entry at ``(j, i)``
    corresponds to degree ``j`` and order ``i`` for all  ``0 <= j <= n``
    and ``-m <= i <= m``.

    See Also
    --------
    sph_harm_y
    c                 X    [        U SSS9n SU s=::  a  S::  d  O  [        SU  S35      eU $ )Nr   Fr   r   r   z=diff_n is currently only implemented for orders 2, received: r   r   r   s    r   r   r   =  r   r!   c                     SSS/S/-   0$ )Nr   r   )r   r   r   r   r   s    r   r   r   H  s    RH//00r!   c                     US   n[        U [        R                  5      (       a  U S:  a  [        S5      eU S-   S[	        U5      -  S-   4[
        R                  " X#5      -   US-   US-   4-   4$ )Nr   r   r   r   r   r   )r   r   r   	phi_shapers   r   r   s          r   r   r   M  sx    HFa))**q1u<==UAAJN#b&9&9+&QQ	!VaZ ! # #r!   c                     U R                   S   S:X  a  U S   $ U R                   S   S:X  a  U S   U SSS/SS/4   4$ U R                   S   S:X  a$  U S   U SSS/SS/4   U SSS/SS//SS/SS//4   4$ g r   r   r   s    r   r   r   X  r   r!   )r'   r   numpyr%   _input_validationr   _special_ufuncsr   r   r   r	   _gufuncsr
   r   r   r   __all__r   rI   r   rW   rO   rT   rL   r   r!   r   <module>r      s      2: :; ;	s sl  @ E#L   &&# '#    $ !! " 22) 3) 00D 1D **# +# $H E!M' T    .. / ((# )# " E! $ ## $ 22 3 44- 5- 22	I 3	I ,,# -# 8 =
D 
 
 ""# ##  "   ..# /# ,,8 -8 &&# '# =z #1@
F   ""	: #	:  #1"   ..1 /1 ,,# -# &&	: '	:r!   