
    sg ^                        d 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
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mZmZ ddlmZmZmZmZ ddlm Z m!Z!m"Z" ddl#m$Z$m%Z% ddl&m'Z' ddl(m)Z) ddl*m+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      Z1ed        Z2y)z$ Riemann zeta and related function.     )Add)cacheit)ArgumentIndexError
expand_mulFunction)piIInteger)Eq)S)Dummy)sympify)	bernoulli	factorialgenocchiharmonic)re
unpolarifyAbs
polar_lift)log	exp_polarexp)ceilingfloor)sqrt)	Piecewise)Polyc                   0    e Zd ZdZd ZddZd Zd Zd Zy)	lerchphia^  
    Lerch transcendent (Lerch phi function).

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

    For $\operatorname{Re}(a) > 0$, $|z| < 1$ and $s \in \mathbb{C}$, the
    Lerch transcendent is defined as

    .. math :: \Phi(z, s, a) = \sum_{n=0}^\infty \frac{z^n}{(n + a)^s},

    where the standard branch of the argument is used for $n + a$,
    and by analytic continuation for other values of the parameters.

    A commonly used related function is the Lerch zeta function, defined by

    .. math:: L(q, s, a) = \Phi(e^{2\pi i q}, s, a).

    **Analytic Continuation and Branching Behavior**

    It can be shown that

    .. math:: \Phi(z, s, a) = z\Phi(z, s, a+1) + a^{-s}.

    This provides the analytic continuation to $\operatorname{Re}(a) \le 0$.

    Assume now $\operatorname{Re}(a) > 0$. The integral representation

    .. math:: \Phi_0(z, s, a) = \int_0^\infty \frac{t^{s-1} e^{-at}}{1 - ze^{-t}}
                                \frac{\mathrm{d}t}{\Gamma(s)}

    provides an analytic continuation to $\mathbb{C} - [1, \infty)$.
    Finally, for $x \in (1, \infty)$ we find

    .. math:: \lim_{\epsilon \to 0^+} \Phi_0(x + i\epsilon, s, a)
             -\lim_{\epsilon \to 0^+} \Phi_0(x - i\epsilon, s, a)
             = \frac{2\pi i \log^{s-1}{x}}{x^a \Gamma(s)},

    using the standard branch for both $\log{x}$ and
    $\log{\log{x}}$ (a branch of $\log{\log{x}}$ is needed to
    evaluate $\log{x}^{s-1}$).
    This concludes the analytic continuation. The Lerch transcendent is thus
    branched at $z \in \{0, 1, \infty\}$ and
    $a \in \mathbb{Z}_{\le 0}$. For fixed $z, a$ outside these
    branch points, it is an entire function of $s$.

    Examples
    ========

    The Lerch transcendent is a fairly general function, for this reason it does
    not automatically evaluate to simpler functions. Use ``expand_func()`` to
    achieve this.

    If $z=1$, the Lerch transcendent reduces to the Hurwitz zeta function:

    >>> from sympy import lerchphi, expand_func
    >>> from sympy.abc import z, s, a
    >>> expand_func(lerchphi(1, s, a))
    zeta(s, a)

    More generally, if $z$ is a root of unity, the Lerch transcendent
    reduces to a sum of Hurwitz zeta functions:

    >>> expand_func(lerchphi(-1, s, a))
    zeta(s, a/2)/2**s - zeta(s, a/2 + 1/2)/2**s

    If $a=1$, the Lerch transcendent reduces to the polylogarithm:

    >>> expand_func(lerchphi(z, s, 1))
    polylog(s, z)/z

    More generally, if $a$ is rational, the Lerch transcendent reduces
    to a sum of polylogarithms:

    >>> from sympy import S
    >>> expand_func(lerchphi(z, s, S(1)/2))
    2**(s - 1)*(polylog(s, sqrt(z))/sqrt(z) -
                polylog(s, sqrt(z)*exp_polar(I*pi))/sqrt(z))
    >>> expand_func(lerchphi(z, s, S(3)/2))
    -2**s/z + 2**(s - 1)*(polylog(s, sqrt(z))/sqrt(z) -
                          polylog(s, sqrt(z)*exp_polar(I*pi))/sqrt(z))/z

    The derivatives with respect to $z$ and $a$ can be computed in
    closed form:

    >>> lerchphi(z, s, a).diff(z)
    (-a*lerchphi(z, s, a) + lerchphi(z, s - 1, a))/z
    >>> lerchphi(z, s, a).diff(a)
    -s*lerchphi(z, s + 1, a)

    See Also
    ========

    polylog, zeta

    References
    ==========

    .. [1] Bateman, H.; Erdelyi, A. (1953), Higher Transcendental Functions,
           Vol. I, New York: McGraw-Hill. Section 1.11.
    .. [2] https://dlmf.nist.gov/25.14
    .. [3] https://en.wikipedia.org/wiki/Lerch_transcendent

    c                 @   | j                   \  }}}|dk(  rt        ||      S |j                  r|dk  rt        d      }t	        ||z   | z  |      }dd|z
  z  }t
        j                  }t        |j                               D ]  }	||	|z  z  }||j                  |      z  }  |j                  ||      S |j                  rt
        j                  }
