
    \h                        S r SSKJr  SSKJrJr  SSKJr  SSKJ	r	  SSK
JrJrJr  SSKJr  SSKJr  SS	KJr  SS
KJr  SSKJrJr  SSKJr  SSKJr  SSKJrJrJ r J!r!J"r"J#r#J$r$J%r%  \	" S5      r& " S S\5      r' " S S\'5      r(S r) " S S\'5      r* " S S\'5      r+ " S S\'5      r, " S S\5      r- " S S\5      r. " S S \'5      r/ " S! S"\5      r0 " S# S$\'5      r1 " S% S&\'5      r2 " S' S(\'5      r3 " S) S*\'5      r4g+),z
This module mainly implements special orthogonal polynomials.

See also functions.combinatorial.numbers which contains some
combinatorial polynomials.

    )Rational)DefinedFunctionArgumentIndexError)S)Dummy)binomial	factorialRisingFactorial)re)exp)floor)sqrt)cossec)gamma)hyper)chebyshevt_polychebyshevu_polygegenbauer_polyhermite_polyhermite_prob_polyjacobi_polylaguerre_polylegendre_polyxc                   .    \ rS rSrSr\S 5       rS rSrg)OrthogonalPolynomial   z+Base class for orthogonal polynomials.
    c                     UR                   (       a:  US:  a3  U R                  [        U5      [        5      R	                  [        U5      $ g g )Nr   )
is_integer_ortho_polyint_xsubsclsnr   s      [/var/www/auris/envauris/lib/python3.13/site-packages/sympy/functions/special/polynomials.py_eval_at_order#OrthogonalPolynomial._eval_at_order    s8    <<AF??3q62.33B:: #<    c                 v    U R                  U R                  S   U R                  S   R                  5       5      $ )Nr      )funcargs	conjugate)selfs    r(   _eval_conjugate$OrthogonalPolynomial._eval_conjugate%   s,    yy1tyy|'='='?@@r+    N)	__name__
__module____qualname____firstlineno____doc__classmethodr)   r2   __static_attributes__r4   r+   r(   r   r      s!     ; ;Ar+   r   c                   D    \ rS rSrSr\S 5       rS
S jrS rS r	S r
Srg	)jacobi-   a  
Jacobi polynomial $P_n^{\left(\alpha, \beta\right)}(x)$.

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

``jacobi(n, alpha, beta, x)`` gives the $n$th Jacobi polynomial
in $x$, $P_n^{\left(\alpha, \beta\right)}(x)$.

The Jacobi polynomials are orthogonal on $[-1, 1]$ with respect
to the weight $\left(1-x\right)^\alpha \left(1+x\right)^\beta$.

Examples
========

>>> from sympy import jacobi, S, conjugate, diff
>>> from sympy.abc import a, b, n, x

>>> jacobi(0, a, b, x)
1
>>> jacobi(1, a, b, x)
a/2 - b/2 + x*(a/2 + b/2 + 1)
>>> jacobi(2, a, b, x)
a**2/8 - a*b/4 - a/8 + b**2/8 - b/8 + x**2*(a**2/8 + a*b/4 + 7*a/8 + b**2/8 + 7*b/8 + 3/2) + x*(a**2/4 + 3*a/4 - b**2/4 - 3*b/4) - 1/2

>>> jacobi(n, a, b, x)
jacobi(n, a, b, x)

>>> jacobi(n, a, a, x)
RisingFactorial(a + 1, n)*gegenbauer(n,
    a + 1/2, x)/RisingFactorial(2*a + 1, n)

>>> jacobi(n, 0, 0, x)
legendre(n, x)

>>> jacobi(n, S(1)/2, S(1)/2, x)
RisingFactorial(3/2, n)*chebyshevu(n, x)/factorial(n + 1)

>>> jacobi(n, -S(1)/2, -S(1)/2, x)
RisingFactorial(1/2, n)*chebyshevt(n, x)/factorial(n)

>>> jacobi(n, a, b, -x)
(-1)**n*jacobi(n, b, a, x)

>>> jacobi(n, a, b, 0)
gamma(a + n + 1)*hyper((-n, -b - n), (a + 1,), -1)/(2**n*factorial(n)*gamma(a + 1))
>>> jacobi(n, a, b, 1)
RisingFactorial(a + 1, n)/factorial(n)

>>> conjugate(jacobi(n, a, b, x))
jacobi(n, conjugate(a), conjugate(b), conjugate(x))

>>> diff(jacobi(n,a,b,x), x)
(a/2 + b/2 + n/2 + 1/2)*jacobi(n - 1, a + 1, b + 1, x)

See Also
========

gegenbauer,
chebyshevt_root, chebyshevu, chebyshevu_root,
legendre, assoc_legendre,
hermite, hermite_prob,
laguerre, assoc_laguerre,
sympy.polys.orthopolys.jacobi_poly,
sympy.polys.orthopolys.gegenbauer_poly
sympy.polys.orthopolys.chebyshevt_poly
sympy.polys.orthopolys.chebyshevu_poly
sympy.polys.orthopolys.hermite_poly
sympy.polys.orthopolys.legendre_poly
sympy.polys.orthopolys.laguerre_poly

References
==========

.. [1] https://en.wikipedia.org/wiki/Jacobi_polynomials
.. [2] https://mathworld.wolfram.com/JacobiPolynomial.html
.. [3] https://functions.wolfram.com/Polynomials/JacobiP/

c                    X#:X  a  U[        SS5      :X  a2  [        [        R                  U5      [	        U5      -  [        X5      -  $ UR                  (       a  [        X5      $ U[        R                  :X  a8  [        S[        R                  -  U5      [	        US-   5      -  [        X5      -  $ [        US-   U5      [        SU-  S-   U5      -  [        X[        R                  -   U5      -  $ X2* :X  aE  [        X-   S-   5      [        US-   5      -  SU-   US-  -  -  SU-
  US-  -  -  [        X* U5      -  $ UR                  (       Gd0  UR                  5       (       a!  [        R                  U-  [        XX$* 5      -  $ UR                  (       aK  SU* -  [        X!-   S-   5      -  [        US-   5      [	        U5      -  -  [!        U* U-
  U* /US-   /S5      -  $ U[        R"                  :X  a  [        US-   U5      [	        U5      -  $ U[        R$                  L a[  UR&                  (       aI  X#-   SU-  -   R(                  (       a  [+        S5      e[        X#-   U-   S-   U5      [        R$                  -  $ g g [-        XX45      $ )N      r-   z,Error. a + b + 2*n should not be an integer.)r   r
   r   Halfr	   
chebyshevtis_zerolegendre
chebyshevu
gegenbauerr   assoc_legendre	is_Numbercould_extract_minus_signNegativeOner=   r   OneInfinityis_positiver    
ValueErrorr   )r&   r'   abr   s        r(   evaljacobi.eval~   sE    6HRO#&qvvq1IaL@:aCSSS~%aff&qx3iA6FFTUIYYY&q1ua0?1Q37A3NNQ[\]cdcici_iklQmmm"W#eAEl2a!eqs^Cq1uPQRSPSnTWefgikmnWooo{{{ ))++}}a'&q"*===yyQB%	"22eAElYq\6QRrAvrlQUGR89 :AEEz&q1ua09Q<??ajj==!//()WXX*1519q=!<qzzII	 ! ! qQ**r+   c                 J   SSK Jn  US:X  a  [        X5      eUS:X  a  U R                  u  p4pV[	        S5      nSXE-   U-   U-   S-   -  nXE-   SU-  -   S-   [        XW-   S-   X7-
  5      -  X7-
  [        XE-   U-   S-   X7-
  5      -  -  n	U" U[        X4XV5      U	[        XtXV5      -  -   -  USUS-
  45      $ US:X  a  U R                  u  p4pV[	        S5      nSXE-   U-   U-   S-   -  nSX7-
  -  XE-   SU-  -   S-   [        XG-   S-   X7-
  5      -  X7-
  [        XE-   U-   S-   X7-
  5      -  -  -  n	U" U[        X4XV5      U	[        XtXV5      -  -   -  USUS-
  45      $ US:X  aB  U R                  u  p4pV[        R                  XE-   U-   S-   -  [        US-
  US-   US-   U5      -  $ [        X5      e)	Nr   Sumr-   rA   krB   r@      )	sympy.concrete.summationsrW   r   r/   r   r
   r=   r   rC   )
r1   argindexrW   r'   rQ   rR   r   rX   f1f2s
             r(   fdiffjacobi.fdiff   s   1q=$T44]JA!c
Aaeai!ma'(B51Q3;?oaeai&GGE_QUQY]AEBBDBrVA!/"VA!5G2GGH1aQRUVQV-XX]JA!c
Aaeai!ma'(B151Q3;?oaeaiQRQV6W"WE_QUQY]AEBB#D EBrVA!/"VA!5G2GGH1aQRUVQV-XX]JA!66QUQY]+fQUAE1q5!.LLL$T44r+   c                 J   SSK Jn  UR                  (       d  UR                  SL a  [	        S5      e[        S5      n[        U* U5      [        X#-   U-   S-   U5      -  [        X'-   S-   X-
  5      -  [        U5      -  SU-
  S-  U-  -  nS[        U5      -  U" XSU45      -  $ )Nr   rV   F*Error: n should be a non-negative integer.rX   r-   rA   )rZ   rW   is_negativer    rP   r   r
   r	   )	r1   r'   rQ   rR   r   kwargsrW   rX   kerns	            r(   _eval_rewrite_as_Sumjacobi._eval_rewrite_as_Sum   s    1==ALLE1IJJ#JA&Q)JJ_]^]bef]fhihmMnn!!"Q	A~.9Q<#d1I"666r+   c                 *    U R                   " XX440 UD6$ Nre   )r1   r'   rQ   rR   r   rc   s         r(   _eval_rewrite_as_polynomial"jacobi._eval_rewrite_as_polynomial   s     ((q>v>>r+   c                     U R                   u  pp4U R                  XR                  5       UR                  5       UR                  5       5      $ rh   r/   r.   r0   )r1   r'   rQ   rR   r   s        r(   r2   jacobi._eval_conjugate   s4    YY
ayyKKM1;;=!++-HHr+   r4   N)rY   r5   r6   r7   r8   r9   r:   rS   r^   re   rj   r2   r;   r4   r+   r(   r=   r=   -   s3    N` #+ #+J587?
Ir+   r=   c                     [        S5      X-   S-   -  [        X-   S-   5      [        X-   S-   5      -  -  SU -  U-   U-   S-   -  [        U 5      [        X-   U-   S-   5      -  -  n[        XX#5      [	        U5      -  $ )a  
Jacobi polynomial $P_n^{\left(\alpha, \beta\right)}(x)$.

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

``jacobi_normalized(n, alpha, beta, x)`` gives the $n$th
Jacobi polynomial in $x$, $P_n^{\left(\alpha, \beta\right)}(x)$.

The Jacobi polynomials are orthogonal on $[-1, 1]$ with respect
to the weight $\left(1-x\right)^\alpha \left(1+x\right)^\beta$.

This functions returns the polynomials normilzed:

.. math::

    \int_{-1}^{1}
      P_m^{\left(\alpha, \beta\right)}(x)
      P_n^{\left(\alpha, \beta\right)}(x)
      (1-x)^{\alpha} (1+x)^{\beta} \mathrm{d}x
    = \delta_{m,n}

Examples
========

>>> from sympy import jacobi_normalized
>>> from sympy.abc import n,a,b,x

>>> jacobi_normalized(n, a, b, x)
jacobi(n, a, b, x)/sqrt(2**(a + b + 1)*gamma(a + n + 1)*gamma(b + n + 1)/((a + b + 2*n + 1)*factorial(n)*gamma(a + b + n + 1)))

Parameters
==========

n : integer degree of polynomial

a : alpha value

b : beta value

x : symbol

See Also
========

gegenbauer,
chebyshevt_root, chebyshevu, chebyshevu_root,
legendre, assoc_legendre,
hermite, hermite_prob,
laguerre, assoc_laguerre,
sympy.polys.orthopolys.jacobi_poly,
sympy.polys.orthopolys.gegenbauer_poly
sympy.polys.orthopolys.chebyshevt_poly
sympy.polys.orthopolys.chebyshevu_poly
sympy.polys.orthopolys.hermite_poly
sympy.polys.orthopolys.legendre_poly
sympy.polys.orthopolys.laguerre_poly

References
==========

.. [1] https://en.wikipedia.org/wiki/Jacobi_polynomials
.. [2] https://mathworld.wolfram.com/JacobiPolynomial.html
.. [3] https://functions.wolfram.com/Polynomials/JacobiP/

rA   r-   )r   r   r	   r=   r   )r'   rQ   rR   r   nfactors        r(   jacobi_normalizedrr      s    F taeai E!%!)$4uQUQY7G$GHA#'A+/#&/lU1519q=5I&IKG !W--r+   c                   D    \ rS rSrSr\S 5       rS
S jrS rS r	S r
Srg	)rH   i"  a~  
Gegenbauer polynomial $C_n^{\left(\alpha\right)}(x)$.

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

``gegenbauer(n, alpha, x)`` gives the $n$th Gegenbauer polynomial
in $x$, $C_n^{\left(\alpha\right)}(x)$.

The Gegenbauer polynomials are orthogonal on $[-1, 1]$ with
respect to the weight $\left(1-x^2\right)^{\alpha-\frac{1}{2}}$.

Examples
========

>>> from sympy import gegenbauer, conjugate, diff
>>> from sympy.abc import n,a,x
>>> gegenbauer(0, a, x)
1
>>> gegenbauer(1, a, x)
2*a*x
>>> gegenbauer(2, a, x)
-a + x**2*(2*a**2 + 2*a)
>>> gegenbauer(3, a, x)
x**3*(4*a**3/3 + 4*a**2 + 8*a/3) + x*(-2*a**2 - 2*a)

>>> gegenbauer(n, a, x)
gegenbauer(n, a, x)
>>> gegenbauer(n, a, -x)
(-1)**n*gegenbauer(n, a, x)

>>> gegenbauer(n, a, 0)
2**n*sqrt(pi)*gamma(a + n/2)/(gamma(a)*gamma(1/2 - n/2)*gamma(n + 1))
>>> gegenbauer(n, a, 1)
gamma(2*a + n)/(gamma(2*a)*gamma(n + 1))

>>> conjugate(gegenbauer(n, a, x))
gegenbauer(n, conjugate(a), conjugate(x))

>>> diff(gegenbauer(n, a, x), x)
2*a*gegenbauer(n - 1, a + 1, x)

See Also
========

jacobi,
chebyshevt_root, chebyshevu, chebyshevu_root,
legendre, assoc_legendre,
hermite, hermite_prob,
laguerre, assoc_laguerre,
sympy.polys.orthopolys.jacobi_poly
sympy.polys.orthopolys.gegenbauer_poly
sympy.polys.orthopolys.chebyshevt_poly
sympy.polys.orthopolys.chebyshevu_poly
sympy.polys.orthopolys.hermite_poly
sympy.polys.orthopolys.hermite_prob_poly
sympy.polys.orthopolys.legendre_poly
sympy.polys.orthopolys.laguerre_poly

References
==========

.. [1] https://en.wikipedia.org/wiki/Gegenbauer_polynomials
.. [2] https://mathworld.wolfram.com/GegenbauerPolynomial.html
.. [3] https://functions.wolfram.com/Polynomials/GegenbauerC3/

c                    UR                   (       a  [        R                  $ U[        R                  :X  a  [	        X5      $ U[        R
                  :X  a  [        X5      $ U[        R                  :X  a  [        R                  $ UR                  (       Gd  U[        R                  :X  a  [        U5      [        R                  :  S:X  a  [        R                  $ [        [        R                  X!-   -  5      [        [        R                  U-  5      -  [        SU-  U-   5      -  [        SU-  5      [        US-   5      -  -  $ UR                  5       (       a!  [        R                  U-  [!        XU* 5      -  $ UR"                  (       al  SU-  [%        [        R                  5      -  [        U[        R                  U-  -   5      -  [        SU-
  S-  5      [        US-   5      -  [        U5      -  -  $ U[        R
                  :X  a/  [        SU-  U-   5      [        SU-  5      [        US-   5      -  -  $ U[        R&                  L a.  UR(                  (       a  [+        X!5      [        R&                  -  $ g g [-        XU5      $ )NTrA   r-   )rb   r   ZerorC   rF   rM   rG   rL   rJ   r   ComplexInfinityr   Pir   r   rK   rH   rE   r   rN   rO   r
   r   )r&   r'   rQ   r   s       r(   rS   gegenbauer.evalg  s    ==66M ;A>!!%%Za##!--66M{{{AMM!qEAFFNt+,,,ac
Oc!$$q&k9E!A#a%LH!&qseAaCj!8: ;
 ))++}}a'*QA2*>>>yy1tADDz)E!affQh,,??Aqy)E!a%L858CE GAEEzQqS1W~qseAEl)BCCajj==*101::== ! !
 #1++r+   c                    SSK Jn  US:X  a  [        X5      eUS:X  a  U R                  u  p4n[	        S5      nSSSX6-
  -  -   -  Xd-   -  UU-   SU-  -   X6-
  -  -  nSUS-   -  USU-  -   SU-  SU-  -   S-   -  -  SXc-   SU-  -   -  -   nU[        XdU5      -  U[        X4U5      -  -   n	U" XSUS-
  45      $ US:X  a(  U R                  u  p4nSU-  [        US-
  US-   U5      -  $ [        X5      e)Nr   rV   r-   rA   rX   r@   rB   )rZ   rW   r   r/   r   rH   )
r1   r[   rW   r'   rQ   r   rX   factor1factor2rd   s
             r(   r^   gegenbauer.fdiff  s1   1q=$T44]iiGA!c
A1ae},-7A= s=#'(u<. /GQiA!G!ac	A#>?QUQqS[!"G:aA..A!9L1LLDtAE]++]iiGA!Q3z!a%Q222$T44r+   c           	          SSK Jn  [        S5      nSU-  [        X!U-
  5      -  SU-  USU-  -
  -  -  [	        U5      [	        USU-  -
  5      -  -  nU" XvS[        US-  5      45      $ )Nr   rV   rX   r@   rA   )rZ   rW   r   r
   r	   r   )r1   r'   rQ   r   rc   rW   rX   rd   s           r(   re   gegenbauer._eval_rewrite_as_Sum  ss    1#Ja/!U33qsa!A#g6FF1	!ac' 2244Qac
+,,r+   c                 *    U R                   " XU40 UD6$ rh   ri   )r1   r'   rQ   r   rc   s        r(   rj   &gegenbauer._eval_rewrite_as_polynomial       ((q;F;;r+   c                 |    U R                   u  pnU R                  XR                  5       UR                  5       5      $ rh   rm   )r1   r'   rQ   r   s       r(   r2   gegenbauer._eval_conjugate  ,    ))ayyKKM1;;=99r+   r4   NrB   ro   r4   r+   r(   rH   rH   "  s2    BH &, &,P5,-<
:r+   rH   c                   N    \ rS rSrSr\" \5      r\S 5       r	S	S jr
S rS rSrg)
rD   i  a  
Chebyshev polynomial of the first kind, $T_n(x)$.

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

``chebyshevt(n, x)`` gives the $n$th Chebyshev polynomial (of the first
kind) in $x$, $T_n(x)$.

The Chebyshev polynomials of the first kind are orthogonal on
$[-1, 1]$ with respect to the weight $\frac{1}{\sqrt{1-x^2}}$.

Examples
========

>>> from sympy import chebyshevt, diff
>>> from sympy.abc import n,x
>>> chebyshevt(0, x)
1
>>> chebyshevt(1, x)
x
>>> chebyshevt(2, x)
2*x**2 - 1

>>> chebyshevt(n, x)
chebyshevt(n, x)
>>> chebyshevt(n, -x)
(-1)**n*chebyshevt(n, x)
>>> chebyshevt(-n, x)
chebyshevt(n, x)

>>> chebyshevt(n, 0)
cos(pi*n/2)
>>> chebyshevt(n, -1)
(-1)**n

>>> diff(chebyshevt(n, x), x)
n*chebyshevu(n - 1, x)

See Also
========

jacobi, gegenbauer,
chebyshevt_root, chebyshevu, chebyshevu_root,
legendre, assoc_legendre,
hermite, hermite_prob,
laguerre, assoc_laguerre,
sympy.polys.orthopolys.jacobi_poly
sympy.polys.orthopolys.gegenbauer_poly
sympy.polys.orthopolys.chebyshevt_poly
sympy.polys.orthopolys.chebyshevu_poly
sympy.polys.orthopolys.hermite_poly
sympy.polys.orthopolys.hermite_prob_poly
sympy.polys.orthopolys.legendre_poly
sympy.polys.orthopolys.laguerre_poly

References
==========

.. [1] https://en.wikipedia.org/wiki/Chebyshev_polynomial
.. [2] https://mathworld.wolfram.com/ChebyshevPolynomialoftheFirstKind.html
.. [3] https://mathworld.wolfram.com/ChebyshevPolynomialoftheSecondKind.html
.. [4] https://functions.wolfram.com/Polynomials/ChebyshevT/
.. [5] https://functions.wolfram.com/Polynomials/ChebyshevU/

c                 H   UR                   (       d  UR                  5       (       a   [        R                  U-  [	        X* 5      -  $ UR                  5       (       a  [	        U* U5      $ UR
                  (       a-  [        [        R                  [        R                  -  U-  5      $ U[        R                  :X  a  [        R                  $ U[        R                  L a  [        R                  $ g UR                  (       a  U R                  U* U5      $ U R                  X5      $ rh   )rJ   rK   r   rL   rD   rE   r   rC   rw   rM   rN   rb   r)   r%   s      r(   rS   chebyshevt.eval  s    {{ ))++}}a'*Q*;;;))++!1"a((yy166ADD=1,--AEEzuuajjzz! ! }}))1"a00))!//r+   c                     US:X  a  [        X5      eUS:X  a   U R                  u  p#U[        US-
  U5      -  $ [        X5      eNr-   rA   )r   r/   rG   r1   r[   r'   r   s       r(   r^   chebyshevt.fdiff  sG    q=$T44]99DAz!a%+++$T44r+   c           	          SSK Jn  [        S5      n[        USU-  5      US-  S-
  U-  -  X!SU-  -
  -  -  nU" XeS[	        US-  5      45      $ Nr   rV   rX   rA   r-   )rZ   rW   r   r   r   r1   r'   r   rc   rW   rX   rd   s          r(   re   chebyshevt._eval_rewrite_as_Sum%  sX    1#J1Q31a4!8a-/!!A#g,>4Qac
+,,r+   c                 (    U R                   " X40 UD6$ rh   ri   r1   r'   r   rc   s       r(   rj   &chebyshevt._eval_rewrite_as_polynomial+       ((888r+   r4   NrA   )r5   r6   r7   r8   r9   staticmethodr   r!   r:   rS   r^   re   rj   r;   r4   r+   r(   rD   rD     s6    AF /K0 00	5-9r+   rD   c                   N    \ rS rSrSr\" \5      r\S 5       r	S	S jr
S rS rSrg)
rG   i1  a  
Chebyshev polynomial of the second kind, $U_n(x)$.

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

``chebyshevu(n, x)`` gives the $n$th Chebyshev polynomial of the second
kind in x, $U_n(x)$.

The Chebyshev polynomials of the second kind are orthogonal on
$[-1, 1]$ with respect to the weight $\sqrt{1-x^2}$.

Examples
========

>>> from sympy import chebyshevu, diff
>>> from sympy.abc import n,x
>>> chebyshevu(0, x)
1
>>> chebyshevu(1, x)
2*x
>>> chebyshevu(2, x)
4*x**2 - 1

>>> chebyshevu(n, x)
chebyshevu(n, x)
>>> chebyshevu(n, -x)
(-1)**n*chebyshevu(n, x)
>>> chebyshevu(-n, x)
-chebyshevu(n - 2, x)

>>> chebyshevu(n, 0)
cos(pi*n/2)
>>> chebyshevu(n, 1)
n + 1

>>> diff(chebyshevu(n, x), x)
(-x*chebyshevu(n, x) + (n + 1)*chebyshevt(n + 1, x))/(x**2 - 1)

See Also
========

jacobi, gegenbauer,
chebyshevt, chebyshevt_root, chebyshevu_root,
legendre, assoc_legendre,
hermite, hermite_prob,
laguerre, assoc_laguerre,
sympy.polys.orthopolys.jacobi_poly
sympy.polys.orthopolys.gegenbauer_poly
sympy.polys.orthopolys.chebyshevt_poly
sympy.polys.orthopolys.chebyshevu_poly
sympy.polys.orthopolys.hermite_poly
sympy.polys.orthopolys.hermite_prob_poly
sympy.polys.orthopolys.legendre_poly
sympy.polys.orthopolys.laguerre_poly

References
==========

.. [1] https://en.wikipedia.org/wiki/Chebyshev_polynomial
.. [2] https://mathworld.wolfram.com/ChebyshevPolynomialoftheFirstKind.html
.. [3] https://mathworld.wolfram.com/ChebyshevPolynomialoftheSecondKind.html
.. [4] https://functions.wolfram.com/Polynomials/ChebyshevT/
.. [5] https://functions.wolfram.com/Polynomials/ChebyshevU/

c                 "   UR                   (       Gd!  UR                  5       (       a   [        R                  U-  [	        X* 5      -  $ UR                  5       (       aN  U[        R                  :X  a  [        R
                  $ U* S-
  R                  5       (       d  [	        U* S-
  U5      * $ UR                  (       a-  [        [        R                  [        R                  -  U-  5      $ U[        R                  :X  a  [        R                  U-   $ U[        R                  L a  [        R                  $ g UR                  (       a;  U[        R                  :X  a  [        R
                  $ U R                  U* S-
  U5      * $ U R                  X5      $ NrA   )rJ   rK   r   rL   rG   ru   rE   r   rC   rw   rM   rN   rb   r)   r%   s      r(   rS   chebyshevu.evalw  s'   {{{ ))++}}a'*Q*;;;))++%66M"q&::<<&rAvq111yy166ADD=1,--AEEzuuqy ajjzz! ! }}%66M..rAvq999))!//r+   c                     US:X  a  [        X5      eUS:X  a;  U R                  u  p#US-   [        US-   U5      -  U[        X#5      -  -
  US-  S-
  -  $ [        X5      er   )r   r/   rD   rG   r   s       r(   r^   chebyshevu.fdiff  si    q=$T44]99DAUjQ22QA9I5IIaQRdUVhWW$T44r+   c           	          SSK Jn  [        S5      n[        R                  U-  [        X-
  5      -  SU-  USU-  -
  -  -  [        U5      [        USU-  -
  5      -  -  nU" XeS[        US-  5      45      $ Nr   rV   rX   rA   rZ   rW   r   r   rL   r	   r   r   s          r(   re   chebyshevu._eval_rewrite_as_Sum  s    1#J}}a)E# cQ1W%&)21	!ac'8J)JL4Qac
+,,r+   c                 (    U R                   " X40 UD6$ rh   ri   r   s       r(   rj   &chebyshevu._eval_rewrite_as_polynomial  r   r+   r4   Nr   )r5   r6   r7   r8   r9   r   r   r!   r:   rS   r^   re   rj   r;   r4   r+   r(   rG   rG   1  s6    AF /K0 0>	5-9r+   rG   c                   (    \ rS rSrSr\S 5       rSrg)chebyshevt_rooti  a%  
``chebyshev_root(n, k)`` returns the $k$th root (indexed from zero) of
the $n$th Chebyshev polynomial of the first kind; that is, if
$0 \le k < n$, ``chebyshevt(n, chebyshevt_root(n, k)) == 0``.

Examples
========

>>> from sympy import chebyshevt, chebyshevt_root
>>> chebyshevt_root(3, 2)
-sqrt(3)/2
>>> chebyshevt(3, chebyshevt_root(3, 2))
0

See Also
========

jacobi, gegenbauer,
chebyshevt, chebyshevu, chebyshevu_root,
legendre, assoc_legendre,
hermite, hermite_prob,
laguerre, assoc_laguerre,
sympy.polys.orthopolys.jacobi_poly
sympy.polys.orthopolys.gegenbauer_poly
sympy.polys.orthopolys.chebyshevt_poly
sympy.polys.orthopolys.chebyshevu_poly
sympy.polys.orthopolys.hermite_poly
sympy.polys.orthopolys.hermite_prob_poly
sympy.polys.orthopolys.legendre_poly
sympy.polys.orthopolys.laguerre_poly
c                     SU::  a  X!:  d  [        SU< SU< 35      e[        [        R                  SU-  S-   -  SU-  -  5      $ )Nr   must have 0 <= k < n, got k = 	 and n = rA   r-   rP   r   r   rw   r&   r'   rX   s      r(   rS   chebyshevt_root.eval  sH    aae+,a1 2 21441q>1Q3'((r+   r4   Nr5   r6   r7   r8   r9   r:   rS   r;   r4   r+   r(   r   r     s    @ ) )r+   r   c                   (    \ rS rSrSr\S 5       rSrg)chebyshevu_rooti  a  
``chebyshevu_root(n, k)`` returns the $k$th root (indexed from zero) of the
$n$th Chebyshev polynomial of the second kind; that is, if $0 \le k < n$,
``chebyshevu(n, chebyshevu_root(n, k)) == 0``.

Examples
========

>>> from sympy import chebyshevu, chebyshevu_root
>>> chebyshevu_root(3, 2)
-sqrt(2)/2
>>> chebyshevu(3, chebyshevu_root(3, 2))
0

See Also
========

chebyshevt, chebyshevt_root, chebyshevu,
legendre, assoc_legendre,
hermite, hermite_prob,
laguerre, assoc_laguerre,
sympy.polys.orthopolys.jacobi_poly
sympy.polys.orthopolys.gegenbauer_poly
sympy.polys.orthopolys.chebyshevt_poly
sympy.polys.orthopolys.chebyshevu_poly
sympy.polys.orthopolys.hermite_poly
sympy.polys.orthopolys.hermite_prob_poly
sympy.polys.orthopolys.legendre_poly
sympy.polys.orthopolys.laguerre_poly
c                     SU::  a  X!:  d  [        SU< SU< 35      e[        [        R                  US-   -  US-   -  5      $ )Nr   r   r   r-   r   r   s      r(   rS   chebyshevu_root.eval  sD    aae+,a1 2 2144Q<Q'((r+   r4   Nr   r4   r+   r(   r   r     s    @ ) )r+   r   c                   N    \ rS rSrSr\" \5      r\S 5       r	S	S jr
S rS rSrg)
rF   i  a  
``legendre(n, x)`` gives the $n$th Legendre polynomial of $x$, $P_n(x)$

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

The Legendre polynomials are orthogonal on $[-1, 1]$ with respect to
the constant weight 1. They satisfy $P_n(1) = 1$ for all $n$; further,
$P_n$ is odd for odd $n$ and even for even $n$.

Examples
========

>>> from sympy import legendre, diff
>>> from sympy.abc import x, n
>>> legendre(0, x)
1
>>> legendre(1, x)
x
>>> legendre(2, x)
3*x**2/2 - 1/2
>>> legendre(n, x)
legendre(n, x)
>>> diff(legendre(n,x), x)
n*(x*legendre(n, x) - legendre(n - 1, x))/(x**2 - 1)

See Also
========

jacobi, gegenbauer,
chebyshevt, chebyshevt_root, chebyshevu, chebyshevu_root,
assoc_legendre,
hermite, hermite_prob,
laguerre, assoc_laguerre,
sympy.polys.orthopolys.jacobi_poly
sympy.polys.orthopolys.gegenbauer_poly
sympy.polys.orthopolys.chebyshevt_poly
sympy.polys.orthopolys.chebyshevu_poly
sympy.polys.orthopolys.hermite_poly
sympy.polys.orthopolys.hermite_prob_poly
sympy.polys.orthopolys.legendre_poly
sympy.polys.orthopolys.laguerre_poly

References
==========

.. [1] https://en.wikipedia.org/wiki/Legendre_polynomial
.. [2] https://mathworld.wolfram.com/LegendrePolynomial.html
.. [3] https://functions.wolfram.com/Polynomials/LegendreP/
.. [4] https://functions.wolfram.com/Polynomials/LegendreP2/

c                    UR                   (       Gd3  UR                  5       (       a   [        R                  U-  [	        X* 5      -  $ UR                  5       (       a7  U* S-
  R                  5       (       d  [	        U* [        R
                  -
  U5      $ UR                  (       aY  [        [        R                  5      [        [        R                  US-  -
  5      [        [        R
                  US-  -   5      -  -  $ U[        R
                  :X  a  [        R
                  $ U[        R                  L a  [        R                  $ g UR                  (       a  U* [        R
                  -
  nU R                  X5      $ r   )rJ   rK   r   rL   rF   rM   rE   r   rw   r   rC   rN   rb   r)   r%   s      r(   rS   legendre.eval=  s   {{{ ))++}}a'(1b/99))++QBF3T3T3V3VQUU
A..yyADDz5!A##6uQUUQqS[7I#IJJaeeuuajjzz! !
 }}BJ%%a++r+   c                     US:X  a  [        X5      eUS:X  a7  U R                  u  p#X#S-  S-
  -  U[        X#5      -  [        US-
  U5      -
  -  $ [        X5      er   )r   r/   rF   r   s       r(   r^   legendre.fdiffU  sa    q=$T44] 99DAdQh<8A>!1HQUA4F!FGG$T44r+   c                     SSK Jn  [        S5      n[        R                  U-  [        X5      S-  -  SU-   S-  X-
  -  -  SU-
  S-  U-  -  nU" XeSU45      $ r   )rZ   rW   r   r   rL   r   r   s          r(   re   legendre._eval_rewrite_as_Summ  sb    1#J}}a 11AE192FFQPQ	TU~U4Q##r+   c                 (    U R                   " X40 UD6$ rh   ri   r   s       r(   rj   $legendre._eval_rewrite_as_polynomials  r   r+   r4   Nr   )r5   r6   r7   r8   r9   r   r   r!   r:   rS   r^   re   rj   r;   r4   r+   r(   rF   rF     s5    3j }-K, ,.50$9r+   rF   c                   T    \ rS rSrSr\S 5       r\S 5       rSS jrS r	S r
S rS	rg
)rI   iy  a  
``assoc_legendre(n, m, x)`` gives $P_n^m(x)$, where $n$ and $m$ are
the degree and order or an expression which is related to the nth
order Legendre polynomial, $P_n(x)$ in the following manner:

.. math::
    P_n^m(x) = (-1)^m (1 - x^2)^{\frac{m}{2}}
               \frac{\mathrm{d}^m P_n(x)}{\mathrm{d} x^m}

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

Associated Legendre polynomials are orthogonal on $[-1, 1]$ with:

- weight $= 1$            for the same $m$ and different $n$.
- weight $= \frac{1}{1-x^2}$   for the same $n$ and different $m$.

Examples
========

>>> from sympy import assoc_legendre
>>> from sympy.abc import x, m, n
>>> assoc_legendre(0,0, x)
1
>>> assoc_legendre(1,0, x)
x
>>> assoc_legendre(1,1, x)
-sqrt(1 - x**2)
>>> assoc_legendre(n,m,x)
assoc_legendre(n, m, x)

See Also
========

jacobi, gegenbauer,
chebyshevt, chebyshevt_root, chebyshevu, chebyshevu_root,
legendre,
hermite, hermite_prob,
laguerre, assoc_laguerre,
sympy.polys.orthopolys.jacobi_poly
sympy.polys.orthopolys.gegenbauer_poly
sympy.polys.orthopolys.chebyshevt_poly
sympy.polys.orthopolys.chebyshevu_poly
sympy.polys.orthopolys.hermite_poly
sympy.polys.orthopolys.hermite_prob_poly
sympy.polys.orthopolys.legendre_poly
sympy.polys.orthopolys.laguerre_poly

References
==========

.. [1] https://en.wikipedia.org/wiki/Associated_Legendre_polynomials
.. [2] https://mathworld.wolfram.com/LegendrePolynomial.html
.. [3] https://functions.wolfram.com/Polynomials/LegendreP/
.. [4] https://functions.wolfram.com/Polynomials/LegendreP2/

c                     [        U[        SS9R                  [        U45      n[        R                  U-  S[        S-  -
  [        US5      -  -  UR                  5       -  $ )NT)polysr-   rA   )r   r#   diffr   rL   r   as_expr)r&   r'   mPs       r(   r)   assoc_legendre._eval_at_order  sQ    !Rt,112q':}}a1r1u9x1~"==		KKr+   c                    UR                  5       (       a>  [        R                  U* -  [        X!-   5      [        X-
  5      -  -  [	        X* U5      -  $ US:X  a  [        X5      $ US:X  aH  SU-  [        [        R                  5      -  [        SU-
  U-
  S-  5      [        SX!-
  S-  -
  5      -  -  $ UR                  (       a  UR                  (       a  UR                  (       a  UR                  (       a  UR                  (       a  [        U < SU< S35      e[        U5      U:  a  [        U < SU< SU< S35      eU R                  [        U5      [        [        U5      5      5      R!                  ["        U5      $ g g g g )Nr   rA   r-   z. : 1st index must be nonnegative integer (got )z0 : abs('2nd index') must be <= '1st index' (got z, )rK   r   rL   r	   rI   rF   r   rw   r   rJ   r    rb   rP   absr)   r"   r$   r#   )r&   r'   r   r   s       r(   rS   assoc_legendre.eval  s-   %%''==A2&)AE*:9QU;K*KL~^_acefOggg6A>!6a4QTT
?eQUQYM&:5aeQY;O&OPP;;1;;1<<ALL}} Z]_`!abb1vz `cefhi!jkk%%c!fc#a&k:??AFF =I<;;r+   c                     US:X  a  [        X5      eUS:X  a  [        X5      eUS:X  aA  U R                  u  p#nSUS-  S-
  -  XB-  [        X#U5      -  X2-   [        US-
  X45      -  -
  -  $ [        X5      e)Nr-   rA   rB   )r   r/   rI   )r1   r[   r'   r   r   s        r(   r^   assoc_legendre.fdiff  s    q=$T44]$T44] iiGA!adQh<^A!%<!<~VWZ[V[]^Gb?b!bcc$T44r+   c           
      f   SSK Jn  [        S5      n[        SU-  SU-  -
  5      SU-  [        X-
  5      -  [        U5      -  [        USU-  -
  U-
  5      -  -  [        R
                  U-  -  X1U-
  SU-  -
  -  -  nSUS-  -
  US-  -  U" XvS[        X-
  [        R                  -  5      45      -  $ r   )rZ   rW   r   r	   r   rL   r   rC   )r1   r'   r   r   rc   rW   rX   rd   s           r(   re   #assoc_legendre._eval_rewrite_as_Sum  s    1#J1qs#QT)AE*:%:9< &QqS1%&& ''(}}a'7889EAaCK8HIAqDAaC 3tE15!&&.4I-J#KKKr+   c                 *    U R                   " XU40 UD6$ rh   ri   )r1   r'   r   r   rc   s        r(   rj   *assoc_legendre._eval_rewrite_as_polynomial  r   r+   c                 |    U R                   u  pnU R                  XR                  5       UR                  5       5      $ rh   rm   )r1   r'   r   r   s       r(   r2   assoc_legendre._eval_conjugate  r   r+   r4   Nr   )r5   r6   r7   r8   r9   r:   r)   rS   r^   re   rj   r2   r;   r4   r+   r(   rI   rI   y  sI    8t L L G G 5L<
:r+   rI   c                   T    \ rS rSrSr\" \5      r\S 5       r	S
S jr
S rS rS rSrg	)hermitei  a  
``hermite(n, x)`` gives the $n$th Hermite polynomial in $x$, $H_n(x)$.

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

The Hermite polynomials are orthogonal on $(-\infty, \infty)$
with respect to the weight $\exp\left(-x^2\right)$.

Examples
========

>>> from sympy import hermite, diff
>>> from sympy.abc import x, n
>>> hermite(0, x)
1
>>> hermite(1, x)
2*x
>>> hermite(2, x)
4*x**2 - 2
>>> hermite(n, x)
hermite(n, x)
>>> diff(hermite(n,x), x)
2*n*hermite(n - 1, x)
>>> hermite(n, -x)
(-1)**n*hermite(n, x)

See Also
========

jacobi, gegenbauer,
chebyshevt, chebyshevt_root, chebyshevu, chebyshevu_root,
legendre, assoc_legendre,
hermite_prob,
laguerre, assoc_laguerre,
sympy.polys.orthopolys.jacobi_poly
sympy.polys.orthopolys.gegenbauer_poly
sympy.polys.orthopolys.chebyshevt_poly
sympy.polys.orthopolys.chebyshevu_poly
sympy.polys.orthopolys.hermite_poly
sympy.polys.orthopolys.hermite_prob_poly
sympy.polys.orthopolys.legendre_poly
sympy.polys.orthopolys.laguerre_poly

References
==========

.. [1] https://en.wikipedia.org/wiki/Hermite_polynomial
.. [2] https://mathworld.wolfram.com/HermitePolynomial.html
.. [3] https://functions.wolfram.com/Polynomials/HermiteH/

c                    UR                   (       d  UR                  5       (       a   [        R                  U-  [	        X* 5      -  $ UR
                  (       a?  SU-  [        [        R                  5      -  [        [        R                  U-
  S-  5      -  $ U[        R                  L a  [        R                  $ g UR                  (       a  [        SU-  5      eU R                  X5      $ )NrA   0The index n must be nonnegative integer (got %r))rJ   rK   r   rL   r   rE   r   rw   r   rM   rN   rb   rP   r)   r%   s      r(   rS   hermite.eval&  s    {{ ))++}}a''!R.88yy!td144j(5!%%!)Q+???ajjzz! ! }} FJL L ))!//r+   c                     US:X  a  [        X5      eUS:X  a#  U R                  u  p#SU-  [        US-
  U5      -  $ [        X5      er   )r   r/   r   r   s       r(   r^   hermite.fdiff:  sK    q=$T44]99DAQ3wq1ua((($T44r+   c           
          SSK Jn  [        S5      n[        R                  U-  [        U5      [        USU-  -
  5      -  -  SU-  USU-  -
  -  -  n[        U5      U" XeS[        US-  5      45      -  $ r   r   r   s          r(   re   hermite._eval_rewrite_as_SumE  ss    1#J}}a9Q<	!ac'0B#BCqsaRSTURUgFVV|C!U1Q3Z&8999r+   c                 (    U R                   " X40 UD6$ rh   ri   r   s       r(   rj   #hermite._eval_rewrite_as_polynomialK  r   r+   c                 N    [        S5      U-  [        X[        S5      -  5      -  $ r   )r   hermite_probr   s       r(   _eval_rewrite_as_hermite_prob%hermite._eval_rewrite_as_hermite_probP  s"    AwzLd1gI666r+   r4   Nr   )r5   r6   r7   r8   r9   r   r   r!   r:   rS   r^   re   rj   r   r;   r4   r+   r(   r   r     s:    3j |,K0 0&	5:9
7r+   r   c                   T    \ rS rSrSr\" \5      r\S 5       r	S
S jr
S rS rS rSrg	)r   iT  a  
``hermite_prob(n, x)`` gives the $n$th probabilist's Hermite polynomial
in $x$, $He_n(x)$.

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

The probabilist's Hermite polynomials are orthogonal on $(-\infty, \infty)$
with respect to the weight $\exp\left(-\frac{x^2}{2}\right)$. They are monic
polynomials, related to the plain Hermite polynomials (:py:class:`~.hermite`) by

.. math :: He_n(x) = 2^{-n/2} H_n(x/\sqrt{2})

Examples
========

>>> from sympy import hermite_prob, diff, I
>>> from sympy.abc import x, n
>>> hermite_prob(1, x)
x
>>> hermite_prob(5, x)
x**5 - 10*x**3 + 15*x
>>> diff(hermite_prob(n,x), x)
n*hermite_prob(n - 1, x)
>>> hermite_prob(n, -x)
(-1)**n*hermite_prob(n, x)

The sum of absolute values of coefficients of $He_n(x)$ is the number of
matchings in the complete graph $K_n$ or telephone number, A000085 in the OEIS:

>>> [hermite_prob(n,I) / I**n for n in range(11)]
[1, 1, 2, 4, 10, 26, 76, 232, 764, 2620, 9496]

See Also
========

jacobi, gegenbauer,
chebyshevt, chebyshevt_root, chebyshevu, chebyshevu_root,
legendre, assoc_legendre,
hermite,
laguerre, assoc_laguerre,
sympy.polys.orthopolys.jacobi_poly
sympy.polys.orthopolys.gegenbauer_poly
sympy.polys.orthopolys.chebyshevt_poly
sympy.polys.orthopolys.chebyshevu_poly
sympy.polys.orthopolys.hermite_poly
sympy.polys.orthopolys.hermite_prob_poly
sympy.polys.orthopolys.legendre_poly
sympy.polys.orthopolys.laguerre_poly

References
==========

.. [1] https://en.wikipedia.org/wiki/Hermite_polynomial
.. [2] https://mathworld.wolfram.com/HermitePolynomial.html
c                    UR                   (       d  UR                  5       (       a   [        R                  U-  [	        X* 5      -  $ UR
                  (       a9  [        [        R                  5      [        [        R                  U-
  S-  5      -  $ U[        R                  L a  [        R                  $ g UR                  (       a  [        SU-  5        g U R                  X5      $ )NrA   z'n must be a nonnegative integer, not %r)rJ   rK   r   rL   r   rE   r   rw   r   rM   rN   rb   rP   r)   r%   s      r(   rS   hermite_prob.eval  s    {{))++}}a',q"*===yyADDzE1557a-$888ajjzz! ! }}DqHI))!//r+   c                 d    US:X  a   U R                   u  p#U[        US-
  U5      -  $ [        X5      e)NrA   r-   )r/   r   r   r   s       r(   r^   hermite_prob.fdiff  s5    q=99DA\!A#q)))$T44r+   c           
          SSK Jn  [        S5      n[        R                  * U-  X!SU-  -
  -  -  [        U5      [        USU-  -
  5      -  -  n[        U5      U" XeS[        US-  5      45      -  $ r   )rZ   rW   r   r   rC   r	   r   r   s          r(   re   !hermite_prob._eval_rewrite_as_Sum  sj    1#J!|aAaC%j(IaL9QqsU;K,KL|C!U1Q3Z&8999r+   c                 (    U R                   " X40 UD6$ rh   ri   r   s       r(   rj   (hermite_prob._eval_rewrite_as_polynomial  r   r+   c                 P    [        S5      U* -  [        X[        S5      -  5      -  $ r   )r   r   r   s       r(   _eval_rewrite_as_hermite%hermite_prob._eval_rewrite_as_hermite  s$    Aw!}wqDG)444r+   r4   Nr   )r5   r6   r7   r8   r9   r   r   r!   r:   rS   r^   re   rj   r   r;   r4   r+   r(   r   r   T  s;    7r 01K0 05:9
5r+   r   c                   N    \ rS rSrSr\" \5      r\S 5       r	S	S jr
S rS rSrg)
laguerrei  a  
Returns the $n$th Laguerre polynomial in $x$, $L_n(x)$.

Examples
========

>>> from sympy import laguerre, diff
>>> from sympy.abc import x, n
>>> laguerre(0, x)
1
>>> laguerre(1, x)
1 - x
>>> laguerre(2, x)
x**2/2 - 2*x + 1
>>> laguerre(3, x)
-x**3/6 + 3*x**2/2 - 3*x + 1

>>> laguerre(n, x)
laguerre(n, x)

>>> diff(laguerre(n, x), x)
-assoc_laguerre(n - 1, 1, x)

Parameters
==========

n : int
    Degree of Laguerre polynomial. Must be `n \ge 0`.

See Also
========

jacobi, gegenbauer,
chebyshevt, chebyshevt_root, chebyshevu, chebyshevu_root,
legendre, assoc_legendre,
hermite, hermite_prob,
assoc_laguerre,
sympy.polys.orthopolys.jacobi_poly
sympy.polys.orthopolys.gegenbauer_poly
sympy.polys.orthopolys.chebyshevt_poly
sympy.polys.orthopolys.chebyshevu_poly
sympy.polys.orthopolys.hermite_poly
sympy.polys.orthopolys.hermite_prob_poly
sympy.polys.orthopolys.legendre_poly
sympy.polys.orthopolys.laguerre_poly

References
==========

.. [1] https://en.wikipedia.org/wiki/Laguerre_polynomial
.. [2] https://mathworld.wolfram.com/LaguerrePolynomial.html
.. [3] https://functions.wolfram.com/Polynomials/LaguerreL/
.. [4] https://functions.wolfram.com/Polynomials/LaguerreL3/

c                 d   UR                   SL a  [        S5      eUR                  (       d  UR                  5       (       a6  U* S-
  R                  5       (       d  [	        U5      [        U* S-
  U* 5      -  $ UR                  (       a  [        R                  $ U[        R                  L a  [        R                  $ U[        R                  L a$  [        R                  U-  [        R                  -  $ g UR                  (       a  [	        U5      [        U* S-
  U* 5      -  $ U R                  X5      $ )NFError: n should be an integer.r-   )r    rP   rJ   rK   r   r   rE   r   rM   NegativeInfinityrN   rL   rb   r)   r%   s      r(   rS   laguerre.eval  s    <<5 =>>{{ ))++QBF3T3T3V3V1vhrAvr222yyuua(((zz!ajj}}a'!**44 ! }}1vhrAvr222))!//r+   c                     US:X  a  [        X5      eUS:X  a  U R                  u  p#[        US-
  SU5      * $ [        X5      er   )r   r/   assoc_laguerrer   s       r(   r^   laguerre.fdiff  sG    q=$T44]99DA"1q5!Q///$T44r+   c                    SSK Jn  UR                  (       a%  [        U5      U R                  " U* S-
  U* 40 UD6-  $ UR
                  SL a  [        S5      e[        S5      n[        U* U5      [        U5      S-  -  X%-  -  nU" XeSU45      $ )Nr   rV   r-   Fr   rX   rA   )
rZ   rW   rb   r   re   r    rP   r   r
   r	   r   s          r(   re   laguerre._eval_rewrite_as_Sum  s    1==q6D55qb1fqbKFKKK<<5 =>>#Jr1%	!a7!$>4Q##r+   c                 (    U R                   " X40 UD6$ rh   ri   r   s       r(   rj   $laguerre._eval_rewrite_as_polynomial"  r   r+   r4   Nr   )r5   r6   r7   r8   r9   r   r   r!   r:   rS   r^   re   rj   r;   r4   r+   r(   r   r     s5    6p }-K0 0,	5	$9r+   r   c                   D    \ rS rSrSr\S 5       rS
S jrS rS r	S r
Srg	)r   i(  a  
Returns the $n$th generalized Laguerre polynomial in $x$, $L_n(x)$.

Examples
========

>>> from sympy import assoc_laguerre, diff
>>> from sympy.abc import x, n, a
>>> assoc_laguerre(0, a, x)
1
>>> assoc_laguerre(1, a, x)
a - x + 1
>>> assoc_laguerre(2, a, x)
a**2/2 + 3*a/2 + x**2/2 + x*(-a - 2) + 1
>>> assoc_laguerre(3, a, x)
a**3/6 + a**2 + 11*a/6 - x**3/6 + x**2*(a/2 + 3/2) +
    x*(-a**2/2 - 5*a/2 - 3) + 1

>>> assoc_laguerre(n, a, 0)
binomial(a + n, a)

>>> assoc_laguerre(n, a, x)
assoc_laguerre(n, a, x)

>>> assoc_laguerre(n, 0, x)
laguerre(n, x)

>>> diff(assoc_laguerre(n, a, x), x)
-assoc_laguerre(n - 1, a + 1, x)

>>> diff(assoc_laguerre(n, a, x), a)
Sum(assoc_laguerre(_k, a, x)/(-a + n), (_k, 0, n - 1))

Parameters
==========

n : int
    Degree of Laguerre polynomial. Must be `n \ge 0`.

alpha : Expr
    Arbitrary expression. For ``alpha=0`` regular Laguerre
    polynomials will be generated.

See Also
========

jacobi, gegenbauer,
chebyshevt, chebyshevt_root, chebyshevu, chebyshevu_root,
legendre, assoc_legendre,
hermite, hermite_prob,
laguerre,
sympy.polys.orthopolys.jacobi_poly
sympy.polys.orthopolys.gegenbauer_poly
sympy.polys.orthopolys.chebyshevt_poly
sympy.polys.orthopolys.chebyshevu_poly
sympy.polys.orthopolys.hermite_poly
sympy.polys.orthopolys.hermite_prob_poly
sympy.polys.orthopolys.legendre_poly
sympy.polys.orthopolys.laguerre_poly

References
==========

.. [1] https://en.wikipedia.org/wiki/Laguerre_polynomial#Generalized_Laguerre_polynomials
.. [2] https://mathworld.wolfram.com/AssociatedLaguerrePolynomial.html
.. [3] https://functions.wolfram.com/Polynomials/LaguerreL/
.. [4] https://functions.wolfram.com/Polynomials/LaguerreL3/

c                    UR                   (       a  [        X5      $ UR                  (       d  UR                   (       a  [        X-   U5      $ U[        R
                  L a*  US:  a$  [        R                  U-  [        R
                  -  $ U[        R                  L a  US:  a  [        R
                  $ g g UR                  (       a  [        SU-  5      e[        XU5      $ )Nr   r   )rE   r   rJ   r   r   rN   rL   r   rb   rP   r   )r&   r'   alphar   s       r(   rS   assoc_laguerre.evalo  s     ==A>!{{yy	511ajjQU}}a'!**44a(((QUzz! .3( }} FJL L %Q511r+   c                    SSK Jn  US:X  a  [        X5      eUS:X  a8  U R                  u  p4n[	        S5      nU" [        XdU5      X4-
  -  USUS-
  45      $ US:X  a#  U R                  u  p4n[        US-
  US-   U5      * $ [        X5      e)Nr   rV   r-   rA   rX   rB   )rZ   rW   r   r/   r   r   )r1   r[   rW   r'   r   r   rX   s          r(   r^   assoc_laguerre.fdiff  s    1q=$T44]))KAac
A~a2ai@1aQ-PP]))KAa"1q5%!)Q777$T44r+   c                 (   SSK Jn  UR                  (       d  UR                  SL a  [	        S5      e[        S5      n[        U* U5      [        Xb-   S-   5      [        U5      -  -  X6-  -  n[        X-   S-   5      [        U5      -  U" XvSU45      -  $ )Nr   rV   Fra   rX   r-   )	rZ   rW   rb   r    rP   r   r
   r   r	   )r1   r'   r   r   rc   rW   rX   rd   s           r(   re   #assoc_laguerre._eval_rewrite_as_Sum  s    1==ALLE1IJJ#JBAIM*Yq\9;=>TBQY]#il2S1ay5IIIr+   c                 *    U R                   " XU40 UD6$ rh   ri   )r1   r'   r   r   rc   s        r(   rj   *assoc_laguerre._eval_rewrite_as_polynomial  s     ((1???r+   c                 |    U R                   u  pnU R                  XR                  5       UR                  5       5      $ rh   rm   )r1   r'   r   r   s       r(   r2   assoc_laguerre._eval_conjugate  s-    ii!yyOO-q{{}==r+   r4   Nr   ro   r4   r+   r(   r   r   (  s3    DL 2 2*5"J@
>r+   r   N)5r9   
sympy.corer   sympy.core.functionr   r   sympy.core.singletonr   sympy.core.symbolr   (sympy.functions.combinatorial.factorialsr   r	   r
   $sympy.functions.elementary.complexesr   &sympy.functions.elementary.exponentialr   #sympy.functions.elementary.integersr   (sympy.functions.elementary.miscellaneousr   (sympy.functions.elementary.trigonometricr   r   'sympy.functions.special.gamma_functionsr   sympy.functions.special.hyperr   sympy.polys.orthopolysr   r   r   r   r   r   r   r   r#   r   r=   rr   rH   rD   rG   r   r   rF   rI   r   r   r   r   r4   r+   r(   <module>r     s     C " # Y Y 3 6 5 9 = 9 /O O O 3Z
A? 
A"dI! dINF.\R:% R:rs9% s9l{9% {9|&)o &)R&)o &)Zq9# q9hn:_ n:jc7" c7L^5' ^5Lk9# k9\>) >r+   