+
    i0                    @   ^ RI Ht ^ RIHt ^ RIHt ^ RIHt ^ RIH	t	 ^ RI
HtHtHt ^ RIHtHt ^ RIHtHtHt ^ R	IHt ^ R
IHtHtHt ^ RIHt ^ RIHtHt ^ RI H!t!H"t"H#t#H$t$ ^ RI%H&t& ^ RI'H(t(H)t) ^ RI*H+t+H,t,H-t- ^ RI.H/t/H0t0H1t1H2t2H3t3 ^ RI4H5t5H6t6H7t7 ^ RI8H9t9 ^ RI:H;t; ^ RI<H=t=H>t>  ! R R]4      t? ! R R]?4      t@ ! R R]?4      tA ! R R]?4      tB ! R R]?4      tC ! R  R!]?4      tD ! R" R#]?4      tER$ tF ! R% R&]?4      tGR' tHR( tI ! R) R*]G4      tJ ! R+ R,]G4      tK ! R- R.]G4      tL ! R/ R0]L4      tM ! R1 R2]L4      tNRER3 ltO ! R4 R5]4      tP ! R6 R7]P4      tQ ! R8 R9]P4      tR ! R: R;]P4      tS ! R< R=]P4      tT ! R> R?]4      tU ! R@ RA]4      tV ! RB RC]4      tWRD# )F    wraps)S)Add)cacheit)Expr)DefinedFunctionArgumentIndexError_mexpand)fuzzy_or	fuzzy_not)RationalpiI)Pow)Dummyuniquely_named_symbolWild)sympify)	factorialRisingFactorial)sincoscsccot)ceiling)explog)cbrtsqrtroot)Absreim
polar_lift
unpolarify)gammadigamma
uppergamma)hyper)spherical_bessel_fn)mpworkprecc                   v   a  ] tR t^$t o Rt]R 4       t]R 4       t]R 4       t	RR lt
R tR tR tR	 tR
tV tR# )
BesselBasea  
Abstract base class for Bessel-type functions.

This class is meant to reduce code duplication.
All Bessel-type functions can 1) be differentiated, with the derivatives
expressed in terms of similar functions, and 2) be rewritten in terms
of other Bessel-type functions.

Here, Bessel-type functions are assumed to have one complex parameter.

To use this base class, define class attributes ``_a`` and ``_b`` such that
``2*F_n' = -_a*F_{n+1} + b*F_{n-1}``.

c                (    V P                   ^ ,          # )z'The order of the Bessel-type function. argsselfs   &~/Users/tonyclaw/.openclaw/workspace/skills/math-calculator/venv/lib/python3.14/site-packages/sympy/functions/special/bessel.pyorderBesselBase.order4        yy|    c                (    V P                   ^,          # )z*The argument of the Bessel-type function. r1   r3   s   &r5   argumentBesselBase.argument9   r8   r9   c                    R # N clsnuzs   &&&r5   evalBesselBase.eval>   s    r9   c                D   V^8w  d   \        W4      hV P                  ^,          V P                  V P                  ^,
          V P                  4      ,          V P
                  ^,          V P                  V P                  ^,           V P                  4      ,          ,
          #    )r
   _b	__class__r6   r;   _ar4   argindexs   &&r5   fdiffBesselBase.fdiffB   sn    q=$T44	DNN4::>4==II	DNN4::>4==IIJ 	Kr9   c                    V P                   pVP                  R J d9   V P                  V P                  P	                  4       VP	                  4       4      # R# FN)r;   is_extended_negativerJ   r6   	conjugater4   rC   s   & r5   _eval_conjugateBesselBase._eval_conjugateH   sB    MM!!U*>>$**"6"6"8!++-HH +r9   c           	        V P                   V P                  rCVP                  V4      '       d   R # VP                  W4      '       g   R# VP	                  W4      pVP
                  '       dX   \        V \        \        \        \        \        \        34      '       g   VP                  '       g   \        VP                  4      # \        \!        VP                  VP                  .4      4      # rQ   )r6   r;   has_eval_is_meromorphicsubs
is_integer
isinstancebesseljbesselihn1hn2jnynis_zeror   is_infiniter   )r4   xarB   rC   z0s   &&&   r5   rY   BesselBase._eval_is_meromorphicM   s    

DMMA66!99%%a++VVA\===$'3R DEERZZZ 002::r~~">?@@r9   c                   V P                   V P                  V P                  rCpVP                  '       EdT   V^,
          P                  '       d   V P
                  ) V P                  ,          V! V^,
          V4      P                  4       ,          ^V P
                  ,          V^,
          ,          V! V^,
          V4      P                  4       ,          V,          ,           # V^,           P                  '       d   ^V P                  ,          V^,           ,          V! V^,           V4      P                  4       ,          V,          V P
                  V P                  ,          V! V^,           V4      P                  4       ,          ,
          # V #    )	r6   r;   rJ   is_realis_positiverK   rI   _eval_expand_funcis_negative)r4   hintsrB   rC   fs   &,   r5   rn   BesselBase._eval_expand_funcZ   s   ::t}}dnnq:::Q###(261)G)G)II$''	26*1R!VQ<+I+I+KKAMN Oq&%%%$''	26*1R!VQ<+I+I+KKAM"q&!(F(F(HHI Jr9   c                    ^ RI Hp V! V 4      # )r   )
besselsimp)sympy.simplify.simplifyrt   )r4   kwargsrt   s   &, r5   _eval_simplifyBesselBase._eval_simplifye   s    6$r9   r?   NrG   )__name__
__module____qualname____firstlineno____doc__propertyr6   r;   classmethodrD   rN   rU   rY   rn   rw   __static_attributes____classdictcell____classdict__s   @r5   r/   r/   $   sg           KI
A	   r9   r/   c                      a a ] tR t^jt oRt]P                  t]P                  t]	R 4       t
R tR tR tV 3R ltR tR
V 3R lltR	tVtV ;t# )r]   a  
Bessel function of the first kind.

Explanation
===========

The Bessel $J$ function of order $\nu$ is defined to be the function
satisfying Bessel's differential equation

.. math ::
    z^2 \frac{\mathrm{d}^2 w}{\mathrm{d}z^2}
    + z \frac{\mathrm{d}w}{\mathrm{d}z} + (z^2 - \nu^2) w = 0,

with Laurent expansion

.. math ::
    J_\nu(z) = z^\nu \left(\frac{1}{\Gamma(\nu + 1) 2^\nu} + O(z^2) \right),

if $\nu$ is not a negative integer. If $\nu=-n \in \mathbb{Z}_{<0}$
*is* a negative integer, then the definition is

.. math ::
    J_{-n}(z) = (-1)^n J_n(z).

Examples
========

Create a Bessel function object:

>>> from sympy import besselj, jn
>>> from sympy.abc import z, n
>>> b = besselj(n, z)

Differentiate it:

>>> b.diff(z)
besselj(n - 1, z)/2 - besselj(n + 1, z)/2

Rewrite in terms of spherical Bessel functions:

>>> b.rewrite(jn)
sqrt(2)*sqrt(z)*jn(n - 1/2, z)/sqrt(pi)

Access the parameter and argument:

>>> b.order
n
>>> b.argument
z

See Also
========

bessely, besseli, besselk

References
==========

.. [1] Abramowitz, Milton; Stegun, Irene A., eds. (1965), "Chapter 9",
       Handbook of Mathematical Functions with Formulas, Graphs, and
       Mathematical Tables
.. [2] Luke, Y. L. (1969), The Special Functions and Their
       Approximations, Volume 1
.. [3] https://en.wikipedia.org/wiki/Bessel_function
.. [4] https://functions.wolfram.com/Bessel-TypeFunctions/BesselJ/

c                   VP                   '       d   VP                   '       d   \        P                  # VP                  '       d   VP                   R J g   \	        V4      P
                  '       d   \        P                  # \	        V4      P                  '       d!   VP                  RJ g   \        P                  # VP                  '       d   \        P                  # V\        P                  \        P                  39   d   \        P                  # VP                  4       '       d*   W!,          V) V) ,          ,          \        W) 4      ,          # VP                  '       d{   VP                  4       '       d+   \        P                  V) ,          \        V) V4      ,          # VP!                  \"        4      pV'       d   \"        V,          \%        W4      ,          # VP                  '       d   \'        V4      pW28w  d   \        W4      # MXVP)                  4       w  r4V^ 8w  d@   \+        ^V,          \,        ,          V,          \"        ,          4      \        W4      ,          # \'        V4      pW8w  d   \        WR4      # R# )FTN)rc   r   Oner[   r#   rm   Zeroro   ComplexInfinityis_imaginaryNaNInfinityNegativeInfinitycould_extract_minus_signr]   NegativeOneextract_multiplicativelyr   r^   r&   extract_branch_factorr   r   rA   rB   rC   newznnnus   &&&   r5   rD   besselj.eval   s   999zzzuu---BJJ%$7BrF<N<N<NvvB###R]]d-B(((uuQ//0066M%%''7QB2#;&wr266===**,,}}s+GRCO;;--a0D2wwr000 ===a=Dyr((  --/GDAv1Q3r6"9Q;'(999n93?" r9   c                    \        \        \        ,          V,          ^,          4      \        V\	        \        ) 4      V,          4      ,          # rG   )r   r   r   r^   r%   r4   rB   rC   rv   s   &&&,r5   _eval_rewrite_as_besseli besselj._eval_rewrite_as_besseli   s/    1R4719~gb*aR.*:;;;r9   c                    VP                   R J dT   \        \        V,          4      \        V) V4      ,          \	        \        V,          4      \        W4      ,          ,
          # R# rQ   )r[   r   r   besselyr   r   s   &&&,r5   _eval_rewrite_as_bessely besselj._eval_rewrite_as_bessely   sD    ==E!r"u:grc1o-BrE
72>0III "r9   c                    \        ^V,          \        ,          4      \        V\        P                  ,
          V P
                  4      ,          # rG   )r    r   ra   r   Halfr;   r   s   &&&,r5   _eval_rewrite_as_jnbesselj._eval_rewrite_as_jn   s,    AaCF|BrAFF{DMM:::r9   c                r  < V P                   w  rE VP                  V4      pTP                  T4      w  rxTP                  '       d.   Yd,          ^T,          \        T^,           4      ,          ,          # TP                  '       d   T^ 8X  d   ^MTpYsT,          ,          p	T	P                  '       g^   \        ^4      \        T\        ^T,          ^,           ,          ^,          ,
          4      ,          \        \        T,          4      ,          # T # \        \        T `3  YTR7      #   \         d    T u # i ; irH   logxcdir)r2   as_leading_termNotImplementedErroras_coeff_exponentrm   r'   ro   r    r   r   superr]   _eval_as_leading_termr4   re   r   r   rB   rC   argcesignrJ   s   &&&&      r5   r   besselj._eval_as_leading_term   s    			##A&C $$Q'===7ArE%Q-/00]]]	1tD1W9D### Aws1r1R4!8}Q#677RT
BBKWd9!T9RR # 	K	s   D& &D65D6c                r    V P                   w  rVP                  '       d   VP                  '       d   R # R# R# TNr2   r[   is_extended_realr4   rB   rC   s   &  r5   _eval_is_extended_realbesselj._eval_is_extended_real   +    		===Q/// 0=r9   c                   < ^ RI Hp V P                  w  rg VP                  V4      w  rT	P                  '       Ed'   \        Y),          4      p
T! Y,          T4      pT^,          P                  YY44      P                  4       pT\        P                  J d   T# \        T^,          4      T,           P                  4       pY,          \        T^,           4      ,          pT.p\        ^T
^,           ^,          4       FR  pY) TTT,           ,          ,          ,          p\        T4      T,           P                  4       pTP                  T4       KT  	  \!        T!  T,           # \"        \$        T `#  YY44      #   \        \
        3 d    T u # i ; ir   Order)sympy.series.orderr   r2   leadterm