t
        j                  }|dkD  rPt        |      }||k(  r|dz  }||z  }|| z  }t        t        |      D cg c]  }|||z
  z   ||z   |z  z   c} }
nR|dk  rMt        |       dz   }||z  }||z  }t        t        |      D cg c]  }||dz
  |z
  z  ||z
  dz
  |z  z   c} }
t        |j                   |j"                  g      \  }}t%        dt&        z  t(        z  |z        }|d|z  z  }t+        |      }g }t        |      D ]S  }t-        |||z  |z        }t/        |t,              r |j0                  di |}|j3                  |||z  |z  |z  z         U |
|||dz
  z  z  t        | z  z   S t/        |t4              r'|j                   d   t&        t(        z  z  j                  s|dt(        t(         fv r|dk(  rt        ddg      \  }}ny|t(        k(  rt        ddg      \  }}n_|t(         k(  rt        ddg      \  }}nD|j                   d   dt&        z  t(        z  z  }t        |j                   |j"                  g      \  }}t        t        |      D cg c]=  }t5        dt&        z  t(        z  |z  |z  |z        ||z  z  t        |||z   |z        z  ? c} S t7        |||      S c c}w c c}w c c}w )N   r   t       )argszeta
is_Integerr   r   r   Zeroreversed
all_coeffsdiffsubsis_RationalOner   r   rangepqr   r   r	   r   polylog
isinstance_eval_expand_funcappendr   r    )selfhintszsar#   r3   startrescaddmulnkmzetrootup_zetaddargsr4   args                        Y/var/www/html/venv/lib/python3.12/site-packages/sympy/functions/special/zeta_functions.pyr7   zlerchphi._eval_expand_func   s   ))1a61:<<AFc
Aa!er]A&Aq1uIE&&Calln- (qw%**Q-( 88Aq>!== &&C%%C1u!H6FAQ1"gE!HEqQQZKQ
2EFa1"IMQd58LaAA	NAEAI>9LMacc133Z=DAqAbDF1H%Cqs8D_FG1X 6AsAvd{+a)+++4e4Aq&!)D.1!445	6
 QQZW555 a166!9bd#3"@"@A"aRSQSDTBw!Qy1a!Qy1qb"az1ffQi2a(#%%(1"'(, QrT!VAXaZ\*1a4/QQ	0BB , - - 1a  E F
 M4,s   N'N>ANc                     | j                   \  }}}|dk(  r| t        ||dz   |      z  S |dk(  r$t        ||dz
  |      |t        |||      z  z
  |z  S t        )N   r"   )r(   r    r   )r9   argindexr;   r<   r=   s        rK   fdiffzlerchphi.fdiff   sj    ))1aq=2hq!a%+++]QAq)Ahq!Q.?,??BB$$    c                 L    | j                         }|j                  |      r|S | S N)r7   has)r9   targetr?   s      rK   _eval_rewrite_helperzlerchphi._eval_rewrite_helper   s%    $$&776?JKrP   c                 ,    | j                  t              S rR   )rU   r)   r9   r;   r<   r=   kwargss        rK   _eval_rewrite_as_zetazlerchphi._eval_rewrite_as_zeta   s    ((..rP   c                 ,    | j                  t              S rR   )rU   r5   rW   s        rK   _eval_rewrite_as_polylogz!lerchphi._eval_rewrite_as_polylog   s    ((11rP   Nr"   )	__name__
