§
    OŠtj¡¶  ã                   óZ  — d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z	 ddl
mZmZmZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZmZ ddlmZ ddlmZ ddlmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%  e	d¦  «        Z& G d„ de¦  «        Z' G d„ de'¦  «        Z(d„ Z) G d„ de'¦  «        Z* G d„ de'¦  «        Z+ G d„ de'¦  «        Z, G d„ de¦  «        Z- G d„ de¦  «        Z. G d„ d e'¦  «        Z/ G d!„ d"e¦  «        Z0 G d#„ d$e'¦  «        Z1 G d%„ d&e'¦  «        Z2 G d'„ d(e'¦  «        Z3 G d)„ d*e'¦  «        Z4d+S ),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                   ó.   — e Zd ZdZed„ ¦   «         Zd„ ZdS )ÚOrthogonalPolynomialz+Base class for orthogonal polynomials.
    c                 ó¦   — |j         rG|dk    rC|                      t          |¦  «        t          ¦  «                             t          |¦  «        S d S d S )Nr   )Ú
is_integerÚ_ortho_polyÚintÚ_xÚsubs©ÚclsÚnr   s      úa/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/sympy/functions/special/polynomials.pyÚ_eval_at_orderz#OrthogonalPolynomial._eval_at_order    sL   € àŒ<ð 	;˜A šF˜FØ—?’?¥3 q¡6¤6­2Ñ.Ô.×3Ò3µB¸Ñ:Ô:Ð:ð	;ð 	;˜F˜Fó    c                 ó~   — |                       | j        d         | j        d                              ¦   «         ¦  «        S )Nr   é   )ÚfuncÚargsÚ	conjugate)Úselfs    r'   Ú_eval_conjugatez$OrthogonalPolynomial._eval_conjugate%   s.   € Ø�yŠy˜œ 1œ t¤y°¤|×'=Ò'=Ñ'?Ô'?Ñ@Ô@Ð@r)   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úclassmethodr(   r0   © r)   r'   r   r      sM   € € € € € ðð ð ð;ð ;ñ „[ð;ðAð Að Að Að Ar)   r   c                   óB   — e Zd ZdZed„ ¦   «         Zd	d„Zd„ Zd„ Zd„ Z	dS )
Újacobiaç  
    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                 óN  — ||k    �r |t          dd¦  «        k    r;t          t          j        |¦  «        t	          |¦  «        z  t          ||¦  «        z  S |j        rt          ||¦  «        S |t          j        k    rAt          dt          j        z  |¦  «        t	          |dz   ¦  «        z  t          ||¦  «        z  S t          |dz   |¦  «        t          d|z  dz   |¦  «        z  t          ||t          j        z   |¦  «        z  S || k    rSt          ||z   dz   ¦  «        t          |dz   ¦  «        z  d|z   |dz  z  z  d|z
  |dz  z  z  t          || |¦  «        z  S |j        �s+|                     ¦   «         r#t          j        |z  t          |||| ¦  «        z  S |j        r\d| z  t          ||z   dz   ¦  «        z  t          |dz   ¦  «        t	          |¦  «        z  z  t!          | |z
  | g|dz   gd¦  «        z  S |t          j        k    r#t          |dz   |¦  «        t	          |¦  «        z  S |t          j        u rL|j        rG||z   d|z  z   j        rt+          d¦  «        ‚t          ||z   |z   dz   |¦  «        t          j        z  S d S d S t-          ||||¦  «        S )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ÚNegativeOner8   r   ÚOneÚInfinityÚis_positiver   Ú
ValueErrorr   )r%   r&   ÚaÚbr   s        r'   Úevalzjacobi.eval~   sÁ  € ð �Š6‰6Ø•H˜R ‘O”OÒ#Ð#Ý&¥q¤v¨qÑ1Ô1µI¸a±L´LÑ@Å:ÈaÐQRÑCSÔCSÑSÐSØ”ð nÝ  1‘~”~Ð%Ø•a”f’�Ý& q­¬¡x°Ñ3Ô3µiÀÀAÁÑ6FÔ6FÑFÍÐTUÐWXÑIYÔIYÑYÐYå& q¨1¡u¨aÑ0Ô0µ?À1ÀQÁ3ÈÁ7ÈAÑ3NÔ3NÑNÕQ[Ð\]Ð_`ÕcdÔciÑ_iÐklÑQmÔQmÑmÐmØ�1�"ŠWˆWå˜˜Q™ ™Ñ#Ô#¥e¨A°©E¡l¤lÑ2°a¸!±e¸qÀ¹s±^ÑCÀqÈ1ÁuÐPQÐRSÑPSÁnÑTÕWeÐfgÐjkÐikÐmnÑWoÔWoÑoÐoàŒ{ñ 	+ð ×)Ò)Ñ+Ô+ð >Ý”} aÑ'­&°°A°q¸1¸"Ñ*=Ô*=Ñ=Ð=àŒyð :Ø˜Q˜B™¥%¨¨A©°©	Ñ"2Ô"2Ñ2µe¸AÀ¹E±l´lÅYÈqÁ\Ä\Ñ6QÑRÝ ˜r A™v¨ r˜l¨Q°©U¨G°RÑ8Ô8ñ9ð :à•A”EŠzˆzÝ& q¨1¡u¨aÑ0Ô0µ9¸Q±<´<Ñ?Ð?Ø•a”j��Ø”=ð Jà˜A™  !¡™Ô/ð YÝ(Ð)WÑXÔXÐXÝ*¨1¨q©5°1©9°q©=¸!Ñ<Ô<½q¼zÑIÐIð !�ðJð Jõ ˜q ! Q¨Ñ*Ô*Ð*r)   é   c                 óØ  — ddl m} |dk    rt          | |¦  «        ‚|dk    r²| j        \  }}}}t	          d¦  «        }d||z   |z   |z   dz   z  }||z   d|z  z   dz   t          ||z   dz   ||z
  ¦  «        z  ||z
  t          ||z   |z   dz   ||z
  ¦  «        z  z  }	 ||t          ||||¦  «        |	t          ||||¦  «        z  z   z  |d|dz
  f¦  «        S |dk    r»| j        \  }}}}t	          d¦  «        }d||z   |z   |z   dz   z  }d||z
  z  ||z   d|z  z   dz   t          ||z   dz   ||z
  ¦  «        z  ||z
  t          ||z   |z   dz   ||z
  ¦  «        z  z  z  }	 ||t          ||||¦  «        |	t          ||||¦  «        z  z   z  |d|dz
  f¦  «        S |dk    r@| j        \  }}}}t          j        ||z   |z   dz   z  t          |dz
  |dz   |dz   |¦  «        z  S t          | |¦  «        ‚)	Nr   ©ÚSumr+   r;   Úkr<   r:   rN   )	Úsympy.concrete.summationsrQ   r   r-   r   r
   r8   r   r=   )
r/   ÚargindexrQ   r&   rK   rL   r   rR   Úf1Úf2s
             r'   Úfdiffzjacobi.fdiff¤   sh  € Ø1Ð1Ð1Ð1Ð1Ð1Ø�qŠ=ˆ=å$ T¨8Ñ4Ô4Ð4Ø˜Š]ˆ]àœ‰JˆAˆq�!�QÝ�c‘