ValueErrorr   rm   r   _eval_nseriesremoveOr   r   r   r'   rangeappendr   r   r]   r4   re   r   r   r   r   rB   rC   _r   newnorttermskrJ   s   &&&&&            r5   r   besselj._eval_nseries   s@    	-			ZZ]FA ???15>DadAA1##A$5==?AAFF{!Q$!#,,.A5rAv&DA1tax!m,ArAvJ' *335 - 7Q;Wd1!CC' /0 	K	s   E7 7FFr?   r   )ry   rz   r{   r|   r}   r   r   rK   rI   r   rD   r   r   r   r   r   r   r   r   __classcell__rJ   r   s   @@r5   r]   r]   j   sZ     BH 
B	
B!# !#F<J;S*
D Dr9   r]   c                      a a ] tR tRt oRt]P                  t]P                  t]	R 4       t
R tR tR tV 3R ltR tRV 3R	 lltR
tVtV ;t# )r   i  a  
Bessel function of the second kind.

Explanation
===========

The Bessel $Y$ function of order $\nu$ is defined as

.. math ::
    Y_\nu(z) = \lim_{\mu \to \nu} \frac{J_\mu(z) \cos(\pi \mu)
                                        - J_{-\mu}(z)}{\sin(\pi \mu)},

where $J_\mu(z)$ is the Bessel function of the first kind.

It is a solution to Bessel's equation, and linearly independent from
$J_\nu$.

Examples
========

>>> from sympy import bessely, yn
>>> from sympy.abc import z, n
>>> b = bessely(n, z)
>>> b.diff(z)
bessely(n - 1, z)/2 - bessely(n + 1, z)/2
>>> b.rewrite(yn)
sqrt(2)*sqrt(z)*yn(n - 1/2, z)/sqrt(pi)

See Also
========

besselj, besseli, besselk

References
==========

.. [1] https://functions.wolfram.com/Bessel-TypeFunctions/BesselY/

c                   VP                   '       dw   VP                   '       d   \        P                  # \        V4      P                   R J d   \        P                  # \        V4      P                   '       d   \        P
                  # V\        P                  \        P                  39   d   \        P                  # V\        \        P                  ,          8X  dE   \        \        \        ,          V^,           ,          ^,          4      \        P                  ,          # V\        \        P                  ,          8X  dF   \        \        ) \        ,          V^,           ,          ^,          4      \        P                  ,          # VP                  '       dC   VP                  4       '       d+   \        P                  V) ,          \        V) V4      ,          # R# R# rQ   )rc   r   r   r#   r   r   r   r   r   r   r   r[   r   r   r   r@   s   &&&r5   rD   bessely.evalF  s    999zzz)))B5((((BuuQ//0066M!**qtR!V}Q'!**44!$$$$r"ub1f~a'(1::55===**,,}}s+GRCO;; - r9   c                    VP                   R J dT   \        \        V,          4      \        \        V,          4      \	        W4      ,          \	        V) V4      ,
          ,          # R# rQ   )r[   r   r   r   r]   r   s   &&&,r5   _eval_rewrite_as_besselj bessely._eval_rewrite_as_besseljZ  sD    ==E!r"u:s2b5z'".87B3?JKK "r9   c                t    V P                   ! V P                  !  pV'       d   VP                  \        4      # R # r>   )r   r2   rewriter^   r4   rB   rC   rv   ajs   &&&, r5   r    bessely._eval_rewrite_as_besseli^  -    **DII6::g&& r9   c                    \        ^V,          \        ,          4      \        V\        P                  ,
          V P
                  4      ,          # rG   )r    r   rb   r   r   r;   r   s   &&&,r5   _eval_rewrite_as_ynbessely._eval_rewrite_as_ync  s,    AaCF|baffdmm<<<r9   c                  < V P                   w  rE VP                  V4      pTP                  T4      w  rxTP                  '       Ed    ^\
        ,          \        T^,          4      ,          \        YE4      ,          p	TP                  '       d5   T^,          T) ,          ) \        T^,
          4      ,          \
        ,          M\        P                  p
T^,          T,          ) \
        \        T4      ,          ,          \        T^,           4      \        P                  ,
          ,          p\        YT.!  P                  YR7      pT# TP                  '       d   T^ 8X  d   ^MTpYsT,          ,          pTP                  '       g   \        ^4      \!        \
        T,          ^,          T,
          \
        ^,          ,           4      ) ^\#        \
        T,          ^,          T,
          \
        ^,          ,           4      ,          ^T,          ,          ,           ,          \        ^T,          4      ,          \        \
        4      ,          # T # \$        \&        T `S  YTR7      #   \         d    T u # i ; i)rH   r   r   )r2   r   r   r   rm   r   r   r]   r   r   r   r(   
EulerGammar   ro   r    r   r   r   r   r   )r4   re   r   r   rB   rC   r   r   r   term_oneterm_two
term_threer   rJ   s   &&&&         r5   r   bessely._eval_as_leading_termf  s   			##A&C $$Q'===2s1Q3x6H>@=M=M=M1}YrAv%66r9STSYSYHQ3)R	"%56Q!,,8VWJJ78HHHVCJ]]]	1tD1W9D### AwRU1Wq[2a4%7!8 81SBq1rRStAS=T;TVWXYVY;Z Z[\`abcdad\eefjkmfnnnKWd9!T9RR' # 	K	s   I I.-I.c                r    V P                   w  rVP                  '       d   VP                  '       d   R # R# R# r   r2   r[   rm   r   s   &  r5   r   bessely._eval_is_extended_real  (    		===Q]]] +=r9   c                  < ^ RI Hp V P                  w  rg VP                  V4      w  rT	P                  '       Ed   TP                  '       Ed   \        Y),          4      p
\        Yg4      p^\        ,          \        T^,          4      ,          T,          P                  YY44      p. . rT! Y,          T4      pT^,          P                  YY44      P                  4       pT\        P                  J d   T# \!        T^,          4      T,           P                  4       pT\        P                  8  d   TT) ,          \#        T^,
          4      ,          \        ,          pTP%                  T4       \'        ^T4       Fz  pTT,
          T,          pT\        P                  8X  d   TTT,          ,          pMTTT,          ,          p\!        T4      T,           P                  4       pTP%                  T4       K|  	  TT,          \        \#        T4      ,          ,          pT\)        T^,           4      \        P*                  ,
          ,          pTP%                  T4       \'        ^T
^,           ^,          4       F  pTT) TTT,           ,          ,          ,          p\!        T4      T,           P                  4       pT\)        TT,           ^,           4      \)        T^,           4      ,           ,          pTP%                  T4       K  	  T\-        T!  ,
          \-        T!  ,
          # \.        \0        T `3  YY44      #   \        \
        3 d    T u # i ; ir   )r   r   r2   r   r   r   rm   r[   r   r]   r   r   r   r   r   r   r   r   r   r   r(   r   r   r   r   )r4   re   r   r   r   r   rB   rC   r   r   r   bnrf   br   r   r   r   r   r   denomprJ   s   &&&&&                 r5   r   bessely._eval_nseries  sj    	-			ZZ]FA ???r}}}15>DBB$AaC#221DArqadAA1##A$5==?AAFF{!Q$!#,,.AAFF{B3x	"q& 11"4q"A!VQJE!%$TNQ.779DHHTN & 2r)B-'(Agb1fo45DHHTN1tax!m,aRAF_$a[1_--/'!b&1*-A>?	 -
 sAw;a((Wd1!CCK /0 	K	s   L6 6MMr?   r   )ry   rz   r{   r|   r}   r   r   rK   rI   r   rD   r   r   r   r   r   r   r   r   r   r   s   @@r5   r   r     sX     &P 
B	
B< <&L'
=S2
/D /Dr9   r   c                      a a ] tR tRt oRt]P                  ) t]P                  t]	R 4       t
RR ltR tR tR tR tV 3R	 ltRV 3R
 lltV 3R ltRtVtV ;t# )r^   i  a  
Modified Bessel function of the first kind.

Explanation
===========

The Bessel $I$ function is a solution to the modified Bessel equation

.. math ::
    z^2 \frac{\mathrm{d}^2 w}{\mathrm{d}z^2}
    + z \frac{\mathrm{d}w}{\mathrm{d}z} + (z^2 + \nu^2)^2 w = 0.

It can be defined as

.. math ::
    I_\nu(z) = i^{-\nu} J_\nu(iz),

where $J_\nu(z)$ is the Bessel function of the first kind.

Examples
========

>>> from sympy import besseli
>>> from sympy.abc import z, n
>>> besseli(n, z).diff(z)
besseli(n - 1, z)/2 + besseli(n + 1, z)/2

See Also
========

besselj, bessely, besselk

References
==========

.. [1] https://functions.wolfram.com/Bessel-TypeFunctions/BesselI/

c                   VP                   '       d   VP                   '       d   \        P                  # VP                  '       d   VP                   R J g   \	        V4      P
                  '       d   \        P                  # \	        V4      P                  '       d!   VP                  RJ g   \        P                  # VP                  '       d   \        P                  # \        V4      \        P                  \        P                  39   d   \        P                  # V\        P                  J d   \        P                  # V\        P                  J d   RV,          \        P                  ,          # VP                  4       '       d*   W!,          V) V) ,          ,          \        W) 4      ,          # VP                  '       d`   VP                  4       '       d   \        V) V4      # VP!                  \"        4      pV'       d    \"        V) ,          \%        W) 4      ,          # VP                  '       d   \'        V4      pW28w  d   \        W4      # MXVP)                  4       w  r4V^ 8w  d@   \+        ^V,          \,        ,          V,          \"        ,          4      \        W4      ,          # \'        V4      pW8w  d   \        WR4      # R# )FTN)rc   r   r   r[   r#   rm   r   ro   r   r   r   r$   r   r   r   r^   r   r   r]   r&   r   r   r   r   s   &&&   r5   rD   besseli.eval  s   999zzzuu---BJJ%$7BrF<N<N<NvvB###R]]d-B(((uua5QZZ!3!34466M