__module____qualname____doc__r7   rO   rU   rY   r[   r'   rP   rK   r    r       s#    gR?!B%/2rP   r    c                   N     e Zd ZdZed        ZddZd Zd Zd Z	d	 fd	Z
 xZS )
r5   a  
    Polylogarithm function.

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

    For $|z| < 1$ and $s \in \mathbb{C}$, the polylogarithm is
    defined by

    .. math:: \operatorname{Li}_s(z) = \sum_{n=1}^\infty \frac{z^n}{n^s},

    where the standard branch of the argument is used for $n$. It admits
    an analytic continuation which is branched at $z=1$ (notably not on the
    sheet of initial definition), $z=0$ and $z=\infty$.

    The name polylogarithm comes from the fact that for $s=1$, the
    polylogarithm is related to the ordinary logarithm (see examples), and that

    .. math:: \operatorname{Li}_{s+1}(z) =
                    \int_0^z \frac{\operatorname{Li}_s(t)}{t} \mathrm{d}t.

    The polylogarithm is a special case of the Lerch transcendent:

    .. math:: \operatorname{Li}_{s}(z) = z \Phi(z, s, 1).

    Examples
    ========

    For $z \in \{0, 1, -1\}$, the polylogarithm is automatically expressed
    using other functions:

    >>> from sympy import polylog
    >>> from sympy.abc import s
    >>> polylog(s, 0)
    0
    >>> polylog(s, 1)
    zeta(s)
    >>> polylog(s, -1)
    -dirichlet_eta(s)

    If $s$ is a negative integer, $0$ or $1$, the polylogarithm can be
    expressed using elementary functions. This can be done using
    ``expand_func()``:

    >>> from sympy import expand_func
    >>> from sympy.abc import z
    >>> expand_func(polylog(1, z))
    -log(1 - z)
    >>> expand_func(polylog(0, z))
    z/(1 - z)

    The derivative with respect to $z$ can be computed in closed form:

    >>> polylog(s, z).diff(z)
    polylog(s - 1, z)/z

    The polylogarithm can be expressed in terms of the lerch transcendent:

    >>> from sympy import lerchphi
    >>> polylog(s, z).rewrite(lerchphi)
    z*lerchphi(z, s, 1)

    See Also
    ========

    zeta, lerchphi

    c                    |j                   ru|t        j                  u rt        |      S |t        j                  u rt        |       S |t        j                  u rt        j                  S |dk(  rt               }||v r||   S |j                  rt        j                  S |j                  t        j                        }|rt        |      S |du rK|t        j                  u r|d|z
  z  S |t        j                  u r|d|z
  dz  z  S |j                  r|d|z
  z  S |j                  t        t              r4|st        |      t        j                  k  dk(  r | |t        |            S y y )Nr$   Fr"   T)	is_numberr   r1   r)   NegativeOnedirichlet_etar+   _dilogtableis_zeroequalsrS   r   r   r   r   )clsr<   r;   
dilogtablezones        rK   evalzpolylog.eval$  s-   ;;AEEzAwamm#%a(((affvva(]