”
ˆAØ�a˜!‘e˜a‘i !‘m aÑ'Ñ(ˆBØ�q‘5˜1˜Q™3‘; ‘?¥o°a¸!±e¸a±iÀÀQÁÑ&GÔ&GÑGØ˜‘E�_¨Q°©U°Q©Y¸©]¸AÀ¹EÑBÔBÑBñDˆBà�3�r�V A q¨!¨QÑ/Ô/°"µV¸A¸qÀ!ÀQÑ5GÔ5GÑ2GÑGÑHÈ1ÈaÐQRÐUVÑQVÈ-ÑXÔXÐXØ˜Š]ˆ]àœ‰JˆAˆq�!�QÝ�c‘
”
ˆAØ�a˜!‘e˜a‘i !‘m aÑ'Ñ(ˆBØ˜˜A™‘ 1 q¡5¨1¨Q©3¡;°¡?µoÀaÈ!ÁeÈaÁiÐQRÐUVÑQVÑ6WÔ6WÑ"WØ˜‘E�_¨Q°©U°Q©Y¸©]¸AÀ¹EÑBÔBÑBñ#Dñ EˆBà�3�r�V A q¨!¨QÑ/Ô/°"µV¸A¸qÀ!ÀQÑ5GÔ5GÑ2GÑGÑHÈ1ÈaÐQRÐUVÑQVÈ-ÑXÔXÐXØ˜Š]ˆ]àœ‰JˆAˆq�!�QÝ”6˜Q ™U Q™Y¨™]Ñ+­f°Q¸±U¸AÀ¹EÀ1ÀqÁ5È!Ñ.LÔ.LÑLÐLå$ T¨8Ñ4Ô4Ð4r)   c                 óp  — ddl m} |j        s	|j        du rt	          d¦  «        ‚t          d¦  «        }t          | |¦  «        t          ||z   |z   dz   |¦  «        z  t          ||z   dz   ||z
  ¦  «        z  t          |¦  «        z  d|z
  dz  |z  z  }dt          |¦  «        z   |||d|f¦  «        z  S )Nr   rP   Fú*Error: n should be a non-negative integer.rR   r+   r;   )rS   rQ   Úis_negativer   rJ   r   r
   r	   )	r/   r&   rK   rL   r   ÚkwargsrQ   rR   Úkerns	            r'   Ú_eval_rewrite_as_Sumzjacobi._eval_rewrite_as_SumÀ   sÞ   € Ø1Ð1Ð1Ð1Ð1Ð1àŒ=ð 	K˜AœL¨EÐ1Ð1ÝÐIÑJÔJÐJÝ�#‰JŒJˆÝ   AÑ&Ô&­¸¸Q¹À¹ÀQ¹ÈÑ)JÔ)JÑJÍ_Ð]^ÐabÑ]bÐefÑ]fÐhiÐlmÑhmÑMnÔMnÑnÝ˜!‘”ñØ!" Q¡¨¡	¨A™~ñ.ˆà•9˜Q‘<”<Ñ # # d¨Q°°1¨IÑ"6Ô"6Ñ6Ð6r)   c                 ó$   —  | j         ||||fi |¤ŽS ©N©r]   )r/   r&   rK   rL   r   r[   s         r'   Ú_eval_rewrite_as_polynomialz"jacobi._eval_rewrite_as_polynomialÊ   s%   € ð )ˆtÔ(¨¨A¨q°!Ð>Ð>°vÐ>Ð>Ð>r)   c                 ó¶   — | j         \  }}}}|                      ||                     ¦   «         |                     ¦   «         |                     ¦   «         ¦  «        S r_   ©r-   r,   r.   )r/   r&   rK   rL   r   s        r'   r0   zjacobi._eval_conjugateÏ   sA   € Ø”Y‰
ˆˆ1ˆa�Ø�yŠy˜˜AŸKšK™MœM¨1¯;ª;©=¬=¸!¿+º+¹-¼-ÑHÔHÐHr)   N)rN   ©
r1   r2   r3   r4   r5   rM   rW   r]   ra   r0   r6   r)   r'   r8   r8   -   sƒ   € € € € € ðNð Nð` ð#+ð #+ñ „[ð#+ðJ5ð 5ð 5ð 5ð87ð 7ð 7ð?ð ?ð ?ð
Ið Ið Ið Ið Ir)   r8   c                 ó>  — t          d¦  «        ||z   dz   z  t          | |z   dz   ¦  «        t          | |z   dz   ¦  «        z  z  d| z  |z   |z   dz   z  t          | ¦  «        t          | |z   |z   dz   ¦  «        z  z  }t          | |||¦  «        t	          |¦  «        z  S )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/

    r;   r+   )r   r   r	   r8   r   )r&   rK   rL   r   Únfactors        r'   Újacobi_normalizedrg   Ô   s¨   € õF �‰tŒt�a˜!‘e˜a‘iÑ ¥E¨!¨a©%°!©)Ñ$4Ô$4µu¸QÀ¹UÀQ¹YÑ7GÔ7GÑ$GÑHØ�A‘#˜‘'˜A‘+ ‘/ñ#Ý&/°¡l¤lµU¸1¸q¹5À1¹9Àq¹=Ñ5IÔ5IÑ&IñK€Gõ �!�Q˜˜1ÑÔ¥ W¡¤Ñ-Ð-r)   c                   óB   — e Zd ZdZed„ ¦   «         Zd	d„Zd„ Zd„ Zd„ Z	dS )
rB   aN  
    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                 óè  — |j         rt          j        S |t          j        k    rt	          ||¦  «        S |t          j        k    rt          ||¦  «        S |t          j        k    rt          j        S |j        �së|t          j        k    r¥t          |¦  «        t          j        k    dk    rt          j
        S t          t          j        ||z   z  ¦  «        t          t          j        |z  ¦  «        z  t          d|z  |z   ¦  «        z  t          d|z  ¦  «        t          |dz   ¦  «        z  z  S |                     ¦   «         r"t          j        |z  t!          ||| ¦  «        z  S |j        rxd|z  t%          t          j        ¦  «        z  t          |t          j        |z  z   ¦  «        z  t          d|z
  dz  ¦  «        t          |dz   ¦  «        z  t          |¦  «        z  z  S |t          j        k    r;t          d|z  |z   ¦  «        t          d|z  ¦  «        t          |dz   ¦  «        z  z  S |t          j        u r$|j        rt+          ||¦  «        t          j        z  S d S d S t-          |||¦  «        S )NTr;   r+   )rZ   r   ÚZeror=   r@   rG   rA   rF   rD   r   ÚComplexInfinityr   ÚPir   r   rE   rB   r?   r   rH   rI   r
   r   )r%   r&   rK   r   s       r'   rM   zgegenbauer.evalg  s&  € ð Œ=ð 	Ý”6ˆMð •”Š;ˆ;Ý˜A˜q‘>”>Ð!Ø•!”%ŠZˆZÝ˜a Ñ#Ô#Ð#Ø•!”-ÒÐÝ”6ˆMàŒ{ñ 	,à•A”MÒ!Ð!Ý�q‘E”E�AœF’N tÒ+Ð+ÝÔ,Ð,å¥¤ a¨¡c¡