?::"""8AJJ&&%%''7QB2#;&wr266===**,,sA&--a0DB3xE 222 ===a=Dyr((  --/GDAv1Q3r6"9Q;'(999n93?" r9   c                `    VP                   '       d   \        V4      \        W4      ,          # R # r>   )r   r   _besselir4   rB   rC   limitvarrv   s   &&&&,r5   _eval_rewrite_as_tractable"besseli._eval_rewrite_as_tractable	  s&    q6(2/)) r9   c                    \        \        ) \        ,          V,          ^,          4      \        V\	        \        4      V,          4      ,          # rG   )r   r   r   r]   r%   r   s   &&&,r5   r    besseli._eval_rewrite_as_besselj  s.    A2b58A:wr:a=?;;;r9   c                t    V P                   ! V P                  !  pV'       d   VP                  \        4      # R # r>   r   r2   r   r   r   s   &&&, r5   r    besseli._eval_rewrite_as_bessely  r   r9   c                \    V P                   ! V P                  !  P                  \        4      # r>   )r   r2   r   ra   r   s   &&&,r5   r   besseli._eval_rewrite_as_jn  s"    ,,dii8@@DDr9   c                r    V P                   w  rVP                  '       d   VP                  '       d   R # R# R# r   r   r   s   &  r5   r   besseli._eval_is_extended_real  r   r9   c                  < V P                   w  rE VP                  V4      pTP                  T4      w  rxTP                  '       d.   Yd,          ^T,          \        T^,           4      ,          ,          # TP                  '       d\   T^ 8X  d   ^MTpYsT,          ,          p	T	P                  '       g.   \        T4      \        ^\        ,          T,          4      ,          # T # \        \        T `3  YTR7      #   \         d    T u # i ; ir   )r2   r   r   r   rm   r'   ro   r   r    r   r   r^   r   r   s   &&&&      r5   r   besseli._eval_as_leading_term  s    			##A&C $$Q'===7ArE%Q-/00]]]	1tD1W9D### 1vd1R46l**KWd9!T9RR # 	K	s   C6 6DDc                  < ^ RI Hp V P                  w  rg VP                  V4      w  rT	P                  '       Ed&   \        Y),          4      p
T! Y,          T4      pT^,          P                  YY44      P                  4       pT\        P                  J d   T# \        T^,          4      T,           P                  4       pY,          \        T^,           4      ,          pT.p\        ^T
^,           ^,          4       FQ  pYTTT,           ,          ,          ,          p\        T4      T,           P                  4       pTP                  T4       KS  	  \!        T!  T,           # \"        \$        T `#  YY44      #   \        \
        3 d    T u # i ; ir   )r   r   r2   r   r   r   rm   r   r   r   r   r   r   r'   r   r   r   r   r^   r   s   &&&&&            r5   r   besseli._eval_nseries2  s>    	-			ZZ]FA ???15>DadAA1##A$5==?AAFF{!Q$!#,,.A5rAv&DA1tax!m,1b1f:& *335 - 7Q;Wd1!CC' /0 	K	s   E6 6FFc           
       < ^ RI Hp ^ RIHp V^,          pV\        P
                  \        P                  39   Ed   V P                  w  r\        V4       U
u. uF  p
V! \        ^V,          ^,
          ^4      V
4      V! \        ^V,          ^,           ^4      V
4      ,          ^V
,          V	\        ^V
,          ^,           ^4      ,          ,          \        V
4      ,          ,          NK  	  up
V! ^V	\        ^V,          ^,           ^4      ,          ,          V4      .,           p\        V	4      \        ^\        ,          4      ,          \        V!  ,          # \        SV `A  WW44      # u up
i r   r   r   (sympy.functions.combinatorial.factorialsr   r   r   r   r   r   r2   r   r   r   r   r    r   r   r   _eval_aseriesr4   r   args0re   r   r   r   pointrB   rC   r   r   rJ   s   &&&&&       r5   r  besseli._eval_aseriesQ  s0   L,aQZZ!3!344IIEBGLQxQGO! "(1R4!8Q"7;OHUVWYUY\]U]_`Lacd<ee1Xa(1Q37A.//	!<> >GOQTYZ[\]`hijklilopiprs`t\uZuwxTySz{Aq6$qt*$Q00w$Qq77	Qs   BE(r?   r>   r   )ry   rz   r{   r|   r}   r   r   rK   rI   r   rD   r   r   r   r   r   r   r   r  r   r   r   r   s   @@r5   r^   r^     sd     %N %%B	
B%# %#N*<'
E
S*D>8 8r9   r^   c                      a a ] tR tRt oRt]P                  t]P                  ) t]	R 4       t
R tR tR tR tR tRR	 ltR
 tRV 3R lltV 3R ltRtVtV ;t# )besselki_  a  
Modified Bessel function of the second kind.

Explanation
===========

The Bessel $K$ function of order $\nu$ is defined as

.. math ::
    K_\nu(z) = \lim_{\mu \to \nu} \frac{\pi}{2}
               \frac{I_{-\mu}(z) -I_\mu(z)}{\sin(\pi \mu)},

where $I_\mu(z)$ is the modified Bessel function of the first kind.

It is a solution of the modified Bessel equation, and linearly independent
from $Y_\nu$.

Examples
========

>>> from sympy import besselk
>>> from sympy.abc import z, n
>>> besselk(n, z).diff(z)
-besselk(n - 1, z)/2 - besselk(n + 1, z)/2

See Also
========

besselj, besseli, bessely

References
==========

.. [1] https://functions.wolfram.com/Bessel-TypeFunctions/BesselK/

c                8   VP                   '       dw   VP                   '       d   \        P                  # \        V4      P                   R J d   \        P                  # \        V4      P                   '       d   \        P
                  # V\        P                  \        \        P                  ,          \        \        P                  ,          39   d   \        P                  # VP                  '       d&   VP                  4       '       d   \        V) V4      # R# R# rQ   )rc   r   r   r#   r   r   r   r   r   r[   r   r  r@   s   &&&r5   rD   besselk.eval  s    999zzzzz!B5((((BuuQqzz\1Q-?-?+?@@66M===**,,sA& - r9   c                    VP                   R J dK   \        \        \        V,          4      ,          \        V) V4      \        W4      ,
          ,          ^,          # R# rQ   )r[   r   r   r^   r   s   &&&,r5   r    besselk._eval_rewrite_as_besseli  s@    ==E!c"R%j='2#q/GBN"BCAEE "r9   c                t    V P                   ! V P                  !  pV'       d   VP                  \        4      # R # r>   )r   r2   r   r]   )r4   rB   rC   rv   ais   &&&, r5   r    besselk._eval_rewrite_as_besselj  r   r9   c                t    V P                   ! V P                  !  pV'       d   VP                  \        4      # R # r>   r   r   s   &&&, r5   r    besselk._eval_rewrite_as_bessely  r   r9   c                t    V P                   ! V P                  !  pV'       d   VP                  \        4      # R # r>   )r   r2   r   rb   )r4   rB   rC   rv   ays   &&&, r5   r   besselk._eval_rewrite_as_yn  s,    **DII6::b>! r9   c                r    V P                   w  rVP                  '       d   VP                  '       d   R # R# R# r   r   r   s   &  r5   r   besselk._eval_is_extended_real  r   r9   c                b    VP                   '       d   \        V) 4      \        W4      ,          # R # r>   )r   r   _besselkr   s   &&&&,r5   r   "besselk._eval_rewrite_as_tractable  s(    r78B?** r9   c                   V P                   w  rE VP                  V4      pTP                  T4      w  rxTP                  '       d   TP
                  '       d3   \        T4      ) \        P                  ,
          \        ^4      ,           p	M\TP                  '       d<   \        \        T4      4      T^,          \        T4      ) ,          ,          ^,          p	M\        RT R24      hT	P                  YR7      # TP                  '       d8   \        \        4      \        T) 4      ,          \        ^T,          4      ,          # T P!                  YF4      #   \         d    T u # i ; i)rH   z"Cannot proceed without knowing if z is zero or not.r   )r2   r   r   r   rm   rc   r   r   r   
is_nonzeror'   r"   ro   r    r   r   func)
r4   re   r   r   rB   rC   r   r   r   r   s
   &&&&      r5   r   besselk._eval_as_leading_term  s   			##A&C $$Q'===zzzAw-A6SW~qss2wh&779),NrdRb*cdd'''55]]]8CI%d1S5k1199R%%' # 	K	s   E E"!E"c                	  < ^ RI Hp V P                  w  rg VP                  V4      w  rT	P                  '       Edb   T^,          P                  YY44      P                  4       p
T
\        P                  J d   T! Yv) ,          Yv,          ,           T4      # T! Y,          T4      pTP                  '       EdX   \        Y),          4      p\        Yg4      pRT^,
          ,          \        T^,          4      ,          T,          P                  YY44      p. . pp\        T
^,          4      pT\        P                  8  d   Y) ,          \!        T^,
          4      ,          ^,          pTP#                  T4       \%        ^T4       FR  pTTTT,
          T,          ,          ,          p\        T4      T,           P                  4       pTP#                  T4       KT  	  Y,          RT,          ,          ^\!        T4      ,          ,          pT\'        T^,           4      \        P(                  ,
          ,          pTP#                  T4       \%        ^T^,           ^,          4       F  pTTTTT,           ,          ,          ,          p\        T4      T,           P                  4       pT\'        TT,           ^,           4      \'        T^,           4      ,           ,          pTP#                  T4       K  	  T\+        T!  ,           \+        T!  ,           T,           # TP,                  '       Eds   \        Y&,           T	,          4      p\        Y&,
          T	,          4      p. . r\%        T^,           ^,          4       Fs  p\/        T4      T
^T,          T,
          ,          ,          ^\1        ^T,
          T4      ,          \!        T4      ,          ,          pTP#                  \        T4      4       Ku  	  \%        T^,           ^,          4       Ft  p\/        T) 4      T
^T,          T,           ,          ,          ^\1        T^,           T4      ,          \!        T4      ,          ,          pTP#                  \        T4      4       Kv  	  \+        T!  \+        T!  ,           T,           # \        R4      h\2        \4        T `  YY44      #   \        \
        3 d    T u # i ; i)r   r   z4besselk expansion is only implemented for real orderr   )r   r   r2   r   r   r   rm   r   r   r   r   r[   r   r^   r   r   r   r   r   r(   r   r   is_nonintegerr'   r   r   r  )r4   re   r   r   r   r   rB   rC   r   r   r   r   r   r   rf   r   r   r   r   r   r   newn_anewn_brJ   s   &&&&&                  r5   r   besselk._eval_nseries  s~   ,			ZZ]FA ???1##A$5==?AAFF{QX-q11adAA}}}qu~R^BF^C!H,R/>>qTP21QTN;s8Ib1f$55a7DHHTN"1b\AFA:. ( 2;;= *
 E2(NAimO4'"q&/ALL89q4!8a-0AAq2vJ'A!!q113Aga"fqj1GAENBCDHHTN	 1
 37{S!W,q00!!! !!$, !$,21q1}-A 9Q1R[0!OAbD!4L2LYWX\2YZDHHXd^, . q1}-A ":a!A#b&k11_RT15M3MiXYl3Z[DHHXd^, . Awa(1,,)*`aaWd1!CC{ /0 	K	s   R2 2SSc           
       < ^ RI Hp ^ RIHp V^,          pV\        P
                  \        P                  39   Ed   V P                  w  r\        V4       U
u. uF  p
V! \        ^V,          ^,
          ^4      V
4      V! \        ^V,          ^,           ^4      V
4      ,          RV
,          V	\        ^V
,          ^,           ^4      ,          ,          \        V
4      ,          ,          NK  	  up
V! ^V	\        ^V,          ^,           ^4      ,          ,          V4      .,           p\        V	) 4      \        \        ^,          4      ,          \        V!  ,          # \        SV `A  WW44      # u up
i r   r  r   r  r  s   &&&&&       r5   r  besselk._eval_aseries  s2   L,aQZZ!3!344IIEBHMaRHP1 "(1R4!8Q"7;OHUVWYUY\]U]_`Lacd<eeAYq8AaC!GQ/001=? ?HPRTYZ[\]`hijklilopiprs`t\uZuwxTySz{AGDAJ&Q//w$Qq77	Rs   BE)r?   r>   r   )ry   rz   r{   r|   r}   r   r   rK   rI   r   rD   r   r   r   r   r   r   r   r   r  r   r   r   r   s   @@r5   r  r  _  si     #J 
B
%%B' 'F'
'
"

+&2CDJ8 8r9   r  c                   Z   a  ] tR tRt o Rt]P                  t]P                  tR t	Rt
V tR# )hankel1i   aL  
Hankel function of the first kind.

Explanation
===========

This function is defined as

.. math ::
    H_\nu^{(1)} = J_\nu(z) + iY_\nu(z),

where $J_\nu(z)$ is the Bessel function of the first kind, and
$Y_\nu(z)$ is the Bessel function of the second kind.

It is a solution to Bessel's equation.

Examples
========

>>> from sympy import hankel1
>>> from sympy.abc import z, n
>>> hankel1(n, z).diff(z)
hankel1(n - 1, z)/2 - hankel1(n + 1, z)/2

See Also
========

hankel2, besselj, bessely

References
==========

.. [1] https://functions.wolfram.com/Bessel-TypeFunctions/HankelH1/

c                    V P                   pVP                  R J d3   \        V P                  P	                  4       VP	                  4       4      # R# rQ   )r;   rR   hankel2r6   rS   rT   s   & r5   rU   hankel1._eval_conjugateH  >    MM!!U*4:://11;;=AA +r9   r?   Nry   rz   r{   r|   r}   r   r   rK   rI   rU   r   r   r   s   @r5   r4  r4     s+     "H 
B	
BB Br9   r4  c                   Z   a  ] tR tRt o Rt]P                  t]P                  tR t	Rt
V tR# )r6  iN  az  
Hankel function of the second kind.

Explanation
===========

This function is defined as

.. math ::
    H_\nu^{(2)} = J_\nu(z) - iY_\nu(z),

where $J_\nu(z)$ is the Bessel function of the first kind, and
$Y_\nu(z)$ is the Bessel function of the second kind.

It is a solution to Bessel's equation, and linearly independent from
$H_\nu^{(1)}$.

Examples
========

>>> from sympy import hankel2
>>> from sympy.abc import z, n
>>> hankel2(n, z).diff(z)
hankel2(n - 1, z)/2 - hankel2(n + 1, z)/2

See Also
========

hankel1, besselj, bessely

References
==========

.. [1] https://functions.wolfram.com/Bessel-TypeFunctions/HankelH2/

c                    V P                   pVP                  R J d3   \        V P                  P	                  4       VP	                  4       4      # R# rQ   )r;   rR   r4  r6   rS   rT   s   & r5   rU   hankel2._eval_conjugatew  r8  r9   r?   Nr9  r   s   @r5   r6  r6  N  s+     #J 
B	
BB Br9   r6  c                 0   a  \        S 4      V 3R  l4       pV# )c                 >   < VP                   '       d
   S! WV4      # R # r>   )r[   )r4   rB   rC   fns   &&&r5   gassume_integer_order.<locals>.g~  s    ===d?" r9   r   )r?  r@  s   f r5   assume_integer_orderrB  }  s     
2Y# # Hr9   c                   :   a  ] tR tRt o RtR tR tRR ltRtV t	R# )	SphericalBesselBasei  a  
Base class for spherical Bessel functions.

These are thin wrappers around ordinary Bessel functions,
since spherical Bessel functions differ from the ordinary
ones just by a slight change in order.

To use this class, define the ``_eval_evalf()`` and ``_expand()`` methods.

c                    \        R4      h)z?Expand self into a polynomial. Nu is guaranteed to be Integer. 	expansionr   r4   rp   s   &,r5   _expandSphericalBesselBase._expand  s    !+..r9   c                b    V P                   P                  '       d   V P                  ! R/ VB # V # Nr?   )r6   
is_IntegerrI  rH  s   &,r5   rn   %SphericalBesselBase._eval_expand_func  s)    ::   <<(%((r9   c                    V^8w  d   \        W4      hV P                  V P                  ^,
          V P                  4      W P                  ^,           ,          V P                  ,          ,
          # rG   )r
   rJ   r6   r;   rL   s   &&r5   rN   SphericalBesselBase.fdiff  sO    q=$T44~~djj1ndmm<JJN#DMM12 	2r9   r?   NrG   )
ry   rz   r{   r|   r}   rI  rn   rN   r   r   r   s   @r5   rD  rD    s     	/
2 2r9   rD  c                     \        W4      \        V4      ,          \        P                  V ^,           ,          \        V ) ^,
          V4      ,          \	        V4      ,          ,           # rj   )r+   r   r   r   r   r   rC   s   &&r5   _jnrS    sK    %c!f,MMAE"#6rAvq#AA#a&HI Jr9   c                     \         P                  V ^,           ,          \        V ) ^,
          V4      ,          \        V4      ,          \        W4      \	        V4      ,          ,
          # rj   )r   r   r+   r   r   rR  s   &&r5   _ynrU    sI    MMAE"%8!a%CCCFJ%c!f,- .r9   c                   R   a  ] tR tRt o Rt]R 4       tR tR tR t	R t
R tR	tV tR
# )ra   i  aV  
Spherical Bessel function of the first kind.

Explanation
===========

This function is a solution to the spherical Bessel equation

.. math ::
    z^2 \frac{\mathrm{d}^2 w}{\mathrm{d}z^2}
      + 2z \frac{\mathrm{d}w}{\mathrm{d}z} + (z^2 - \nu(\nu + 1)) w = 0.

It can be defined as

.. math ::
    j_\nu(z) = \sqrt{\frac{\pi}{2z}} J_{\nu + \frac{1}{2}}(z),

where $J_\nu(z)$ is the Bessel function of the first kind.

The spherical Bessel functions of integral order are
calculated using the formula:

.. math:: j_n(z) = f_n(z) \sin{z} + (-1)^{n+1} f_{-n-1}(z) \cos{z},

where the coefficients $f_n(z)$ are available as
:func:`sympy.polys.orthopolys.spherical_bessel_fn`.

Examples
========

>>> from sympy import Symbol, jn, sin, cos, expand_func, besselj, bessely
>>> z = Symbol("z")
>>> nu = Symbol("nu", integer=True)
>>> print(expand_func(jn(0, z)))
sin(z)/z
>>> expand_func(jn(1, z)) == sin(z)/z**2 - cos(z)/z
True
>>> expand_func(jn(3, z))
(-6/z**2 + 15/z**4)*sin(z) + (1/z - 15/z**3)*cos(z)
>>> jn(nu, z).rewrite(besselj)
sqrt(2)*sqrt(pi)*sqrt(1/z)*besselj(nu + 1/2, z)/2
>>> jn(nu, z).rewrite(bessely)
(-1)**nu*sqrt(2)*sqrt(pi)*sqrt(1/z)*bessely(-nu - 1/2, z)/2
>>> jn(2, 5.2+0.3j).evalf(20)
0.099419756723640344491 - 0.054525080242173562897*I

See Also
========

besselj, bessely, besselk, yn

References
==========

.. [1] https://dlmf.nist.gov/10.47

c                `   VP                   '       dg   VP                   '       d   \        P                  # VP                  '       d3   VP                  '       d   \        P
                  # \        P                  # V\        P                  \        P                  39   d   \        P
                  # R # r>   )	rc   r   r   r[   rm   r   r   r   r   r@   s   &&&r5   rD   jn.eval  si    999zzzuu>>>66M,,,##QZZ0066M 1r9   c                    \        \        ^V,          ,          4      \        V\        P                  ,           V4      ,          # rG   )r    r   r]   r   r   r   s   &&&,r5   r   jn._eval_rewrite_as_besselj  s(    B!H~QVVQ 777r9   c                    \         P                  V,          \        \        ^V,          ,          4      ,          \	        V) \         P
                  ,
          V4      ,          # rG   )r   r   r    r   r   r   r   s   &&&,r5   r   jn._eval_rewrite_as_bessely  s8    }}b 4AaC>1GRC!&&L!4LLLr9   c                b    \         P                  V,          \        V) ^,
          V4      ,          # rj   )r   r   rb   r   s   &&&,r5   r   jn._eval_rewrite_as_yn  s"    }}r"Ra^33r9   c                B    \        V P                  V P                  4      # r>   )rS  r6   r;   rH  s   &,r5   rI  
jn._expand      4::t}}--r9   c                    V P                   P                  '       d%   V P                  \        4      P	                  V4      # R # r>   r6   rM  r   r]   _eval_evalfr4   precs   &&r5   rd  jn._eval_evalf  1    ::   <<(44T:: !r9   r?   N)ry   rz   r{   r|   r}   r   rD   r   r   r   rI  rd  r   r   r   s   @r5   ra   ra     s>     8r 
 
8M4.; ;r9   ra   c                   V   a  ] tR tRt o Rt]R 4       t]R 4       tR tR t	R t
RtV tR	# )
rb   i  a%  
Spherical Bessel function of the second kind.

Explanation
===========

This function is another solution to the spherical Bessel equation, and
linearly independent from $j_n$. It can be defined as

.. math ::
    y_\nu(z) = \sqrt{\frac{\pi}{2z}} Y_{\nu + \frac{1}{2}}(z),

where $Y_\nu(z)$ is the Bessel function of the second kind.

For integral orders $n$, $y_n$ is calculated using the formula:

.. math:: y_n(z) = (-1)^{n+1} j_{-n-1}(z)

Examples
========

>>> from sympy import Symbol, yn, sin, cos, expand_func, besselj, bessely
>>> z = Symbol("z")
>>> nu = Symbol("nu", integer=True)
>>> print(expand_func(yn(0, z)))
-cos(z)/z
>>> expand_func(yn(1, z)) == -cos(z)/z**2-sin(z)/z
True
>>> yn(nu, z).rewrite(besselj)
(-1)**(nu + 1)*sqrt(2)*sqrt(pi)*sqrt(1/z)*besselj(-nu - 1/2, z)/2
>>> yn(nu, z).rewrite(bessely)
sqrt(2)*sqrt(pi)*sqrt(1/z)*bessely(nu + 1/2, z)/2
>>> yn(2, 5.2+0.3j).evalf(20)
0.18525034196069722536 + 0.014895573969924817587*I

See Also
========

besselj, bessely, besselk, jn

References
==========

.. [1] https://dlmf.nist.gov/10.47

c                    \         P                  V^,           ,          \        \        ^V,          ,          4      ,          \	        V) \         P
                  ,
          V4      ,          # rj   )r   r   r    r   r]   r   r   s   &&&,r5   r   yn._eval_rewrite_as_besselj3  s<    }}r!t$tB!H~5affa8PPPr9   c                    \        \        ^V,          ,          4      \        V\        P                  ,           V4      ,          # rG   )r    r   r   r   r   r   s   &&&,r5   r   yn._eval_rewrite_as_bessely7  s(    B!H~QVVQ 777r9   c                p    \         P                  V^,           ,          \        V) ^,
          V4      ,          # rj   )r   r   ra   r   s   &&&,r5   r   yn._eval_rewrite_as_jn;  s&    }}rAv&RC!GQ77r9   c                B    \        V P                  V P                  4      # r>   )rU  r6   r;   rH  s   &,r5   rI  
yn._expand>  ra  r9   c                    V P                   P                  '       d%   V P                  \        4      P	                  V4      # R # r>   )r6   rM  r   r   rd  re  s   &&r5   rd  yn._eval_evalfA  rh  r9   r?   N)ry   rz   r{   r|   r}   rB  r   r   r   rI  rd  r   r   r   s   @r5   rb   rb     sI     -\ Q Q 8 88.; ;r9   rb   c                   ^   a  ] tR tRt o ]R 4       t]R 4       tR tR tR t	R t
R tR	tV tR
# )SphericalHankelBaseiF  c                X   V P                   p\        \        ^V,          ,          4      \        V\        P
                  ,           V4      V\        ,          \        P                  V^,           ,          ,          \        V) \        P
                  ,
          V4      ,          ,           ,          # rG   )_hankel_kind_signr    r   r]   r   r   r   r   r4   rB   rC   rv   hkss   &&&, r5   r   ,SphericalHankelBase._eval_rewrite_as_besseljH  sq    
 $$B!H~wrAFF{A6"1uQ]]RT%::7B3<QR;SS T U 	Ur9   c                J   V P                   p\        \        ^V,          ,          4      \        P                  V,          \        V) \        P                  ,
          V4      ,          V\        ,          \        V\        P                  ,           V4      ,          ,           ,          # rG   )rw  r    r   r   r   r   r   r   rx  s   &&&, r5   r   ,SphericalHankelBase._eval_rewrite_as_besselyQ  si    
 $$B!H~q}}b0"qvvq1II"1uWR!&&[!%<< = > 	>r9   c                    V P                   p\        W4      P                  \        4      V\        ,          \        W4      ,          ,           # r>   )rw  ra   r   rb   r   rx  s   &&&, r5   r   'SphericalHankelBase._eval_rewrite_as_ynZ  s3    $$"y  $s1uRY66r9   c                    V P                   p\        W4      V\        ,          \        W4      P	                  \        4      ,          ,           # r>   )rw  ra   r   rb   r   rx  s   &&&, r5   r   'SphericalHankelBase._eval_rewrite_as_jn^  s4    $$"y3q5B!2!22!6666r9   c                    V P                   P                  '       d   V P                  ! R/ VB # V P                   pV P                  pV P                  p\        W#4      V\        ,          \        W#4      ,          ,           # rL  )r6   rM  rI  r;   rw  ra   r   rb   )r4   rp   rB   rC   ry  s   &,   r5   rn   %SphericalHankelBase._eval_expand_funcb  s\    ::   <<(%((BA((Cb9s1uRY..r9   c                    V P                   pV P                  pV P                  p\        W#4      V\        ,          \        W#4      ,          ,           P                  4       # r>   )r6   r;   rw  rS  r   rU  expand)r4   rp   r   rC   ry  s   &,   r5   rI  SphericalHankelBase._expandk  sE    JJMM$$ A	CE#a)O+3355r9   c                    V P                   P                  '       d%   V P                  \        4      P	                  V4      # R # r>   rc  re  s   &&r5   rd  SphericalHankelBase._eval_evalfz  rh  r9   r?   N)ry   rz   r{   r|   rB  r   r   r   r   rn   rI  rd  r   r   r   s   @r5   ru  ru  F  sK     U U > >77/6; ;r9   ru  c                   L   a  ] tR tRt o Rt]P                  t]R 4       t	Rt
V tR# )r_   i  a  
Spherical Hankel function of the first kind.

Explanation
===========

This function is defined as

.. math:: h_\nu^(1)(z) = j_\nu(z) + i y_\nu(z),

where $j_\nu(z)$ and $y_\nu(z)$ are the spherical
Bessel function of the first and second kinds.

For integral orders $n$, $h_n^(1)$ is calculated using the formula:

.. math:: h_n^(1)(z) = j_{n}(z) + i (-1)^{n+1} j_{-n-1}(z)

Examples
========

>>> from sympy import Symbol, hn1, hankel1, expand_func, yn, jn
>>> z = Symbol("z")
>>> nu = Symbol("nu", integer=True)
>>> print(expand_func(hn1(nu, z)))
jn(nu, z) + I*yn(nu, z)
>>> print(expand_func(hn1(0, z)))
sin(z)/z - I*cos(z)/z
>>> print(expand_func(hn1(1, z)))
-I*sin(z)/z - cos(z)/z + sin(z)/z**2 - I*cos(z)/z**2
>>> hn1(nu, z).rewrite(jn)
(-1)**(nu + 1)*I*jn(-nu - 1, z) + jn(nu, z)
>>> hn1(nu, z).rewrite(yn)
(-1)**nu*yn(-nu - 1, z) + I*yn(nu, z)
>>> hn1(nu, z).rewrite(hankel1)
sqrt(2)*sqrt(pi)*sqrt(1/z)*hankel1(nu, z)/2

See Also
========

hn2, jn, yn, hankel1, hankel2

References
==========

.. [1] https://dlmf.nist.gov/10.47

c                \    \        \        ^V,          ,          4      \        W4      ,          # rG   )r    r   r4  r   s   &&&,r5   _eval_rewrite_as_hankel1hn1._eval_rewrite_as_hankel1      B!H~gbn,,r9   r?   N)ry   rz   r{   r|   r}   r   r   rw  rB  r  r   r   r   s   @r5   r_   r_     s)     .` - -r9   r_   c                   N   a  ] tR tRt o Rt]P                  ) t]R 4       t	Rt
V tR# )r`   i  a  
Spherical Hankel function of the second kind.

Explanation
===========

This function is defined as

.. math:: h_\nu^(2)(z) = j_\nu(z) - i y_\nu(z),

where $j_\nu(z)$ and $y_\nu(z)$ are the spherical
Bessel function of the first and second kinds.

For integral orders $n$, $h_n^(2)$ is calculated using the formula:

.. math:: h_n^(2)(z) = j_{n} - i (-1)^{n+1} j_{-n-1}(z)

Examples
========

>>> from sympy import Symbol, hn2, hankel2, expand_func, jn, yn
>>> z = Symbol("z")
>>> nu = Symbol("nu", integer=True)
>>> print(expand_func(hn2(nu, z)))
jn(nu, z) - I*yn(nu, z)
>>> print(expand_func(hn2(0, z)))
sin(z)/z + I*cos(z)/z
>>> print(expand_func(hn2(1, z)))
I*sin(z)/z - cos(z)/z + sin(z)/z**2 + I*cos(z)/z**2
>>> hn2(nu, z).rewrite(hankel2)
sqrt(2)*sqrt(pi)*sqrt(1/z)*hankel2(nu, z)/2
>>> hn2(nu, z).rewrite(jn)
-(-1)**(nu + 1)*I*jn(-nu - 1, z) + jn(nu, z)
>>> hn2(nu, z).rewrite(yn)
(-1)**nu*yn(-nu - 1, z) - I*yn(nu, z)

See Also
========

hn1, jn, yn, hankel1, hankel2

References
==========

.. [1] https://dlmf.nist.gov/10.47

c                \    \        \        ^V,          ,          4      \        W4      ,          # rG   )r    r   r6  r   s   &&&,r5   _eval_rewrite_as_hankel2hn2._eval_rewrite_as_hankel2  r  r9   r?   N)ry   rz   r{   r|   r}   r   r   rw  rB  r  r   r   r   s   @r5   r`   r`     s+     .` - -r9   r`   c                \  a aaaa ^ RI Hp SR8X  d|   ^ RIHp ^ RIHp V! V4      p\        ^V^,           4       Uu. uFI  p\        P                  ! V! \        S R,           4      P                  V4      \        V4      4      V4      NKK  	  up# SR8X  d   ^ RIHo  ^ RIHo V V3R	 lp	M\%        R4      hVV3R lp
S V,           pV
! W4      pV.p\        V^,
          4       F#  pV
! WV,           4      pVP'                  V4       K%  	  V# u upi   \          d    ^ R
IHo T T3R lp	 Lui ; i)a1  
Zeros of the spherical Bessel function of the first kind.

Explanation
===========

This returns an array of zeros of $jn$ up to the $k$-th zero.

* method = "sympy": uses `mpmath.besseljzero
  <https://mpmath.org/doc/current/functions/bessel.html#mpmath.besseljzero>`_
* method = "scipy": uses the
  `SciPy's sph_jn <https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.jn_zeros.html>`_
  and
  `newton <https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.newton.html>`_
  to find all
  roots, which is faster than computing the zeros using a general
  numerical solver, but it requires SciPy and only works with low
  precision floating point numbers. (The function used with
  method="sympy" is a recent addition to mpmath; before that a general
  solver was used.)

Examples
========

>>> from sympy import jn_zeros
>>> jn_zeros(2, 4, dps=5)
[5.7635, 9.095, 12.323, 15.515]

See Also
========

jn, yn, besselj, besselk, bessely

Parameters
==========

n : integer
    order of Bessel function

k : integer
    number of zeros to return


)r   sympy)besseljzero)dps_to_precg      ?scipy)newton)spherical_jnc                    < S! SV 4      # r>   r?   )re   r   r  s   &r5   <lambda>jn_zeros.<locals>.<lambda>)  s    ,q!,r9   )sph_jnc                 2   < S! SV 4      ^ ,          R,          # r   r   r?   )re   r   r  s   &r5   r  r  ,  s    &A,q/"-r9   Unknown method.c                 <   < SR 8X  d   S! W4      pV# \        R4      h)r  r  rG  )rq   re   r!   methodr  s   && r5   solverjn_zeros.<locals>.solver0  s)    W!<D  &&788r9   )mathr   mpmathr  mpmath.libmp.libmpfr  r   r   _from_mpmathr   
_to_mpmathintscipy.optimizer  scipy.specialr  ImportErrorr  r   r   )r   r   r  dpsmath_pir  r  rf  lrq   r  r!   rootsir  r  r  s   f&f&          @@@r5   jn_zerosr    s   Z #&33 q!a%*(A !!+aCj.C.CD.I.1!f#67;=(* 	* 
7	)	.2,A
 ""344 w;D!?DFE1q5\a(T  L=*  	.,-A	.s   ADD D+*D+c                   D   a  ] tR tRt o RtR tR tR	R ltR	R ltRt	V t
R# )
AiryBaseiC  z[
Abstract base class for Airy functions.

This class is meant to reduce code duplication.

c                b    V P                  V P                  ^ ,          P                  4       4      # r   )r(  r2   rS   r3   s   &r5   rU   AiryBase._eval_conjugateK  s"    yy1//122r9   c                <    V P                   ^ ,          P                  # r   )r2   r   r3   s   &r5   r   AiryBase._eval_is_extended_realN  s    yy|,,,r9   c                    V P                   ^ ,          pVP                  4       pV P                  pV! V4      V! V4      ,           ^,          p\        V! V4      V! V4      ,
          ,          ^,          pWg3# r   )r2   rS   r(  r   )r4   deeprp   rC   zcrq   uvs   &&,     r5   as_real_imagAiryBase.as_real_imagQ  sY    IIaL[[]IIqT!B%ZNquQqTzN1tr9   c                T    V P                   ! RR V/VB w  r4W4\        ,          ,           # )r  r?   )r  r   )r4   r  rp   re_partim_parts   &&,  r5   _eval_expand_complexAiryBase._eval_expand_complexY  s*    ,,@$@%@""r9   r?   N)T)ry   rz   r{   r|   r}   rU   r   r  r  r   r   r   s   @r5   r  r  C  s#     3-# #r9   r  c                   x   a  ] tR tRt o Rt^tRt]R 4       tRR lt	]
]R 4       4       tR tR tR	 tR
 tRtV tR# )airyaii^  a  
The Airy function $\operatorname{Ai}$ of the first kind.

Explanation
===========

The Airy function $\operatorname{Ai}(z)$ is defined to be the function
satisfying Airy's differential equation

.. math::
    \frac{\mathrm{d}^2 w(z)}{\mathrm{d}z^2} - z w(z) = 0.

Equivalently, for real $z$

.. math::
    \operatorname{Ai}(z) := \frac{1}{\pi}
    \int_0^\infty \cos\left(\frac{t^3}{3} + z t\right) \mathrm{d}t.

Examples
========

Create an Airy function object:

>>> from sympy import airyai
>>> from sympy.abc import z

>>> airyai(z)
airyai(z)

Several special values are known:

>>> airyai(0)
3**(1/3)/(3*gamma(2/3))
>>> from sympy import oo
>>> airyai(oo)
0
>>> airyai(-oo)
0

The Airy function obeys the mirror symmetry:

>>> from sympy import conjugate
>>> conjugate(airyai(z))
airyai(conjugate(z))

Differentiation with respect to $z$ is supported:

>>> from sympy import diff
>>> diff(airyai(z), z)
airyaiprime(z)
>>> diff(airyai(z), z, 2)
z*airyai(z)

Series expansion is also supported:

>>> from sympy import series
>>> series(airyai(z), z, 0, 3)
3**(5/6)*gamma(1/3)/(6*pi) - 3**(1/6)*z*gamma(2/3)/(2*pi) + O(z**3)

We can numerically evaluate the Airy function to arbitrary precision
on the whole complex plane:

>>> airyai(-2).evalf(50)
0.22740742820168557599192443603787379946077222541710

Rewrite $\operatorname{Ai}(z)$ in terms of hypergeometric functions:

>>> from sympy import hyper
>>> airyai(z).rewrite(hyper)
-3**(2/3)*z*hyper((), (4/3,), z**3/9)/(3*gamma(1/3)) + 3**(1/3)*hyper((), (2/3,), z**3/9)/(3*gamma(2/3))

See Also
========

airybi: Airy function of the second kind.
airyaiprime: Derivative of the Airy function of the first kind.
airybiprime: Derivative of the Airy function of the second kind.

References
==========

.. [1] https://en.wikipedia.org/wiki/Airy_function
.. [2] https://dlmf.nist.gov/9
.. [3] https://encyclopediaofmath.org/wiki/Airy_functions
.. [4] https://mathworld.wolfram.com/AiryFunctions.html

Tc                R   VP                   '       d   V\        P                  J d   \        P                  # V\        P                  J d   \        P                  # V\        P
                  J d   \        P                  # VP                  '       dC   \        P                  ^\        ^^4      ,          \        \        ^^4      4      ,          ,          # VP                  '       dC   \        P                  ^\        ^^4      ,          \        \        ^^4      4      ,          ,          # R#    N)
	is_Numberr   r   r   r   r   rc   r   r   r'   rA   r   s   &&r5   rD   airyai.eval  s    ===aee|uu

"vv***vvuu8Aq> 1E(1a.4I IJJ;;;55Ax1~-hq!n0EEFF r9   c                ^    V^8X  d   \        V P                  ^ ,          4      # \        W4      hrj   )airyaiprimer2   r
   rL   s   &&r5   rN   airyai.fdiff  '    q=tyy|,,$T44r9   c           	        V ^ 8  d   \         P                  # \        V4      p\        V4      ^8  EdA   VR,          p\	        ^4      V,          V ) ,          \	        ^4      V,          V ^,           ,          ,          \        \        V \        ^^4      ,          \        ^^4      ,           ,          4      ,          \        V 4      ,          \        V ^,          \        ^^4      ,           4      ,          \        \        V \        ^^4      ,          \        ^^4      ,           ,          4      \        V ^,           4      ,          \        V ^,          \        ^^4      ,           4      ,          ,          V,          # \         P                  ^\        ^^4      ,          \        ,          ,          \        V \         P                  ,           \        ^4      ,          4      ,          \        \        ^^4      \        ,          V \         P                  ,           ,          4      ,          \        V 4      ,          \	        ^4      V,          V ,          ,          # r  )r   r   r   lenr   r   r   r   r   r'   r   r   re   previous_termsr   s   &&* r5   taylor_termairyai.taylor_term  s    q566M
A>"Q&"2&aqb)4719A*>>s2qRSUVGWZbcdfgZhGhCi?jjktuvkwwacHQN23458Qx1~=MPXYZ\]P^=^9_5`ajklopkpaq5qrwxyz{x{  G  HI  KL  M  yM  sN  6NO RSS T q(1a.034uagqt^7LLsS[\]_`SabdSdfghihmhmfmSnOoo!!%(,Q	A~6 7r9   c                   \        ^^4      p\        ^^4      p\        V) \        ^^4      4      p\        V4      P                  '       dC   V\	        V) 4      ,          \        V) WE,          4      \        W4V,          4      ,           ,          # R# rk   Nr   r   r#   ro   r    r]   r4   rC   rv   otttrf   s   &&,   r5   r   airyai._eval_rewrite_as_besselj  so    a^a^HQN#a5dA2h;'2#rt"4wra47H"HII r9   c                   \        ^^4      p\        ^^4      p\        V\        ^^4      4      p\        V4      P                  '       dB   V\	        V4      ,          \        V) WE,          4      \        W4V,          4      ,
          ,          # V\        WS4      \        V) WE,          4      ,          V\        WS) 4      ,          \        W4V,          4      ,          ,
          ,          # rj   r   r   r#   rm   r    r^   r  s   &&,   r5   r   airyai._eval_rewrite_as_besseli  s    a^a^8Aq>"a5d1g:"bd!3gbQ$6G!GHHs1z'2#rt"44qQ}WRTUQUEV7VVWWr9   c           	        \         P                  ^\        ^^4      ,          \        \        ^^4      4      ,          ,          pV\	        ^^4      \        \        ^^4      4      ,          ,          pV\        . \        ^^4      .V^,          ^	,          4      ,          V\        . \        ^^4      .V^,          ^	,          4      ,          ,
          # r  )r   r   r   r'   r!   r*   r4   rC   rv   pf1pf2s   &&,  r5   _eval_rewrite_as_hyperairyai._eval_rewrite_as_hyper  s    eeq(1a.(x1~)>>?41:eHQN334U2A/Aa883rHUVXYNK[]^`a]abc]cAd;dddr9   c                t   V P                   ^ ,          pVP                  p\        V4      ^8X  Ed   VP                  4       p\	        RV.R7      p\	        RV.R7      p\	        RV.R7      p\	        RV.R7      pVP                  WVWH,          ,          V,          ,          4      p	V	Ee   W,          p^V,          P                  '       d   W,          pW,          pW,          pWdV,          ,          V,          Wg,          WGV,          ,          ,          ,          p
WVV,          ,          WGV,          ,          ,          p\        P                  V
\        P                  ,           \        V4      ,          V
\        P                  ,
          \        ^4      ,          \        V4      ,          ,
          ,          # R# R# R# r   r   )excludedmr   N)r2   free_symbolsr  popr   matchr[   r   r   r   r  r    airybir4   rp   r   symbsrC   r   r  r  r   Mpfnewargs   &,          r5   rn   airyai._eval_expand_func  s?   iil  u:?		AS1#&AS1#&AS1#&AS1#&A		!qtVaK-(A}D aC###AAAd(Q!$qS/:BAXaC0F66b155j&.%@BJPTUVPWCWX^_eXfCf%fgg $	  r9   r?   Nrj   ry   rz   r{   r|   r}   nargs
unbranchedr   rD   rN   staticmethodr   r  r   r   r  rn   r   r   r   s   @r5   r  r  ^  sk     Vp EJG G5 7  7JXe
h hr9   r  c                   x   a  ] tR tRt o Rt^tRt]R 4       tRR lt	]
]R 4       4       tR tR tR	 tR
 tRtV tR# )r  i
  a  
The Airy function $\operatorname{Bi}$ of the second kind.

Explanation
===========

The Airy function $\operatorname{Bi}(z)$ is defined to be the function
satisfying Airy's differential equation

.. math::
    \frac{\mathrm{d}^2 w(z)}{\mathrm{d}z^2} - z w(z) = 0.

Equivalently, for real $z$

.. math::
    \operatorname{Bi}(z) := \frac{1}{\pi}
             \int_0^\infty
               \exp\left(-\frac{t^3}{3} + z t\right)
               + \sin\left(\frac{t^3}{3} + z t\right) \mathrm{d}t.

Examples
========

Create an Airy function object:

>>> from sympy import airybi
>>> from sympy.abc import z

>>> airybi(z)
airybi(z)

Several special values are known:

>>> airybi(0)
3**(5/6)/(3*gamma(2/3))
>>> from sympy import oo
>>> airybi(oo)
oo
>>> airybi(-oo)
0

The Airy function obeys the mirror symmetry:

>>> from sympy import conjugate
>>> conjugate(airybi(z))
airybi(conjugate(z))

Differentiation with respect to $z$ is supported:

>>> from sympy import diff
>>> diff(airybi(z), z)
airybiprime(z)
>>> diff(airybi(z), z, 2)
z*airybi(z)

Series expansion is also supported:

>>> from sympy import series
>>> series(airybi(z), z, 0, 3)
3**(1/3)*gamma(1/3)/(2*pi) + 3**(2/3)*z*gamma(2/3)/(2*pi) + O(z**3)

We can numerically evaluate the Airy function to arbitrary precision
on the whole complex plane:

>>> airybi(-2).evalf(50)
-0.41230258795639848808323405461146104203453483447240

Rewrite $\operatorname{Bi}(z)$ in terms of hypergeometric functions:

>>> from sympy import hyper
>>> airybi(z).rewrite(hyper)
3**(1/6)*z*hyper((), (4/3,), z**3/9)/gamma(1/3) + 3**(5/6)*hyper((), (2/3,), z**3/9)/(3*gamma(2/3))

See Also
========

airyai: Airy function of the first kind.
airyaiprime: Derivative of the Airy function of the first kind.
airybiprime: Derivative of the Airy function of the second kind.

References
==========

.. [1] https://en.wikipedia.org/wiki/Airy_function
.. [2] https://dlmf.nist.gov/9
.. [3] https://encyclopediaofmath.org/wiki/Airy_functions
.. [4] https://mathworld.wolfram.com/AiryFunctions.html

Tc                R   VP                   '       d   V\        P                  J d   \        P                  # V\        P                  J d   \        P                  # V\        P                  J d   \        P
                  # VP                  '       dC   \        P                  ^\        ^^4      ,          \        \        ^^4      4      ,          ,          # VP                  '       dC   \        P                  ^\        ^^4      ,          \        \        ^^4      4      ,          ,          # R# r  )
r  r   r   r   r   r   rc   r   r   r'   r  s   &&r5   rD   airybi.evalh  s    ===aee|uu

"zz!***vvuu8Aq> 1E(1a.4I IJJ;;;55Ax1~-hq!n0EEFF r9   c                ^    V^8X  d   \        V P                  ^ ,          4      # \        W4      hrj   )airybiprimer2   r
   rL   s   &&r5   rN   airybi.fdiffw  r  r9   c           
     v   V ^ 8  d   \         P                  # \        V4      p\        V4      ^8  Ed/   VR,          p\	        ^4      V,          \        \        \        ^^4      \        ,          V \         P                  ,           ,          4      4      ,          \        V \         P                  ,
          \        ^4      ,          4      ,          V \         P                  ,           \        \        \        ^^4      \        ,          V \         P                  ,           ,          4      4      ,          \        V ^,
          \        ^4      ,          4      ,          ,          V,          # \         P                  \        ^^4      \        ,          ,          \        V \         P                  ,           \        ^4      ,          4      ,          \        \        \        ^^4      \        ,          V \         P                  ,           ,          4      4      ,          \        V 4      ,          \	        ^4      V,          V ,          ,          # r  )r   r   r   r  r   r"   r   r   r   r   r   r   r   r!   r'   r  s   &&* r5   r  airybi.taylor_term}  sw    q566M
A>"Q&"2&Q	CHQN2,=q155y,I(J$KKiYZ]^]b]bYbdefgdhXhNiiaee)s3x1~b/@!aff*/M+N'OOR[]^ab]bdefgdh\hRiikmno p tAqz"}-q155y!A$6F0GG#cRZ[\^_R`acRcefijininenRoNpJqq!!%(,Q	A~6 7r9   c                   \        ^^4      p\        ^^4      p\        V) \        ^^4      4      p\        V4      P                  '       dC   \	        V) ^,          4      \        V) WE,          4      \        W4V,          4      ,
          ,          # R# r  r  r  s   &&,   r5   r   airybi._eval_rewrite_as_besselj  so    a^a^HQN#a51:"bd!3gbQ$6G!GHH r9   c                   \        ^^4      p\        ^^4      p\        V\        ^^4      4      p\        V4      P                  '       dK   \	        V4      \	        ^4      ,          \        V) WE,          4      \        W4V,          4      ,           ,          # \        WS4      p\        WS) 4      p\	        V4      V\        V) WE,          4      ,          W,          \        W4V,          4      ,          ,           ,          # rj   r  r4   rC   rv   r  r  rf   r   r   s   &&,     r5   r   airybi._eval_rewrite_as_besseli  s    a^a^8Aq>"a5747?grc24&872!t;L&LMMA
AAsA8QwsBD11ACqD8I4IIJJr9   c           	        \         P                  \        ^^4      \        \	        ^^4      4      ,          ,          pV\        ^^4      ,          \        \	        ^^4      4      ,          pV\        . \	        ^^4      .V^,          ^	,          4      ,          V\        . \	        ^^4      .V^,          ^	,          4      ,          ,           # r  )r   r   r!   r'   r   r*   r  s   &&,  r5   r  airybi._eval_rewrite_as_hyper  s    eetAqz%A"778Q
lU8Aq>22U2A/Aa883rHUVXYNK[]^`a]abc]cAd;dddr9   c                t   V P                   ^ ,          pVP                  p\        V4      ^8X  Ed   VP                  4       p\	        RV.R7      p\	        RV.R7      p\	        RV.R7      p\	        RV.R7      pVP                  WVWH,          ,          V,          ,          4      p	V	Ee   W,          p^V,          P                  '       d   W,          pW,          pW,          pWdV,          ,          V,          Wg,          WGV,          ,          ,          ,          p
WVV,          ,          WGV,          ,          ,          p\        P                  \        ^4      \        P                  V
,
          ,          \        V4      ,          \        P                  V
,           \        V4      ,          ,           ,          # R# R# R# r  )r2   r  r  r  r   r  r[   r   r   r    r   r  r  r  s   &,          r5   rn   airybi._eval_expand_func  s=   iil  u:?		AS1#&AS1#&AS1#&AS1#&A		!qtVaK-(A}D aC###AAAd(Q!$qS/:BAXaC0F66T!Waeebj%9&.%HAEETVJX^_eXfKf%fgg $	  r9   r?   Nrj   r  r   s   @r5   r  r  
  sk     Xt EJG G5 7  7I	Ke
h hr9   r  c                   d   a  ] tR tRt o Rt^tRt]R 4       tRR lt	R t
R tR tR	 tR
 tRtV tR# )r  i  aI  
The derivative $\operatorname{Ai}^\prime$ of the Airy function of the first
kind.

Explanation
===========

The Airy function $\operatorname{Ai}^\prime(z)$ is defined to be the
function

.. math::
    \operatorname{Ai}^\prime(z) := \frac{\mathrm{d} \operatorname{Ai}(z)}{\mathrm{d} z}.

Examples
========

Create an Airy function object:

>>> from sympy import airyaiprime
>>> from sympy.abc import z

>>> airyaiprime(z)
airyaiprime(z)

Several special values are known:

>>> airyaiprime(0)
-3**(2/3)/(3*gamma(1/3))
>>> from sympy import oo
>>> airyaiprime(oo)
0

The Airy function obeys the mirror symmetry:

>>> from sympy import conjugate
>>> conjugate(airyaiprime(z))
airyaiprime(conjugate(z))

Differentiation with respect to $z$ is supported:

>>> from sympy import diff
>>> diff(airyaiprime(z), z)
z*airyai(z)
>>> diff(airyaiprime(z), z, 2)
z*airyaiprime(z) + airyai(z)

Series expansion is also supported:

>>> from sympy import series
>>> series(airyaiprime(z), z, 0, 3)
-3**(2/3)/(3*gamma(1/3)) + 3**(1/3)*z**2/(6*gamma(2/3)) + O(z**3)

We can numerically evaluate the Airy function to arbitrary precision
on the whole complex plane:

>>> airyaiprime(-2).evalf(50)
0.61825902074169104140626429133247528291577794512415

Rewrite $\operatorname{Ai}^\prime(z)$ in terms of hypergeometric functions:

>>> from sympy import hyper
>>> airyaiprime(z).rewrite(hyper)
3**(1/3)*z**2*hyper((), (5/3,), z**3/9)/(6*gamma(2/3)) - 3**(2/3)*hyper((), (1/3,), z**3/9)/(3*gamma(1/3))

See Also
========

airyai: Airy function of the first kind.
airybi: Airy function of the second kind.
airybiprime: Derivative of the Airy function of the second kind.

References
==========

.. [1] https://en.wikipedia.org/wiki/Airy_function
.. [2] https://dlmf.nist.gov/9
.. [3] https://encyclopediaofmath.org/wiki/Airy_functions
.. [4] https://mathworld.wolfram.com/AiryFunctions.html

Tc                b   VP                   '       dI   V\        P                  J d   \        P                  # V\        P                  J d   \        P                  # VP
                  '       dC   \        P                  ^\        ^^4      ,          \        \        ^^4      4      ,          ,          # R# r  )	r  r   r   r   r   rc   r   r   r'   r  s   &&r5   rD   airyaiprime.eval  sl    ===aee|uu

"vv;;;==Ax1~$5hq!n8M$MNN r9   c                    V^8X  d5   V P                   ^ ,          \        V P                   ^ ,          4      ,          # \        W4      hrj   )r2   r  r
   rL   s   &&r5   rN   airyaiprime.fdiff  4    q=99Q<tyy| 444$T44r9   c                   V P                   ^ ,          P                  V4      p\        V4      ;_uu_ 4        \        P                  ! V^R7      pRRR4       \
        P                  ! XV4      #   + '       g   i     L'; ir   )
derivativeN)r2   r  r-   r,   r  r   r  r4   rf  rC   ress   &&  r5   rd  airyaiprime._eval_evalf!  S    IIaL##D)d^^))A!,C   d++ ^   A..A>	c                    \        ^^4      p\        V) \        ^^4      4      p\        V4      P                  '       d9   V^,          \	        V) W4,          4      \	        W3V,          4      ,
          ,          # R# rH   N)r   r   r#   ro   r]   r4   rC   rv   r  rf   s   &&,  r5   r   $airyaiprime._eval_rewrite_as_besselj'  s^    a^HQN#a5Q3'2#rt,wra4/@@AA r9   c                   \        ^^4      p\        ^^4      pV\        V\        ^^4      4      ,          p\        V4      P                  '       d,   V^,          \	        WE4      \	        V) V4      ,
          ,          # \        V\        ^^4      4      p\        WT4      p\        WT) 4      pW1^,          V,          \	        WDV,          4      ,          V\	        V) WE,          4      ,          ,
          ,          # rj   )r   r   r#   rm   r^   r  s   &&,     r5   r   $airyaiprime._eval_rewrite_as_besseli-  s    a^a^QA''a5Q3'".7B3?:;;Ax1~&AA
AAsAAaqD 11Agrc246H4HHIIr9   c           	        V^,          ^^\        ^^4      ,          ,          \        \        ^^4      4      ,          ,          p^\        ^^4      \        \        ^^4      4      ,          ,          pV\        . \        ^^4      .V^,          ^	,          4      ,          V\        . \        ^^4      .V^,          ^	,          4      ,          ,
          # rG   )r   r'   r!   r*   r  s   &&,  r5   r  "airyaiprime._eval_rewrite_as_hyper9  s    da8Aq>))%A*??@41:eHQN334U2A/Aa883rHUVXYNK[]^`a]abc]cAd;dddr9   c                t   V P                   ^ ,          pVP                  p\        V4      ^8X  Ed   VP                  4       p\	        RV.R7      p\	        RV.R7      p\	        RV.R7      p\	        RV.R7      pVP                  WVWH,          ,          V,          ,          4      p	V	Ee   W,          p^V,          P                  '       d   W,          pW,          pW,          pWg,          WHV,          ,          ,          WdV,          ,          V,          ,          p
WVV,          ,          WHV,          ,          ,          p\        P                  V
\        P                  ,           \        V4      ,          V
\        P                  ,
          \        ^4      ,          \        V4      ,          ,           ,          # R# R# R# r  )r2   r  r  r  r   r  r[   r   r   r   r  r    r  r  s   &,          r5   rn   airyaiprime._eval_expand_func>  s@   iil  u:?		AS1#&AS1#&AS1#&AS1#&A		!qtVaK-(A}D
 aC###AAA$qS/aQ$h]:BAXaC0F66b155j+f2E%EaeeUYZ[U\H\]hio]pHp%pqq $  r9   r?   Nrj   ry   rz   r{   r|   r}   r  r  r   rD   rN   rd  r   r   r  rn   r   r   r   s   @r5   r  r    sT     Ob EJO O5,B
Je
r rr9   r  c                   d   a  ] tR tRt o Rt^tRt]R 4       tRR lt	R t
R tR tR	 tR
 tRtV tR# )r  iX  aR  
The derivative $\operatorname{Bi}^\prime$ of the Airy function of the first
kind.

Explanation
===========

The Airy function $\operatorname{Bi}^\prime(z)$ is defined to be the
function

.. math::
    \operatorname{Bi}^\prime(z) := \frac{\mathrm{d} \operatorname{Bi}(z)}{\mathrm{d} z}.

Examples
========

Create an Airy function object:

>>> from sympy import airybiprime
>>> from sympy.abc import z

>>> airybiprime(z)
airybiprime(z)

Several special values are known:

>>> airybiprime(0)
3**(1/6)/gamma(1/3)
>>> from sympy import oo
>>> airybiprime(oo)
oo
>>> airybiprime(-oo)
0

The Airy function obeys the mirror symmetry:

>>> from sympy import conjugate
>>> conjugate(airybiprime(z))
airybiprime(conjugate(z))

Differentiation with respect to $z$ is supported:

>>> from sympy import diff
>>> diff(airybiprime(z), z)
z*airybi(z)
>>> diff(airybiprime(z), z, 2)
z*airybiprime(z) + airybi(z)

Series expansion is also supported:

>>> from sympy import series
>>> series(airybiprime(z), z, 0, 3)
3**(1/6)/gamma(1/3) + 3**(5/6)*z**2/(6*gamma(2/3)) + O(z**3)

We can numerically evaluate the Airy function to arbitrary precision
on the whole complex plane:

>>> airybiprime(-2).evalf(50)
0.27879516692116952268509756941098324140300059345163

Rewrite $\operatorname{Bi}^\prime(z)$ in terms of hypergeometric functions:

>>> from sympy import hyper
>>> airybiprime(z).rewrite(hyper)
3**(5/6)*z**2*hyper((), (5/3,), z**3/9)/(6*gamma(2/3)) + 3**(1/6)*hyper((), (1/3,), z**3/9)/gamma(1/3)

See Also
========

airyai: Airy function of the first kind.
airybi: Airy function of the second kind.
airyaiprime: Derivative of the Airy function of the first kind.

References
==========

.. [1] https://en.wikipedia.org/wiki/Airy_function
.. [2] https://dlmf.nist.gov/9
.. [3] https://encyclopediaofmath.org/wiki/Airy_functions
.. [4] https://mathworld.wolfram.com/AiryFunctions.html

Tc                   VP                   '       d   V\        P                  J d   \        P                  # V\        P                  J d   \        P                  # V\        P                  J d   \        P
                  # VP                  '       d.   ^\        ^^4      ,          \        \        ^^4      4      ,          # VP                  '       d.   ^\        ^^4      ,          \        \        ^^4      4      ,          # R# r  )	r  r   r   r   r   r   rc   r   r'   r  s   &&r5   rD   airybiprime.eval  s    ===aee|uu

"zz!***vv(1a.(5!Q+@@@;;;hq!n$uXa^'<<< r9   c                    V^8X  d5   V P                   ^ ,          \        V P                   ^ ,          4      ,          # \        W4      hrj   )r2   r  r
   rL   s   &&r5   rN   airybiprime.fdiff  r  r9   c                   V P                   ^ ,          P                  V4      p\        V4      ;_uu_ 4        \        P                  ! V^R7      pRRR4       \
        P                  ! XV4      #   + '       g   i     L'; ir  )r2   r  r-   r,   r  r   r  r  s   &&  r5   rd  airybiprime._eval_evalf  r  r  c                    \        ^^4      pV\        V) \        ^^4      4      ,          p\        V4      P                  '       d6   V) \	        ^4      ,          \        V) V4      \        W44      ,           ,          # R# r  r  r  s   &&,  r5   r   $airybiprime._eval_rewrite_as_besselj  sa    a^aR!Q((a52d1g:"a72>!ABB r9   c                   \        ^^4      p\        ^^4      pV\        V\        ^^4      4      ,          p\        V4      P                  '       d5   V\	        ^4      ,          \        V) V4      \        WE4      ,           ,          # \        V\        ^^4      4      p\        WT4      p\        WT) 4      p\	        V4      V\        V) WE,          4      ,          V^,          V,          \        WDV,          4      ,          ,           ,          # rj   r  r  s   &&,     r5   r   $airybiprime._eval_rewrite_as_besseli  s    a^a^QA''a5T!W9Q'". @AAAx1~&AA
AAsA8q"bd!33ad1fWRA=N6NNOOr9   c           	        V^,          ^\        ^^4      ,          \        \        ^^4      4      ,          ,          p\        ^^4      \        \        ^^4      4      ,          pV\        . \        ^^4      .V^,          ^	,          4      ,          V\        . \        ^^4      .V^,          ^	,          4      ,          ,           # rG   )r!   r'   r   r*   r  s   &&,  r5   r  "airybiprime._eval_rewrite_as_hyper  s    daQ
l5!Q#8891aj5!Q00U2A/Aa883rHUVXYNK[]^`a]abc]cAd;dddr9   c                t   V P                   ^ ,          pVP                  p\        V4      ^8X  Ed   VP                  4       p\	        RV.R7      p\	        RV.R7      p\	        RV.R7      p\	        RV.R7      pVP                  WVWH,          ,          V,          ,          4      p	V	Ee   W,          p^V,          P                  '       d   W,          pW,          pW,          pWg,          WHV,          ,          ,          WdV,          ,          V,          ,          p
WVV,          ,          WHV,          ,          ,          p\        P                  \        ^4      V
\        P                  ,
          ,          \        V4      ,          V
\        P                  ,           \        V4      ,          ,           ,          # R# R# R# r  )r2   r  r  r  r   r  r[   r   r   r    r   r  r  r  s   &,          r5   rn   airybiprime._eval_expand_func  sB   iil  u:?		AS1#&AS1#&AS1#&AS1#&A		!qtVaK-(A}D
 aC###AAA$qS/aQ$h]:BAXaC0F66T!Wb155j%9+f:M%MQSVWV[V[Q[]hio]pPp%pqq $  r9   r?   Nrj   r#  r   s   @r5   r  r  X  sR     Qf EJ= =5,C
Pe
r rr9   r  c                   V   a  ] tR tRt o Rt]R 4       tRR ltR tR t	R t
R tR	tV tR
# )marcumqi  a  
The Marcum Q-function.

Explanation
===========

The Marcum Q-function is defined by the meromorphic continuation of

.. math::
    Q_m(a, b) = a^{- m + 1} \int_{b}^{\infty} x^{m} e^{- \frac{a^{2}}{2} - \frac{x^{2}}{2}} I_{m - 1}\left(a x\right)\, dx

Examples
========

>>> from sympy import marcumq
>>> from sympy.abc import m, a, b
>>> marcumq(m, a, b)
marcumq(m, a, b)

Special values:

>>> marcumq(m, 0, b)
uppergamma(m, b**2/2)/gamma(m)
>>> marcumq(0, 0, 0)
0
>>> marcumq(0, a, 0)
1 - exp(-a**2/2)
>>> marcumq(1, a, a)
1/2 + exp(-a**2)*besseli(0, a**2)/2
>>> marcumq(2, a, a)
1/2 + exp(-a**2)*besseli(0, a**2)/2 + exp(-a**2)*besseli(1, a**2)

Differentiation with respect to $a$ and $b$ is supported:

>>> from sympy import diff
>>> diff(marcumq(m, a, b), a)
a*(-marcumq(m, a, b) + marcumq(m + 1, a, b))
>>> diff(marcumq(m, a, b), b)
-a**(1 - m)*b**m*exp(-a**2/2 - b**2/2)*besseli(m - 1, a*b)

References
==========

.. [1] https://en.wikipedia.org/wiki/Marcum_Q-function
.. [2] https://mathworld.wolfram.com/MarcumQ-Function.html

c                P   V\         P                  J dp   V\         P                  J d%   V\         P                  J d   \         P                  # \        W^,          \         P                  ,          4      \	        V4      ,          # V\         P                  J dJ   V\         P                  J d6   ^^\        V^,          \         P                  ,          4      ,          ,
          # W#8X  d   V\         P                  J dH   ^\        V^,          ) 4      \        ^ V^,          4      ,          ,           \         P                  ,          # V^8X  d   \         P                  \         P                  \        V^,          ) 4      ,          \        ^ V^,          4      ,          ,           \        V^,          ) 4      \        ^V^,          4      ,          ,           # VP                  '       dl   VP                  '       d#   VP                  '       d   \         P                  # \        W^,          \         P                  ,          4      \	        V4      ,          # VP                  '       dJ   VP                  '       d6   ^^\        V^,          \         P                  ,          4      ,          ,
          # R# R# r  )	r   r   r)   r   r'   r   r   r^   rc   )rA   r  rf   r   s   &&&&r5   rD   marcumq.eval-  s   ;AFF{qAFF{vvaA/%(::;1;q3q!taff}----6AEEzCAJAqD)999166AAAvvvadU 3gaA6F FFaQRdUV]^_abdeaeVfIfff999yyyQYYYvvaAaff-a88999q3q!tAFF{++++ #9r9   c                z   V P                   w  r#pV^8X  d-   V\        W#V4      ) \        ^V,           W44      ,           ,          # V^8X  di   WB,          ) W2^,
          ,          ,          \        V^,          V^,          ,           ) ^,          4      ,          \        V^,
          W4,          4      ,          # \	        W4      hrG   )r2   r4  r   r^   r
   )r4   rM   r  rf   r   s   &&   r5   rN   marcumq.fdiffE  s    ))aq=q))GAaC,>>??]TEA!H$adQTkN1,<(==!QS@QQQ$T44r9   c           	     h   ^ RI Hp VP                  R\        \	        R4      P
                  4      4      pV^V,
          ,          V! Wa,          \        V^,          V^,          ,           ) ^,          4      ,          \        V^,
          W&,          4      ,          Wc\        P                  .4      ,          # )r   )Integralre   )
sympy.integrals.integralsr:  getr   r   namer   r^   r   r   )r4   r  rf   r   rv   r:  re   s   &&&&,  r5   _eval_rewrite_as_Integral!marcumq._eval_rewrite_as_IntegralN  s    6JJsE"7"<"A"ABCQU|sQTAqD[>!#344wqsAC7HH1QRQ[Q[J\]^ 	^r9   c           	     (   ^ RI Hp VP                  R\        R4      4      p\	        V^,          V^,          ,           ) ^,          4      V! W#,          V,          \        WbV,          4      ,          V^V,
          \        P                  .4      ,          # )r   )Sumr   )sympy.concrete.summationsrA  r<  r   r   r^   r   r   )r4   r  rf   r   rv   rA  r   s   &&&&,  r5   _eval_rewrite_as_Summarcumq._eval_rewrite_as_SumT  sh    1JJsE#J'QTAqD[>A%&acAXQ3-G!QqSRSR\R\I])^^^r9   c                  a SV8X  d   V^8X  d:   ^\        S^,          ) 4      \        ^ S^,          4      ,          ,           ^,          # VP                  '       d   V^8  d   \        V3R l\	        ^V4       4       4      p\
        P                  \        S^,          ) 4      \        ^ S^,          4      ,          ^,          ,           \        S^,          ) 4      V,          ,           # R# R# R# )rk   c              3   J   <"   T F  p\        VS^,          4      x  K  	  R# 5ir  )r^   ).0r  rf   s   & r5   	<genexpr>3marcumq._eval_rewrite_as_besseli.<locals>.<genexpr>^  s     >+Q1a4((+s    #N)r   r^   rM  sumr   r   r   )r4   r  rf   r   rv   r   s   &&f&, r5   r    marcumq._eval_rewrite_as_besseliY  s    6AvCAJAqD)999Q>>|||Q>%1+>>vvQTE
WQ1-= = AACAJQRNRR !'| r9   c                    \         ;QJ d&    R  V P                   4       F  '       d   K   RM	  RM! R  V P                   4       4      '       d   R# R# )c              3   8   "   T F  qP                   x  K  	  R # 5ir>   )rc   )rG  r   s   & r5   rH  (marcumq._eval_is_zero.<locals>.<genexpr>b  s     0is{{is   FTN)allr2   r3   s   &r5   _eval_is_zeromarcumq._eval_is_zeroa  s3    30dii03330dii000 1r9   r?   NrG   )ry   rz   r{   r|   r}   r   rD   rN   r>  rC  r   rP  r   r   r   s   @r5   r4  r4    s@     .` , ,.5^_
S r9   r4  c                   L   a a ] tR tRt oRtV 3R ltR tRV 3R lltRtVt	V ;t
# )r   ie  ze
Helper function to make the $\mathrm{besseli}(nu, z)$
function tractable for the Gruntz algorithm.

c           
       < ^ RI Hp ^ RIHp V^,          pV\        P
                  \        P                  39   Ed
   V P                  w  r\        V4       U
u. uF  p
V! \        ^V,          ^,
          ^4      V
4      V! \        ^V,          ^,           ^4      V
4      ,          ^V
,          V	\        ^V
,          ^,           ^4      ,          ,          \        V
4      ,          ,          NK  	  pp
\        \        ^,          4      \        V!  ,          V! ^V	\        ^V,          ^,           ^4      ,          ,          V4      ,           # \        SV `=  WW44      # u up
i r
  r  r   r   r   r   r   r   r2   r   r   r   r    r   r   r   r  r4   r   r  re   r   r   r   r  rB   rC   r   r  rJ   s   &&&&&       r5   r  _besseli._eval_aseriesl  s   L,aQZZ!3!344IIEBkpqrksuksfg #8AbD1Ha#8!<_QrTAXq)1>. .12aXacAgq=Q9R0RS\]^S_0_a aks  uA<a)E!A1q!8L4M2Mq,QQQw$Qq77	u   BEc                :    \        V) 4      \        W4      ,          # r>   )r   r^   r   s   &&&,r5   _eval_rewrite_as_intractable%_besseli._eval_rewrite_as_intractabley  s    A2wwr~%%r9   c                   < V P                   ^ ,          P                  V^ 4      pVP                  '       d-   V P                  ! V P                   !  pVP	                  WV4      # \
        SV `  WV4      # r   r2   limitrc   rY  r   r   r4   re   r   r   r   x0rq   rJ   s   &&&&&  r5   r   _besseli._eval_nseries|  ]    YYq\1%:::11499=A??1..w$Q400r9   r?   r   ry   rz   r{   r|   r}   r  rY  r   r   r   r   r   s   @@r5   r   r   e  s     8&1 1r9   r   c                   L   a a ] tR tRt oRtV 3R ltR tRV 3R lltRtVt	V ;t
# )r$  i  ze
Helper function to make the $\mathrm{besselk}(nu, z)$
function tractable for the Gruntz algorithm.

c           
       < ^ RI Hp ^ RIHp V^,          pV\        P
                  \        P                  39   Ed
   V P                  w  r\        V4       U
u. uF  p
V! \        ^V,          ^,
          ^4      V
4      V! \        ^V,          ^,           ^4      V
4      ,          RV
,          V	\        ^V
,          ^,           ^4      ,          ,          \        V
4      ,          ,          NK  	  pp
\        \        ^,          4      \        V!  ,          V! ^V	\        ^V,          ^,           ^4      ,          ,          V4      ,           # \        SV `=  WW44      # u up
i r0  rT  rU  s   &&&&&       r5   r  _besselk._eval_aseries  s    L,aQZZ!3!344IIEBlqrsltvltgh #8AbD1Ha#8!<_QrTAXq)1>. .13q	!hqsQwPQ>R:S0ST]^_T`0`b blt  vA<a)E!A1q!8L4M2Mq,QQQw$Qq77	vrW  c                8    \        V4      \        W4      ,          # r>   )r   r  r   s   &&&,r5   rY  %_besselk._eval_rewrite_as_intractable  s    1vgbn$$r9   c                   < V P                   ^ ,          P                  V^ 4      pVP                  '       d-   V P                  ! V P                   !  pVP	                  WV4      # \
        SV `  WV4      # r   r\  r^  s   &&&&&  r5   r   _besselk._eval_nseries  ra  r9   r?   r   rb  r   s   @@r5   r$  r$    s     8%1 1r9   r$  N)r     )X	functoolsr   
sympy.corer   sympy.core.addr   sympy.core.cacher   sympy.core.exprr   sympy.core.functionr	   r
   r   sympy.core.logicr   r   sympy.core.numbersr   r   r   sympy.core.powerr   sympy.core.symbolr   r   r   sympy.core.sympifyr   r  r   r   (sympy.functions.elementary.trigonometricr   r   r   r   #sympy.functions.elementary.integersr   &sympy.functions.elementary.exponentialr   r   (sympy.functions.elementary.miscellaneousr   r    r!   $sympy.functions.elementary.complexesr"   r#   r$   r%   r&   'sympy.functions.special.gamma_functionsr'   r(   r)   sympy.functions.special.hyperr*   sympy.polys.orthopolysr+   r  r,   r-   r/   r]   r   r^   r  r4  r6  rB  rD  rS  rU  ra   rb   ru  r_   r`   r  r  r  r  r  r  r4  r   r$  r?   r9   r5   <module>r~     s      $   M M 0 . .   @ @ & O G G 7 ; E E V V N N / 6 C  C LmDj mD`YDj YDxf8j f8R~8j ~8B+Bj +B\,Bj ,B^2* 28J
.U;	 U;p?;	 ?;D6;- 6;r5-
 5-p5-
 5-pQh# #6ihX ihXnhX nhbZr( Zrzar( arHgo gR1 1>1 1r9   