?%a=(9966M xx7NU]
 AFF{!a%y amm#!a%!|#yy!a%y  55J'Tc!fo$5Nq*Q-(( 6O'rP   c                 Z    | j                   \  }}|dk(  rt        |dz
  |      |z  S t        )Nr$   r"   )r(   r5   r   )r9   rN   r<   r;   s       rK   rO   zpolylog.fdiffK  s2    yy1q=1q5!$Q&&  rP   c                 "    |t        ||d      z  S Nr"   r    )r9   r<   r;   rX   s       rK   _eval_rewrite_as_lerchphiz!polylog._eval_rewrite_as_lerchphiQ  s    !Q"""rP   c                 (   | j                   \  }}|dk(  rt        d|z
         S |j                  rX|dk  rSt        d      }|d|z
  z  }t	        |       D ]  }||j                  |      z  } t        |      j                  ||      S t        ||      S )Nr"   r   u)	r(   r   r*   r   r2   r.   r   r/   r5   )r9   r:   r<   r;   rs   r>   _s          rK   r7   zpolylog._eval_expand_funcT  s    yy16AJ;<<AFc
Aq1uIEA2Y (%**Q-(e$))!Q//q!}rP   c                 <    | j                   d   }|j                  ryy )Nr"   Tr(   rg   )r9   r;   s     rK   _eval_is_zerozpolylog._eval_is_zero`  s    IIaL99 rP   c                    ddl m} | j                  \  }}|j                  |d      }|t        j
                  u r+|j                  |dt        |      j                  rdnd      }|j                  r	 |j                  |      \  }	}
|
j                  rt        ||
z        } |||z  |      }|j                  ||||      j!                         }|t        j"                  u r|S |}|g}t%        d|      D ]  }||z  }|j'                  |||z  z           t)        | |z   S t*        t,        | ?  ||||      S # t        t        f$ r | cY S w xY w)Nr   )Order-+)dirr$   )sympy.series.orderry   r(   r/   r   NaNlimitr   is_negativerg   leadterm
ValueErrorNotImplementedErroris_positiver   _eval_nseriesremoveOr+   r2   r8   r   superr5   )r9   xrC   logxcdirry   nur;   z0rt   r   newnortermr<   rD   	__class__s                    rK   r   zpolylog._eval_nseriese  s@   ,		AVVAq\;A"T(*>*>3CHB::A3 qu~!Q$NOOAq$5==?;HFq$ )AAIDHHT!R%Z() Aw{"Wd1!QdCC#  34 s   3D6 6E
	E