™OœO­cµ!´$°q±&©k¬kÑ9½EÀ!ÀAÁ#ÀaÁ%¹L¼LÑHÝ!& q¨¡s¡¤­e°A°a±C©j¬jÑ!8ñ:ð ;ð
 ×)Ò)Ñ+Ô+ð ?Ý”} aÑ'­*°Q¸¸A¸2Ñ*>Ô*>Ñ>Ð>àŒyð GØ˜1™�t¥A¤D™zœzÑ)­E°!µa´f¸Q±h±,Ñ,?Ô,?Ñ?Ý  A¡ q™yÑ)Ô)­E°!°a±%©L¬LÑ8½5À¹8¼8ÑCñEð Gà•A”EŠzˆzÝ˜Q˜q™S 1™W‘~”~­¨q°©s©¬µe¸AÀ¹E±l´lÑ)BÑCÐCØ•a”j��Ø”=ð >Ý*¨1¨aÑ0Ô0µ1´:Ñ=Ð=ð !�ð>ð >õ # 1 a¨Ñ+Ô+Ð+r)   r<   c                 ó  — ddl m} |dk    rt          | |¦  «        ‚|dk    rª| j        \  }}}t	          d¦  «        }ddd||z
  z  z   z  ||z   z  ||z   d|z  z   ||z
  z  z  }d|dz   z  |d|z  z   d|z  d|z  z   dz   z  z  d||z   d|z  z   z  z   }|t          |||¦  «        z  |t          |||¦  «        z  z   }	 ||	|d|dz
  f¦  «        S |dk    r(| j        \  }}}d|z  t          |dz
  |dz   |¦  «        z  S t          | |¦  «        ‚)Nr   rP   r+   r;   rR   r:   r<   )rS   rQ   r   r-   r   rB   )
r/   rT   rQ   r&   rK   r   rR   Úfactor1Úfactor2r\   s
             r'   rW   zgegenbauer.fdiff�  sn  € Ø1Ð1Ð1Ð1Ð1Ð1Ø�qŠ=ˆ=å$ T¨8Ñ4Ô4Ð4Ø˜Š]ˆ]à”i‰GˆAˆq�!Ý�c‘
”
ˆAØ˜1  a¨!¡e™}Ñ,Ñ-°°Q±Ñ7¸AØñ=Ø  ™sñ=#Ø'(¨1¡uñ<.ñ /ˆGà˜˜Q™‘i A¨¨!©¡G°°!±°a¸±c±	¸A±Ñ#>Ñ?Ø�Q˜‘U˜Q˜q™S‘[Ñ!ñ"ˆGà�: a¨¨AÑ.Ô.Ñ.°½ÀAÀqÈ!Ñ9LÔ9LÑ1LÑLˆDØ�3�t˜a  A¨¡E˜]Ñ+Ô+Ð+Ø˜Š]ˆ]à”i‰GˆAˆq�!Ø�Q‘3•z ! a¡%¨¨Q©°Ñ2Ô2Ñ2Ð2å$ T¨8Ñ4Ô4Ð4r)   c           	      ó  — ddl m} t          d¦  «        }d|z  t          |||z
  ¦  «        z  d|z  |d|z  z
  z  z  t	          |¦  «        t	          |d|z  z
  ¦  «        z  z  } |||dt          |dz  ¦  «        f¦  «        S )Nr   rP   rR   r:   r;   )rS   rQ   r   r
   r	   r   )r/   r&   rK   r   r[   rQ   rR   r\   s           r'   r]   zgegenbauer._eval_rewrite_as_Sum¦  s—   € Ø1Ð1Ð1Ð1Ð1Ð1Ý�#‰JŒJˆØ�a‘�/¨!¨Q°©UÑ3Ô3Ñ3°q¸±s¸aÀ!ÀAÁ#¹gÑ6FÑFÝ˜1‘”¥	¨!¨a°©c©'Ñ 2Ô 2Ñ2ñ4ˆàˆs�4˜!˜Q¥ a¨¡c¡
¤
Ð+Ñ,Ô,Ð,r)   c                 ó"   —  | j         |||fi |¤ŽS r_   r`   )r/   r&   rK   r   r[   s        r'   ra   z&gegenbauer._eval_rewrite_as_polynomial­  ó#   € ð )ˆtÔ(¨¨A¨qÐ;Ð;°FÐ;Ð;Ð;r)   c                 óŽ   — | j         \  }}}|                      ||                     ¦   «         |                     ¦   «         ¦  «        S r_   rc   )r/   r&   rK   r   s       r'   r0   zgegenbauer._eval_conjugate²  ó5   € Ø”)‰ˆˆ1ˆaØ�yŠy˜˜AŸKšK™MœM¨1¯;ª;©=¬=Ñ9Ô9Ð9r)   N©r<   rd   r6   r)   r'   rB   rB   "  s~   € € € € € ðBð BðH ð&,ð &,ñ „[ð&,ðP5ð 5ð 5ð 5ð,-ð -ð -ð<ð <ð <ð
:ð :ð :ð :ð :r)   rB   c                   óR   — e Zd ZdZ ee¦  «        Zed„ ¦   «         Zdd„Z	d„ Z
d„ ZdS )	r>   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                 óü  — |j         sÂ|                     ¦   «         r!t          j        |z  t	          || ¦  «        z  S |                     ¦   «         rt	          | |¦  «        S |j        r)t          t          j        t          j        z  |z  ¦  «        S |t          j	        k    rt          j	        S |t          j
        u rt          j
        S d S |j        r|                      | |¦  «        S |                      ||¦  «        S r_   )rD   rE   r   rF   r>   r?   r   r=   rl   rG   rH   rZ   r(   r$   s      r'   rM   zchebyshevt.eval  sñ   € àŒ{ð 	0ð ×)Ò)Ñ+Ô+ð <Ý”} aÑ'­*°Q¸¸Ñ*;Ô*;Ñ;Ð;à×)Ò)Ñ+Ô+ð )Ý! 1 " aÑ(Ô(Ð(àŒyð .Ý�1œ6¥A¤D™=¨1Ñ,Ñ-Ô-Ð-Ø•A”EŠzˆzÝ”u�Ø•a”j��Ý”zÐ!ð !�ð Œ}ð 0à×)Ò)¨1¨"¨aÑ0Ô0Ð0à×)Ò)¨!¨QÑ/Ô/Ð/r)   r;   c                 óš   — |dk    rt          | |¦  «        ‚|dk    r | j        \  }}|t          |dz
  |¦  «        z  S t          | |¦  «        ‚©Nr+   r;   )r   r-   rA   ©r/   rT   r&   r   s       r'   rW   zchebyshevt.fdiff  sX   € Ø�qŠ=ˆ=å$ T¨8Ñ4Ô4Ð4Ø˜Š]ˆ]à”9‰DˆAˆqØ•z ! a¡%¨Ñ+Ô+Ñ+Ð+å$ T¨8Ñ4Ô4Ð4r)   c           	      óÀ   — ddl m} t          d¦  «        }t          |d|z  ¦  «        |dz  dz
  |z  z  ||d|z  z
  z  z  } |||dt	          |dz  ¦  «        f¦  «        S ©Nr   rP   rR   r;   r+   )rS   rQ   r   r   r   ©r/   r&   r   r[   rQ   rR   r\   s          r'   r]   zchebyshevt._eval_rewrite_as_Sum%  sw   € Ø1Ð1Ð1Ð1Ð1Ð1Ý�#‰JŒJˆÝ˜˜1˜Q™3ÑÔ 1 a¡4¨!¡8¨a¡-Ñ/°!°a¸!¸A¹#±g±,Ñ>ˆØˆs�4˜!˜Q¥ a¨¡c¡
¤
Ð+Ñ,Ô,Ð,r)   c                 ó    —  | j         ||fi |¤ŽS r_   r`   ©r/   r&   r   r[   s       r'   ra   z&chebyshevt._eval_rewrite_as_polynomial+  ó!   € ð )ˆtÔ(¨¨AÐ8Ð8°Ð8Ð8Ð8r)   N©r;   )r1   r2   r3   r4   Ústaticmethodr   r    r5   rM   rW   r]   ra   r6   r)   r'   r>   r>   »  s}   € € € € € ðAð AðF �,˜Ñ/Ô/€Kàð0ð 0ñ „[ð0ð0	5ð 	5ð 	5ð 	5ð-ð -ð -ð9ð 9ð 9ð 9ð 9r)   r>   c                   óR   — e Zd ZdZ ee¦  «        Zed„ ¦   «         Zdd„Z	d„ Z
d„ ZdS )	rA   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                 ó²  — |j         sý|                     ¦   «         r!t          j        |z  t	          || ¦  «        z  S |                     ¦   «         rI|t          j        k    rt          j        S | dz
                       ¦   «         st	          | dz
  |¦  «         S |j        r)t          t          j        t          j	        z  |z  ¦  «        S |t          j
        k    rt          j
        |z   S |t          j        u rt          j        S d S |j        r7|t          j        k    rt          j        S |                      | dz
  |¦  «         S |                      ||¦  «        S ©Nr;   )rD   rE   r   rF   rA   rj   r?   r   r=   rl   rG   rH   rZ   r(   r$   s      r'   rM   zchebyshevu.evalw  sF  € àŒ{ð 	0ð ×)Ò)Ñ+Ô+ð <Ý”} aÑ'­*°Q¸¸Ñ*;Ô*;Ñ;Ð;à×)Ò)Ñ+Ô+ð 2Ø�œÒ%Ð%åœ6�MØ˜"˜q™&×:Ò:Ñ<Ô<ð 2Ý&¨ r¨A¡v¨qÑ1Ô1Ð1Ð1àŒyð .Ý�1œ6¥A¤D™=¨1Ñ,Ñ-Ô-Ð-Ø•A”EŠzˆzÝ”u˜q‘yÐ Ø•a”j��Ý”zÐ!ð !�ð Œ}ð 0à�œÒ%Ð%Ýœ6�Mà×.Ò.°¨r°A©v°qÑ9Ô9Ð9Ð9à×)Ò)¨!¨QÑ/Ô/Ð/r)   r;   c                 óÚ   — |dk    rt          | |¦  «        ‚|dk    r@| j        \  }}|dz   t          |dz   |¦  «        z  |t          ||¦  «        z  z
  |dz  dz
  z  S t          | |¦  «        ‚ry   )r   r-   r>   rA   rz   s       r'   rW   zchebyshevu.fdiff—  s   € Ø�qŠ=ˆ=å$ T¨8Ñ4Ô4Ð4Ø˜Š]ˆ]à”9‰DˆAˆqØ˜‘U�j¨¨Q©°Ñ2Ô2Ñ2°Q½ÀAÀqÑ9IÔ9IÑ5IÑIÈaÐQRÉdÐUVÉhÑWÐWå$ T¨8Ñ4Ô4Ð4r)   c           	      ó  — ddl m} t          d¦  «        }t          j        |z  t          ||z
  ¦  «        z  d|z  |d|z  z
  z  z  t          |¦  «        t          |d|z  z
  ¦  «        z  z  } |||dt          |dz  ¦  «        f¦  «        S ©Nr   rP   rR   r;   ©rS   rQ   r   r   rF   r	   r   r}   s          r'   r]   zchebyshevu._eval_rewrite_as_Sum¢  s£   € Ø1Ð1Ð1Ð1Ð1Ð1Ý�#‰JŒJˆÝŒ}˜aÑ¥)Ø�‰Eñ#ô #ñ Ø˜‘c˜Q  1¡™WÑ%ñ&Ý)2°1©¬½	À!ÀaÈÁcÁ'Ñ8JÔ8JÑ)JñLˆàˆs�4˜!˜Q¥ a¨¡c¡
¤
Ð+Ñ,Ô,Ð,r)   c                 ó    —  | j         ||fi |¤ŽS r_   r`   r   s       r'   ra   z&chebyshevu._eval_rewrite_as_polynomial©  r€   r)   Nr�   )r1   r2   r3   r4   r‚   r   r    r5   rM   rW   r]   ra   r6   r)   r'   rA   rA   1  s}   € € € € € ðAð AðF �,˜Ñ/Ô/€Kàð0ð 0ñ „[ð0ð>	5ð 	5ð 	5ð 	5ð-ð -ð -ð9ð 9ð 9ð 9ð 9r)   rA   c                   ó(   — e Zd ZdZed„ ¦   «         ZdS )Úchebyshevt_roota�  
    ``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                 ó”   — d|k    r||k     st          d|›d|›�¦  «        ‚t          t          j        d|z  dz   z  d|z  z  ¦  «        S )Nr   úmust have 0 <= k < n, got k = ú	 and n = r;   r+   ©rJ   r   r   rl   ©r%   r&   rR   s      r'   rM   zchebyshevt_root.evalÐ  s\   € à�a’�˜a !še˜eÝ�*Ø+,¨1¨1¨a¨að1ñ 2ô 2ð 2å•1”4˜˜1™˜q™‘> 1 Q¡3Ñ'Ñ(Ô(Ð(r)   N©r1   r2   r3   r4   r5   rM   r6   r)   r'   rŒ   rŒ   ¯  s:   € € € € € ðð ð@ ð)ð )ñ „[ð)ð )ð )r)   rŒ   c                   ó(   — e Zd ZdZed„ ¦   «         ZdS )Úchebyshevu_rootaw  
    ``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                 óŽ   — d|k    r||k     st          d|›d|›�¦  «        ‚t          t          j        |dz   z  |dz   z  ¦  «        S )Nr   rŽ   r�   r+   r�   r‘   s      r'   rM   zchebyshevu_root.evalù  sX   € à�a’�˜a !še˜eÝ�*Ø+,¨1¨1¨a¨að1ñ 2ô 2ð 2å•1”4˜˜Q™‘<  Q¡Ñ'Ñ(Ô(Ð(r)   Nr’   r6   r)   r'   r”   r”   Ø  s:   € € € € € ðð ð@ ð)ð )ñ „[ð)ð )ð )r)   r”   c                   óR   — e Zd ZdZ ee¦  «        Zed„ ¦   «         Zdd„Z	d„ Z
d„ ZdS )	r@   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                 óš  — |j         �s|                     ¦   «         r!t          j        |z  t	          || ¦  «        z  S |                     ¦   «         r6| dz
                       ¦   «         st	          | t          j        z
  |¦  «        S |j        rYt          t          j        ¦  «        t          t          j
        |dz  z
  ¦  «        t          t          j        |dz  z   ¦  «        z  z  S |t          j        k    rt          j        S |t          j        u rt          j        S d S |j        r| t          j        z
  }|                      ||¦  «        S ry   )rD   rE   r   rF   r@   rG   r?   r   rl   r   r=   rH   rZ   r(   r$   s      r'   rM   zlegendre.eval=  s$  € àŒ{ñ 	,ð ×)Ò)Ñ+Ô+ð :Ý”} aÑ'­(°1°q°b©/¬/Ñ9Ð9à×)Ò)Ñ+Ô+ð /°Q°B¸±F×3TÒ3TÑ3VÔ3Vð /Ý  ¥Q¤U¡