r\   )r   )r]   r^   r_   r`   classmethodrl   rO   rq   r7   rw   r   __classcell__r   s   @rK   r5   r5      s?    CJ $) $)L!#

D DrP   r5   c                   b     e Zd ZdZed
d       ZddZddZddZd Z	d Z
ddZd fd		Z xZS )r)   a
  
    Hurwitz zeta function (or Riemann zeta function).

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

    For $\operatorname{Re}(a) > 0$ and $\operatorname{Re}(s) > 1$, this
    function is defined as

    .. math:: \zeta(s, a) = \sum_{n=0}^\infty \frac{1}{(n + a)^s},

    where the standard choice of argument for $n + a$ is used. For fixed
    $a$ not a nonpositive integer the Hurwitz zeta function admits a
    meromorphic continuation to all of $\mathbb{C}$; it is an unbranched
    function with a simple pole at $s = 1$.

    The Hurwitz zeta function is a special case of the Lerch transcendent:

    .. math:: \zeta(s, a) = \Phi(1, s, a).

    This formula defines an analytic continuation for all possible values of
    $s$ and $a$ (also $\operatorname{Re}(a) < 0$), see the documentation of
    :class:`lerchphi` for a description of the branching behavior.

    If no value is passed for $a$ a default value of $a = 1$ is assumed,
    yielding the Riemann zeta function.

    Examples
    ========

    For $a = 1$ the Hurwitz zeta function reduces to the famous Riemann
    zeta function:

    .. math:: \zeta(s, 1) = \zeta(s) = \sum_{n=1}^\infty \frac{1}{n^s}.

    >>> from sympy import zeta
    >>> from sympy.abc import s
    >>> zeta(s, 1)
    zeta(s)
    >>> zeta(s)
    zeta(s)

    The Riemann zeta function can also be expressed using the Dirichlet eta
    function:

    >>> from sympy import dirichlet_eta
    >>> zeta(s).rewrite(dirichlet_eta)
    dirichlet_eta(s)/(1 - 2**(1 - s))

    The Riemann zeta function at nonnegative even and negative integer
    values is related to the Bernoulli numbers and polynomials:

    >>> zeta(2)
    pi**2/6
    >>> zeta(4)
    pi**4/90
    >>> zeta(0)
    -1/2
    >>> zeta(-1)
    -1/12
    >>> zeta(-4)
    0

    The specific formulae are:

    .. math:: \zeta(2n) = -\frac{(2\pi i)^{2n} B_{2n}}{2(2n)!}
    .. math:: \zeta(-n,a) = -\frac{B_{n+1}(a)}{n+1}

    No closed-form expressions are known at positive odd integers, but
    numerical evaluation is possible:

    >>> zeta(3).n()
    1.20205690315959

    The derivative of $\zeta(s, a)$ with respect to $a$ can be computed:

    >>> from sympy.abc import a
    >>> zeta(s, a).diff(a)
    -s*zeta(s + 1, a)

    However the derivative with respect to $s$ has no useful closed form
    expression:

    >>> zeta(s, a).diff(s)
    Derivative(zeta(s, a), s)

    The Hurwitz zeta function can be expressed in terms of the Lerch
    transcendent, :class:`~.lerchphi`:

    >>> from sympy import lerchphi
    >>> zeta(s, a).rewrite(lerchphi)
    lerchphi(1, s, a)

    See Also
    ========

    dirichlet_eta, lerchphi, polylog

    References
    ==========

    .. [1] https://dlmf.nist.gov/25.11
    .. [2] https://en.wikipedia.org/wiki/Hurwitz_zeta_function

    c                    |t         j                  u r | |      S |t         j                  u s|t         j                  u rt         j                  S |t         j                  u rt         j                  S |t         j                  u rt         j                  S |t         j                  u rt         j
                  S |j                  }|t         j                  }|r!|j                  rt        d|z
  |      |dz
  z  S |t         j                  u r?|r<|j                  r/dt        z  t        z  |z   t        |      z  dt        |      z  z  S y y |r0|j                  r$|j                  r | |      t        |dz
  |      z
  S |j                  r:|j                  r-|j                  du s|j                  du rt         j                  S y y y )Nr"   r$   F)r   r1   r~   ComplexInfinityInfinityr+   r*   is_nonpositiver   is_evenr   r	   r   r   r   
is_integer)ri   r<   r=   sints       rK   rl   z	zeta.eval  s[   :q6M!%%Z1:55L!%%Z$$$!**_55L!**_66M||9AA$$QqS!$!,,!%%Z		2a!|il2a	!nEE "tallq}}q6HQqS!,,,\\a..&!*:*:e*C55L +D /\rP   c                     |dk(  rS|j                   rG|j                  r;|j                  r/dt        z  t        z  |z   t        |      z  dt        |      z  z  S t        d|z
  |      |dz
  z  S )Nr"   r$   )r   is_nonnegativer   r   r	   r   r   r9   r<   r=   rX   s       rK   _eval_rewrite_as_bernoullizzeta._eval_rewrite_as_bernoulli  sa    6allq'7'7AIIrT!VaK<)A,.!IaL.AA1a AaC((rP   c                 \    |dk7  r| S | j                   d   }t        |      ddd|z
  z  z
  z  S )Nr"   r   r$   )r(   re   r   s       rK   _eval_rewrite_as_dirichlet_etaz#zeta._eval_rewrite_as_dirichlet_eta  s7    6KIIaLQQQZ00rP   c                     t        d||      S ro   rp   r   s       rK   rq   zzeta._eval_rewrite_as_lerchphi  s    1a  rP   c                 F    | j                   d   dz
  j                  }|| S y )Nr   r"   rv   )r9   
arg_is_ones     rK   _eval_is_finitezzeta._eval_is_finite  s-    iilQ&//
!!>! "rP   c                 h   | j                   d   }t        | j                         dkD  r| j                   d   nt        j                  }|j                  r_|j
                  rt        |      t        |dz
  |      z
  S |j                  r,|j                  du s|j                  du rt        j                  S | S )Nr   r"   F)
r(   lenr   r1   r   r   r)   r   r   r~   )r9   r:   r<   r=   s       rK   r7   zzeta._eval_expand_func#  s    IIaL		NQ.DIIaLAEE<<}}Aw!A#q!111Q\\U%:$$-uurP   c                     t        | j                        dk(  r| j                  \  }}n| j                  dz   \  }}|dk(  r| t        |dz   |      z  S t        )Nr$   r\   r"   )r   r(   r)   r   )r9   rN   r<   r=   s       rK   rO   z
zeta.fdiff.  sU    tyy>Q99DAq99t#DAqq=2d1q5!n$$$$rP   c                 H   t        | j                        dk(  r| j                  \  }}n!| j                  t        j                  fz   \  }}	 |j	                  |      \  }}|j                  r|j                  st
        t        t        | +  |||      S # t
        $ r | cY S w xY w)Nr$   )r   r(   r   r1   r   r   r   r   r   r)   _eval_as_leading_term)	r9   r   r   r   r<   r=   r@   er   s	           rK   r   zzeta._eval_as_leading_term8  s    tyy>Q99DAq99x'DAq	::a=DAq ==%%T46q$EE # 	K	s   B B! B!rR   r\   )Nr   )r]   r^   r_   r`   r   rl   r   r   rq   r   r7   rO   r   r   r   s   @rK   r)   r)     sH    hT  4)
1!"
	%F FrP   r)   c                   N    e Zd ZdZedd       ZddZej                  fdZ	d Z
y)	re   a  
    Dirichlet eta function.

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

    For $\operatorname{Re}(s) > 0$ and $0 < x \le 1$, this function is defined as

    .. math:: \eta(s, a) = \sum_{n=0}^\infty \frac{(-1)^n}{(n+a)^s}.

    It admits a unique analytic continuation to all of $\mathbb{C}$ for any
    fixed $a$ not a nonpositive integer. It is an entire, unbranched function.

    It can be expressed using the Hurwitz zeta function as

    .. math:: \eta(s, a) = \zeta(s,a) - 2^{1-s} \zeta\left(s, \frac{a+1}{2}\right)

    and using the generalized Genocchi function as

    .. math:: \eta(s, a) = \frac{G(1-s, a)}{2(s-1)}.

    In both cases the limiting value of $\log2 - \psi(a) + \psi\left(\frac{a+1}{2}\right)$
    is used when $s = 1$.

    Examples
    ========

    >>> from sympy import dirichlet_eta, zeta
    >>> from sympy.abc import s
    >>> dirichlet_eta(s).rewrite(zeta)
    Piecewise((log(2), Eq(s, 1)), ((1 - 2**(1 - s))*zeta(s), True))

    See Also
    ========

    zeta

    References
    ==========

    .. [1] https://en.wikipedia.org/wiki/Dirichlet_eta_function
    .. [2] Peter Luschny, "An introduction to the Bernoulli function",
           https://arxiv.org/abs/2009.06743

    Nc                    |t         j                  u r | |      S |?|dk(  rt        d      S t        |      }|j	                  t              sddd|z
  z  z
  |z  S y |dk(  r)ddlm} t        d       ||      z
   ||dz   dz        z   S t        ||      }t        ||dz   dz        }|j	                  t              s$|j	                  t              s|dd|z
  z  |z  z
  S y y )Nr"   r$   r   digamma)r   r1   r   r)   rS   'sympy.functions.special.gamma_functionsr   )ri   r<   r=   r;   r   z1z2s          rK   rl   zdirichlet_eta.evalx  s    :q6M9Av1vQA55;A!H))!VGq6GAJ&!A#q)999!QZ!ac1Wvvd|BFF4LAaC2%% %1|rP   c           
      J   ddl m} |dk(  r8t        t        d      t	        |d      fddd|z
  z  z
  t        |      z  df      S t        t        d       ||      z
   ||dz   dz        z   t	        |d      ft        ||      dd|z
  z  t        ||dz   dz        z  z
  df      S )Nr   r   r"   r$   T)r   r   r   r   r   r)   r9   r<   r=   rX   r   s        rK   rY   z#dirichlet_eta._eval_rewrite_as_zeta  s    C6c!fbAh/1q1Q3x<472JD1QRR#a&71:-1a0@@"Q(Kaa!A#ha!A#q)9994@B 	BrP   c                     ddl m} t        t        d       ||      z
   ||dz   dz        z   t	        |d      ft        d|z
  |      d|dz
  z  z  df      S )Nr   r   r$   r"   T)r   r   r   r   r   r   r   s        rK   _eval_rewrite_as_genocchiz'dirichlet_eta._eval_rewrite_as_genocchi  s^    C#a&71:-1a0@@"Q(K!A#q!Q!A#Y/68 	8rP   c                     t        d | j                  D              r$| j                  t              j	                  |      S y )Nc              3   4   K   | ]  }|j                     y wrR   )rc   ).0is     rK   	<genexpr>z,dirichlet_eta._eval_evalf.<locals>.<genexpr>  s     .qq{{.s   )allr(   rewriter)   _eval_evalf)r9   precs     rK   r   zdirichlet_eta._eval_evalf  s3    .DII..<<%11$77 /rP   rR   r\   )r]   r^   r_   r`   r   rl   rY   r   r1   r   r   r'   rP   rK   re   re   I  s5    ,\ & &$B ./UU 8
8rP   re   c                   &    e Zd ZdZed        Zd Zy)
riemann_xia  
    Riemann Xi function.

    Examples
    ========

    The Riemann Xi function is closely related to the Riemann zeta function.
    The zeros of Riemann Xi function are precisely the non-trivial zeros
    of the zeta function.

    >>> from sympy import riemann_xi, zeta
    >>> from sympy.abc import s
    >>> riemann_xi(s).rewrite(zeta)
    s*(s - 1)*gamma(s/2)*zeta(s)/(2*pi**(s/2))

    References
    ==========

    .. [1] https://en.wikipedia.org/wiki/Riemann_Xi_function

    c                     ddl m} t        |      }|t        j                  t        j
                  fv rt        j                  S t        |t              s'||dz
  z   ||dz        z  |z  dt        |dz  z  z  z  S y Nr   )gammar"   r$   )	r   r   r)   r   r+   r1   Halfr6   r   )ri   r<   r   r;   s       rK   rl   zriemann_xi.eval  sk    AG66M!T"a!e9U1Q3Z')1R!A#Y;77 #rP   c                 n    ddl m} ||dz
  z   ||dz        z  t        |      z  dt        |dz  z  z  z  S r   )r   r   r)   r   )r9   r<   rX   r   s       rK   rY   z riemann_xi._eval_rewrite_as_zeta  s:    A!a%yqs#DG+QrAaCy[99rP   N)r]   r^   r_   r`   r   rl   rY   r'   rP   rK   r   r     s     . 8 8:rP   r   c                   "    e Zd ZdZedd       Zy)	stieltjesa  
    Represents Stieltjes constants, $\gamma_{k}$ that occur in
    Laurent Series expansion of the Riemann zeta function.

    Examples
    ========

    >>> from sympy import stieltjes
    >>> from sympy.abc import n, m
    >>> stieltjes(n)
    stieltjes(n)

    The zero'th stieltjes constant:

    >>> stieltjes(0)
    EulerGamma
    >>> stieltjes(0, 1)
    EulerGamma

    For generalized stieltjes constants:

    >>> stieltjes(n, m)
    stieltjes(n, m)

    Constants are only defined for integers >= 0:

    >>> stieltjes(-1)
    zoo

    References
    ==========

    .. [1] https://en.wikipedia.org/wiki/Stieltjes_constants

    Nc                 r   |Ut        |      }|t        j                  u rt        j                  S |j                  r|j                  rt        j
                  S |j                  ry|t        j                  u rt        j                  S |dk  rt        j
                  S |j                  st        j
                  S |t        j                  u r|dv rt        j                  S |j                  rt        j
                  S |j                  r|dv rt        j                  S |j                  dk(  rt        j
                  S y )Nr   ro   F)r   r   r~   r*   r   r   	is_Numberr+   