¨AÑ.Ô.Ð.àŒyð "Ý�AœD‘z”z¥5­¬°!°A±#©Ñ#6Ô#6µu½Q¼UÀQÀqÁS¹[Ñ7IÔ7IÑ#IÑJÐJØ•a”e’�Ý”u�Ø•a”j��Ý”zÐ!ð !�ð
 Œ}ð Ø�B�œ‘J�Ø×%Ò% a¨Ñ+Ô+Ð+r)   r;   c                 óÔ   — |dk    rt          | |¦  «        ‚|dk    r=| j        \  }}||dz  dz
  z  |t          ||¦  «        z  t          |dz
  |¦  «        z
  z  S t          | |¦  «        ‚ry   )r   r-   r@   rz   s       r'   rW   zlegendre.fdiffU  sx   € Ø�qŠ=ˆ=å$ T¨8Ñ4Ô4Ð4Ø˜Š]ˆ]ð ”9‰DˆAˆqØ�a˜‘d˜Q‘h‘< ¥8¨A¨q¡>¤>Ñ!1µH¸QÀ¹UÀAÑ4FÔ4FÑ!FÑGÐGå$ T¨8Ñ4Ô4Ð4r)   c                 óÆ   — ddl m} t          d¦  «        }t          j        |z  t          ||¦  «        dz  z  d|z   dz  ||z
  z  z  d|z
  dz  |z  z  } |||d|f¦  «        S r|   )rS   rQ   r   r   rF   r   r}   s          r'   r]   zlegendre._eval_rewrite_as_Summ  s~   € Ø1Ð1Ð1Ð1Ð1Ð1Ý�#‰JŒJˆÝŒ}˜aÑ¥¨¨A¡¤°Ñ 1Ñ1°A¸±E¸1±9ÀÀAÁÑ2FÑFÈÈQÉÐPQÉ	ÐTUÁ~ÑUˆØˆs�4˜!˜Q ˜Ñ#Ô#Ð#r)   c                 ó    —  | j         ||fi |¤ŽS r_   r`   r   s       r'   ra   z$legendre._eval_rewrite_as_polynomials  r€   r)   Nr�   )r1   r2   r3   r4   r‚   r   r    r5   rM   rW   r]   ra   r6   r)   r'   r@   r@     s{   € € € € € ð3ð 3ðj �,˜}Ñ-Ô-€Kàð,ð ,ñ „[ð,ð.5ð 5ð 5ð 5ð0$ð $ð $ð9ð 9ð 9ð 9ð 9r)   r@   c                   óX   — e Zd ZdZed„ ¦   «         Zed„ ¦   «         Zd
d„Zd„ Zd„ Z	d„ Z
d	S )rC   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                 óê   — t          |t          d¬¦  «                             t          |f¦  «        }t          j        |z  dt          dz  z
  t          |d¦  «        z  z  |                     ¦   «         z  S )NT)Úpolysr+   r;   )r   r"   Údiffr   rF   r   Úas_expr)r%   r&   ÚmÚPs       r'   r(   zassoc_legendre._eval_at_order´  s\   € å˜!�R tÐ,Ñ,Ô,×1Ò1µ2°q°'Ñ:Ô:ˆÝŒ}˜aÑ 1¥r¨1¡u¡9­x¸¸1©~¬~Ñ"=Ñ=ÀÇ	Â	ÁÄÑKÐKr)   c                 ó  — |                      ¦   «         rIt          j        | z  t          ||z   ¦  «        t          ||z
  ¦  «        z  z  t	          || |¦  «        z  S |dk    rt          ||¦  «        S |dk    rQd|z  t          t          j        ¦  «        z  t          d|z
  |z
  dz  ¦  «        t          d||z
  dz  z
  ¦  «        z  z  S |j	        r²|j	        r­|j
        r¨|j
        r£|j        rt          | ›d|›d�¦  «        ‚t          |¦  «        |k    rt          | ›d|›d|›d�¦  «        ‚|                      t          |¦  «        t          t          |¦  «        ¦  «        ¦  «                             t"          |¦  «        S d S d S d S d S )Nr   r;   r+   z. : 1st index must be nonnegative integer (got ú)z0 : abs('2nd index') must be <= '1st index' (got z, )rE   r   rF   r	   rC   r@   r   rl   r   rD   r   rZ   rJ   Úabsr(   r!   r#   r"   )r%   r&   r    r   s       r'   rM   zassoc_legendre.eval¹  s½  € à×%Ò%Ñ'Ô'ð 	hå”= A 2Ñ&­)°A¸±EÑ*:Ô*:½9ÀQÈÁUÑ;KÔ;KÑ*KÑLÍ~Ð^_ÐbcÐacÐefÑOgÔOgÑgÐgØ�Š6ˆ6å˜A˜q‘>”>Ð!Ø�Š6ˆ6Ø�a‘4��QœT™
œ
‘?¥e¨Q°©U°Q©Y¸©MÑ&:Ô&:½5ÀÀaÈ!ÁeÈQÁYÁÑ;OÔ;OÑ&OÑPÐPØŒ;ð 	G˜1œ;ð 	G¨1¬<ð 	G¸A¼Lð 	GØŒ}ð cÝ ÐZ]ÐZ]ÐZ]Ð_`Ð_`Ð_`Ð!aÑbÔbÐbÝ�1‰vŒv˜ŠzˆzÝ Ð`cÐ`cÐ`cÐefÐefÐefÐhiÐhiÐhiÐ!jÑkÔkÐkØ×%Ò%¥c¨!¡f¤f­cµ#°a±&´&©k¬kÑ:Ô:×?Ò?ÅÀAÑFÔFÐFð	Gð 	Gð 	Gð 	Gð 	Gð 	Gð 	Gð 	Gr)   r<   c                 ó  — |dk    rt          | |¦  «        ‚|dk    rt          | |¦  «        ‚|dk    rI| j        \  }}}d|dz  dz
  z  ||z  t          |||¦  «        z  ||z   t          |dz
  ||¦  «        z  z
  z  S t          | |¦  «        ‚)Nr+   r;   r<   )r   r-   rC   )r/   rT   r&   r    r   s        r'   rW   zassoc_legendre.fdiffÊ  s«   € Ø�qŠ=ˆ=å$ T¨8Ñ4Ô4Ð4Ø˜Š]ˆ]å$ T¨8Ñ4Ô4Ð4Ø˜Š]ˆ]ð ”i‰GˆAˆq�!Ø�a˜‘d˜Q‘h‘<  1¡¥^°A°q¸!Ñ%<Ô%<Ñ!<ÀÀAÁÅ~ÐVWÐZ[ÑV[Ð]^Ð`aÑGbÔGbÑ?bÑ!bÑcÐcå$ T¨8Ñ4Ô4Ð4r)   c           
      ó”  — ddl m} t          d¦  «        }t          d|z  d|z  z
  ¦  «        d|z  t          ||z
  ¦  «        z  t          |¦  «        z  t          |d|z  z
  |z
  ¦  «        z  z  t          j        |z  z  |||z
  d|z  z
  z  z  }d|dz  z
  |dz  z   |||dt          ||z
  t          j        z  ¦  «        f¦  «        z  S r|   )rS   rQ   r   r	   r   rF   r   r=   )r/   r&   r    r   r[   rQ   rR   r\   s           r'   r]   z#assoc_legendre._eval_rewrite_as_SumÙ  sî   € Ø1Ð1Ð1Ð1Ð1Ð1Ý�#‰JŒJˆÝ˜˜1™˜q ™s™Ñ#Ô# Q¨¡T­)°A¸±EÑ*:Ô*:Ñ%:½9Øñ<ô <ñ &Ý˜˜Q˜q™S™ 1™Ñ%Ô%ñ&&ñ 'Ý'(¤}°aÑ'7ñ8Ø89¸AÀ¹EÀAÀaÁC¹KÑ8HñIˆà�A�q‘D‘˜A˜a™CÑ  3 3 t¨a°µE¸1¸q¹5Å!Ä&¹.Ñ4IÔ4IÐ-JÑ#KÔ#KÑKÐKr)   c                 ó"   —  | j         |||fi |¤ŽS r_   r`   )r/   r&   r    r   r[   s        r'   ra   z*assoc_legendre._eval_rewrite_as_polynomialà  rr   r)   c                 óŽ   — | j         \  }}}|                      ||                     ¦   «         |                     ¦   «         ¦  «        S r_   rc   )r/   r&   r    r   s       r'   r0   zassoc_legendre._eval_conjugateå  rt   r)   Nru   )r1   r2   r3   r4   r5   r(   rM   rW   r]   ra   r0   r6   r)   r'   rC   rC   y  sŸ   € € € € € ð8ð 8ðt ðLð Lñ „[ðLð ðGð Gñ „[ðGð 5ð 5ð 5ð 5ðLð Lð Lð<ð <ð <ð
:ð :ð :ð :ð :r)   rC   c                   óX   — e Zd ZdZ ee¦  «        Zed„ ¦   «         Zd	d„Z	d„ Z
d„ Zd„ ZdS )
Úhermitea.  
    ``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                 óœ  — |j         s—|                     ¦   «         r!t          j        |z  t	          || ¦  «        z  S |j        r?d|z  t          t          j        ¦  «        z  t          t          j	        |z
  dz  ¦  «        z  S |t          j
        u rt          j
        S d S |j        rt          d|z  ¦  «        ‚|                      ||¦  «        S )Nr;   ú0The index n must be nonnegative integer (got %r))rD   rE   r   rF   rª   r?   r   rl   r   rG   rH   rZ   rJ   r(   r$   s      r'   rM   zhermite.eval&  sÑ   € àŒ{ð 	0ð ×)Ò)Ñ+Ô+ð 9Ý”} aÑ'­'°!°a°R©.¬.Ñ8Ð8àŒyð "Ø˜!‘t�d¥1¤4™jœjÑ(­5µ!´%¸!±)¸Q±Ñ+?Ô+?Ñ?Ð?Ø•a”j��Ý”zÐ!ð !�ð Œ}ð 0Ý ØFÈÑJñLô Lð Lð ×)Ò)¨!¨QÑ/Ô/Ð/r)   r;   c                 ó    — |dk    rt          | |¦  «        ‚|dk    r#| j        \  }}d|z  t          |dz
  |¦  «        z  S t          | |¦  «        ‚ry   )r   r-   rª   rz   s       r'   rW   zhermite.fdiff:  s\   € Ø�qŠ=ˆ=å$ T¨8Ñ4Ô4Ð4Ø˜Š]ˆ]à”9‰DˆAˆqØ�Q‘3•w˜q 1™u aÑ(Ô(Ñ(Ð(å$ T¨8Ñ4Ô4Ð4r)   c           
      ó  — ddl m} t          d¦  «        }t          j        |z  t          |¦  «        t          |d|z  z
  ¦  «        z  z  d|z  |d|z  z
  z  z  }t          |¦  «         |||dt          |dz  ¦  «        f¦  «        z  S rˆ   r‰   r}   s          r'   r]   zhermite._eval_rewrite_as_SumE  s’   € Ø1Ð1Ð1Ð1Ð1Ð1Ý�#‰JŒJˆÝŒ}˜aÑ¥9¨Q¡<¤<µ	¸!¸aÀ¹c¹'Ñ0BÔ0BÑ#BÑCÀqÈÁsÈaÐRSÐTUÑRUÉgÑFVÑVˆÝ˜‰|Œ|˜C˜C  q¨!­U°1°Q±3©Z¬ZÐ&8Ñ9Ô9Ñ9Ð9r)   c                 ó    —  | j         ||fi |¤ŽS r_   r`   r   s       r'   ra   z#hermite._eval_rewrite_as_polynomialK  r€   r)   c                 óh   — t          d¦  «        |z  t          ||t          d¦  «        z  ¦  «        z  S r…   )r   Úhermite_probr   s       r'   Ú_eval_rewrite_as_hermite_probz%hermite._eval_rewrite_as_hermite_probP  s+   € Ý�A‰wŒw˜‰z�L¨¨A­d°1©g¬g©IÑ6Ô6Ñ6Ð6r)   Nr�   )r1   r2   r3   r4   r‚   r   r    r5   rM   rW   r]   ra   r²   r6   r)   r'   rª   rª   î  sŠ   € € € € € ð3ð 3ðj �,˜|Ñ,Ô,€Kàð0ð 0ñ „[ð0ð&	5ð 	5ð 	5ð 	5ð:ð :ð :ð9ð 9ð 9ð