EulerGammais_extended_negativerg   r   )ri   rC   r=   s      rK   rl   zstieltjes.eval  s    =
AAEEzuu|| 0 0(((;;AEEzuuQ(((\\(((affi||#!!$$$99i<<<<5 $$$ !rP   rR   )r]   r^   r_   r`   r   rl   r'   rP   rK   r   r     s    "H % %rP   r   c                     t         j                  t        dz  dz  t        d      dz  dz  z
  t	        d      t        dz  dz  t
        t        z  t        d      z  z
  t        d      dz
   dz  t        dz   dz  t        t        d      dz
  dz        dz  dz  z   t        d      dz    dz  t        dz   dz  t        t        d      dz   dz        dz  z
  dt        d      z
  dz  t        dz  dz  t        t        d      dz
  dz        dz  z
  t        d      dz
  dz  t        dz  dz  t        t        d      dz
  dz        dz  z
  t
        t
        t         j                  z  t        dz  d	z  z
  t
         t
         t         j                  z  t        dz  d	z  z
  dt
        z
  t        dz  d
z  t
        t         j                  z  z
  t        t
        z  dz  t        d      z  z
  dt
        z   t        dz  d
z  t
        t         j                  z  z   t        t
        z  dz  t        d      z  z   dt
        z
  dz  t        d      dz   dz  t        t
        z  t        d      z  dz  z   dt        dz  z  dz  z   t
        t         j                  z  z
  iS )Nr$      r&      r"      
   rM   0         `   )r   r   r   r   r
   r	   r   Catalanr'   rP   rK   rf   rf     s    	
Ab3q619Q;&
RU1WqtCF{*
q'A+qBE6"9sDGAIq='91'<Q'>>
q'A+qBE6"9sDGAIq='91'<<	
T!Wa"a%(S$q'!)Q%7%::	a1a"a%(S$q'!)Q%7%::	AaiiK"a%("	
aR		\BE"H$	AAb1QYY;&AaA6	AAb1QYY;&AaA6	
Q	SVQYJqL2a4A;q=01RU72:=!))K rP   N)3r`   sympy.core.addr   sympy.core.cacher   sympy.core.functionr   r   r   sympy.core.numbersr   r	   r
   sympy.core.relationalr   sympy.core.singletonr   sympy.core.symbolr   sympy.core.sympifyr   %sympy.functions.combinatorial.numbersr   r   r   r   $sympy.functions.elementary.complexesr   r   r   r   &sympy.functions.elementary.exponentialr   r   r   #sympy.functions.elementary.integersr   r   (sympy.functions.elementary.miscellaneousr   $sympy.functions.elementary.piecewiser   sympy.polys.polytoolsr   r    r5   r)   re   r   r   rf   r'   rP   rK   <module>r      s    *  $ H H - - $ " # & Z Z P P F F > 9 : &2x 2LeDh eDX|F8 |F~P8H P8f$: $:N?% ?%D 	 	rP   