7ð 7ð 7ð 7ð 7r)   rª   c                   óX   — e Zd ZdZ ee¦  «        Zed„ ¦   «         Zd	d„Z	d„ Z
d„ Zd„ ZdS )
r±   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                 ó”  — |j         s‘|                     ¦   «         r!t          j        |z  t	          || ¦  «        z  S |j        r9t          t          j        ¦  «        t          t          j	        |z
  dz  ¦  «        z  S |t          j
        u rt          j
        S d S |j        rt          d|z  ¦  «         d S |                      ||¦  «        S )Nr;   z'n must be a nonnegative integer, not %r)rD   rE   r   rF   r±   r?   r   rl   r   rG   rH   rZ   rJ   r(   r$   s      r'   rM   zhermite_prob.eval�  sÃ   € àŒ{ð 	0Ø×)Ò)Ñ+Ô+ð >Ý”} aÑ'­,°q¸1¸"Ñ*=Ô*=Ñ=Ð=ØŒyð "Ý�AœD‘z”z¥E­1¬5°©7°a©-Ñ$8Ô$8Ñ8Ð8Ø•a”j��Ý”zÐ!ð !�ð Œ}ð 0ÝÐDÀqÑHÑIÔIÐIÐIÐIà×)Ò)¨!¨QÑ/Ô/Ð/r)   r;   c                 ón   — |dk    r | j         \  }}|t          |dz
  |¦  «        z  S t          | |¦  «        ‚)Nr;   r+   )r-   r±   r   rz   s       r'   rW   zhermite_prob.fdiffŸ  s?   € Ø�qŠ=ˆ=Ø”9‰DˆAˆqØ•\ ! A¡# qÑ)Ô)Ñ)Ð)å$ T¨8Ñ4Ô4Ð4r)   c           
      ó  — ddl m} t          d¦  «        }t          j         |z  ||d|z  z
  z  z  t          |¦  «        t          |d|z  z
  ¦  «        z  z  }t          |¦  «         |||dt          |dz  ¦  «        f¦  «        z  S rˆ   )rS   rQ   r   r   r=   r	   r   r}   s          r'   r]   z!hermite_prob._eval_rewrite_as_Sum¦  s‹   € Ø1Ð1Ð1Ð1Ð1Ð1Ý�#‰JŒJˆÝ”�˜!‰|˜a ! A a¡C¡%™jÑ(­I°a©L¬L½9ÀQÀqÈÁsÁUÑ;KÔ;KÑ,KÑLˆÝ˜‰|Œ|˜C˜C  q¨!­U°1°Q±3©Z¬ZÐ&8Ñ9Ô9Ñ9Ð9r)   c                 ó    —  | j         ||fi |¤ŽS r_   r`   r   s       r'   ra   z(hermite_prob._eval_rewrite_as_polynomial¬  r€   r)   c                 ój   — t          d¦  «        | z  t          ||t          d¦  «        z  ¦  «        z  S r…   )r   rª   r   s       r'   Ú_eval_rewrite_as_hermitez%hermite_prob._eval_rewrite_as_hermite±  s-   € Ý�A‰wŒw˜!˜‰}�w q¨!­D°©G¬G©)Ñ4Ô4Ñ4Ð4r)   Nr�   )r1   r2   r3   r4   r‚   r   r    r5   rM   rW   r]   ra   r¹   r6   r)   r'   r±   r±   T  s‹   € € € € € ð7ð 7ðr �,Ð0Ñ1Ô1€Kàð0ð 0ñ „[ð0ð5ð 5ð 5ð 5ð:ð :ð :ð9ð 9ð 9ð
5ð 5ð 5ð 5ð 5r)   r±   c                   óR   — e Zd ZdZ ee¦  «        Zed„ ¦   «         Zdd„Z	d„ Z
d„ ZdS )	ÚlaguerreaL  
    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                 ó  — |j         du rt          d¦  «        ‚|j        sª|                     ¦   «         r=| dz
                       ¦   «         s%t	          |¦  «        t          | dz
  | ¦  «        z  S |j        rt          j        S |t          j	        u rt          j
        S |t          j
        u rt          j        |z  t          j
        z  S d S |j        r%t	          |¦  «        t          | dz
  | ¦  «        z  S |                      ||¦  «        S )NFúError: n should be an integer.r+   )r   rJ   rD   rE   r   r»   r?   r   rG   ÚNegativeInfinityrH   rF   rZ   r(   r$   s      r'   rM   zlaguerre.evalõ  s  € àŒ<˜5Ð Ð ÝÐ=Ñ>Ô>Ð>ØŒ{ð 	0ð ×)Ò)Ñ+Ô+ð 3°Q°B¸±F×3TÒ3TÑ3VÔ3Vð 3Ý˜1‘v”v�h¨ r¨A¡v°¨rÑ2Ô2Ñ2Ð2àŒyð 5Ý”u�Ø•aÔ(Ð(Ð(Ý”zÐ!Ø•a”j��Ý”} aÑ'­!¬*Ñ4Ð4ð !�ð Œ}ð 0Ý˜1‘v”v�h¨ r¨A¡v°¨rÑ2Ô2Ñ2Ð2à×)Ò)¨!¨QÑ/Ô/Ð/r)   r;   c                 ó˜   — |dk    rt          | |¦  «        ‚|dk    r| j        \  }}t          |dz
  d|¦  «         S t          | |¦  «        ‚ry   )r   r-   Úassoc_laguerrerz   s       r'   rW   zlaguerre.fdiff  sX   € Ø�qŠ=ˆ=å$ T¨8Ñ4Ô4Ð4Ø˜Š]ˆ]à”9‰DˆAˆqÝ" 1 q¡5¨!¨QÑ/Ô/Ð/Ð/å$ T¨8Ñ4Ô4Ð4r)   c                 ó$  — ddl m} |j        r$t          |¦  «         | j        | dz
  | fi |¤Žz  S |j        du rt          d¦  «        ‚t          d¦  «        }t          | |¦  «        t          |¦  «        dz  z  ||z  z  } |||d|f¦  «        S )Nr   rP   r+   Fr½   rR   r;   )
rS   rQ   rZ   r   r]   r   rJ   r   r
   r	   r}   s          r'   r]   zlaguerre._eval_rewrite_as_Sum  s¸   € Ø1Ð1Ð1Ð1Ð1Ð1àŒ=ð 	LÝ�q‘6”6Ð5˜DÔ5°q°b¸1±f¸q¸bÐKÐKÀFÐKÐKÑKÐKØŒ<˜5Ð Ð ÝÐ=Ñ>Ô>Ð>Ý�#‰JŒJˆÝ ˜r 1Ñ%Ô%­	°!©¬°a©Ñ7¸!¸Q¹$Ñ>ˆØˆs�4˜!˜Q ˜Ñ#Ô#Ð#r)   c                 ó    —  | j         ||fi |¤ŽS r_   r`   r   s       r'   ra   z$laguerre._eval_rewrite_as_polynomial"  r€   r)   Nr�   )r1   r2   r3   r4   r‚   r   r    r5   rM   rW   r]   ra   r6   r)   r'   r»   r»   º  s{   € € € € € ð6ð 6ðp �,˜}Ñ-Ô-€Kàð0ð 0ñ „[ð0ð,	5ð 	5ð 	5ð 	5ð	$ð 	$ð 	$ð9ð 9ð 9ð 9ð 9r)   r»   c                   óB   — e Zd ZdZed„ ¦   «         Zd	d„Zd„ Zd„ Zd„ Z	dS )
rÀ   aj  
    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                 ón  — |j         rt          ||¦  «        S |j        sn|j         rt          ||z   |¦  «        S |t          j        u r"|dk    rt          j        |z  t          j        z  S |t          j        u r|dk    rt          j        S d S d S |j        rt          d|z  ¦  «        ‚t          |||¦  «        S )Nr   r¬   )r?   r»   rD   r   r   rH   rF   r¾   rZ   rJ   r   )r%   r&   Úalphar   s       r'   rM   zassoc_laguerre.evalo  sÒ   € ð Œ=ð 	"Ý˜A˜q‘>”>Ð!àŒ{ð 	2àŒyð "Ý  E¡	¨5Ñ1Ô1Ð1Ø•a”j�� Q¨¢U UÝ”} aÑ'­!¬*Ñ4Ð4Ø•aÔ(Ð(Ð(¨Q°ªU¨UÝ”zÐ!ð )Ð(¨U¨Uð Œ}ð 2Ý ØFÈÑJñLô Lð Lõ % Q¨¨5Ñ1Ô1Ð1r)   r<   c                 ó:  — ddl m} |dk    rt          | |¦  «        ‚|dk    rA| j        \  }}}t	          d¦  «        } |t          |||¦  «        ||z
  z  |d|dz
  f¦  «        S |dk    r#| j        \  }}}t          |dz
  |dz   |¦  «         S t          | |¦  «        ‚)Nr   rP   r+   r;   rR   r<   )rS   rQ   r   r-   r   rÀ   )r/   rT   rQ   r&   rÅ   r   rR   s          r'   rW   zassoc_laguerre.fdiff…  sÂ   € Ø1Ð1Ð1Ð1Ð1Ð1Ø�qŠ=ˆ=å$ T¨8Ñ4Ô4Ð4Ø˜Š]ˆ]àœ)‰KˆAˆu�aÝ�c‘
”
ˆAØ�3•~ a¨°Ñ2Ô2°a¸%±iÑ@À1ÀaÈÈQÉÀ-ÑPÔPÐPØ˜Š]ˆ]àœ)‰KˆAˆu�aÝ" 1 q¡5¨%°!©)°QÑ7Ô7Ð7Ð7å$ T¨8Ñ4Ô4Ð4r)   c                 óN  — ddl m} |j        s	|j        du rt	          d¦  «        ‚t          d¦  «        }t          | |¦  «        t          ||z   dz   ¦  «        t          |¦  «        z  z  ||z  z  }t          ||z   dz   ¦  «        t          |¦  «        z   |||d|f¦  «        z  S )Nr   rP   FrY   rR   r+   )	rS   rQ   rZ   r   rJ   r   r
   r   r	   )r/   r&   rÅ   r   r[   rQ   rR   r\   s           r'   r]   z#assoc_laguerre._eval_rewrite_as_Sum–  sÃ   € Ø1Ð1Ð1Ð1Ð1Ð1àŒ=ð 	K˜AœL¨EÐ1Ð1ÝÐIÑJÔJÐJÝ�#‰JŒJˆÝØˆB�ñô Ý˜A ™I¨™MÑ*Ô*­Y°q©\¬\Ñ9ñ;Ø=>À¹TñBˆå�Q˜‘Y ‘]Ñ#Ô#¥i°¡l¤lÑ2°S°S¸ÀÀ1Àa¸yÑ5IÔ5IÑIÐIr)   c                 ó"   —  | j         |||fi |¤ŽS r_   r`   )r/   r&   rÅ   r   r[   s        r'   ra   z*assoc_laguerre._eval_rewrite_as_polynomial   s#   € ð )ˆtÔ(¨¨E°1Ð?Ð?¸Ð?Ð?Ð?r)   c                 óŽ   — | j         \  }}}|                      ||                     ¦   «         |                     ¦   «         ¦  «        S r_   rc   )r/   r&   rÅ   r   s       r'   r0   zassoc_laguerre._eval_conjugate¥  s7   € Ø”i‰ˆˆ5�!Ø�yŠy˜˜EŸOšOÑ-Ô-¨q¯{ª{©}¬}Ñ=Ô=Ð=r)   Nru   rd   r6   r)   r'   rÀ   rÀ   (  sƒ   € € € € € ðDð DðL ð2ð 2ñ „[ð2ð*5ð 5ð 5ð 5ð"Jð Jð Jð@ð @ð @ð
>ð >ð >ð >ð >r)   rÀ   N)5r4   Ú
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   r8   rg   rB   r>   rA   rŒ   r”   r@   rC   rª   r±   r»   rÀ   r6   r)   r'   ú<module>r×      s=  ððð ð  Ð Ð Ð Ð Ð Ø CÐ CÐ CÐ CÐ CÐ CÐ CÐ CØ "Ð "Ð "Ð "Ð "Ð "Ø #Ð #Ð #Ð #Ð #Ð #Ø YÐ YÐ YÐ YÐ YÐ YÐ YÐ YÐ YÐ YØ 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø 6Ð 6Ð 6Ð 6Ð 6Ð 6Ø 5Ð 5Ð 5Ð 5Ð 5Ð 5Ø 9Ð 9Ð 9Ð 9Ð 9Ð 9Ø =Ð =Ð =Ð =Ð =Ð =Ð =Ð =Ø 9Ð 9Ð 9Ð 9Ð 9Ð 9Ø /Ð /Ð /Ð /Ð /Ð /ðOð Oð Oð Oð Oð Oð Oð Oð Oð Oð Oð Oð Oð Oð Oð Oð Oð Oð Oð Oð €Uˆ3�Z„Z€ð
Að 
Að 
Að 
Að 
A˜?ñ 
Aô 
Að 
Að"dIð dIð dIð dIð dIÐ!ñ dIô dIð dIðNF.ð F.ð F.ð\R:ð R:ð R:ð R:ð R:Ð%ñ R:ô R:ð R:ðrs9ð s9ð s9ð s9ð s9Ð%ñ s9ô s9ð s9ðl{9ð {9ð {9ð {9ð {9Ð%ñ {9ô {9ð {9ð|&)ð &)ð &)ð &)ð &)�oñ &)ô &)ð &)ðR&)ð &)ð &)ð &)ð &)�oñ &)ô &)ð &)ðZq9ð q9ð q9ð q9ð q9Ð#ñ q9ô q9ð q9ðhn:ð n:ð n:ð n:ð n:�_ñ n:ô n:ð n:ðjc7ð c7ð c7ð c7ð c7Ð"ñ c7ô c7ð c7ðL^5ð ^5ð ^5ð ^5ð ^5Ð'ñ ^5ô ^5ð ^5ðLk9ð k9ð k9ð k9ð k9Ð#ñ k9ô k9ð k9ð\>ð >ð >ð >ð >Ð)ñ >ô >ð >ð >ð >r)   