Ë
    7^(h^  ã                   ó�  — 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
 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«      Z0 G d„ de«      Z1 G d„ de«      Z2 G d„ de«      Z3ed„ «       Z4y) z$ Riemann zeta and related function. é    )ÚAdd)Úcacheit)ÚArgumentIndexErrorÚ
expand_mulÚDefinedFunction)Ú	fuzzy_not)Ú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  r‚t        d«      }t	        ||z   | z  |«      }dd|z
  z  }t
        j                  }t        |j                  «       «      D ]  }	||	|z  z  }||j                  |«      z  }Œ  |j                  ||«      S |j                  �r”t
        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$   r4   ÚstartÚresÚcÚaddÚmulÚnÚkÚmÚzetÚrootÚup_zetÚaddargsr5   Úargs                        úd/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/sympy/functions/special/zeta_functions.pyr8   zlerchphi._eval_expand_funcƒ   s‘  € Ø—)‘)‰ˆˆ1ˆaØ�Š6Ü˜˜1“:ÐØ�<Š<˜A šFÜ�c“
ˆAÜ�a˜!‘e ˜r‘] AÓ&ˆAØ�q˜1‘u‘IˆEÜ—&‘&ˆCÜ˜aŸl™l›nÓ-ò (�Ø�q˜‘w‘�Ø˜%Ÿ*™* Q›-™‘ð(ð —8‘8˜A˜q“>Ð!à�=‹=ô —&‘&ˆCÜ—%‘%ˆCà�1ŠuÜ˜!“H�Ø˜’6Ø˜‘F�AØ�Q‘�Ø˜1˜"‘g�Ü¼EÀ!»HÖE°q˜Q  Q¡™Z˜K¨¨Q©°©
Ó2ÒEÐF‘Ø�a’Ü˜1˜"“I ‘M�Ø�Q‘�Ø˜‘d�ÜÄ5ÈÃ8ÖL¸a˜A  A¡¨¡	™N¨A°©E°A©I¸©>Ó9ÒLÐM�ä�a—c‘c˜1Ÿ3™3�Z“=‰DˆAˆqÜ˜Aœb™D¤™F 1™HÓ%ˆCØ�q˜‘s‘8ˆDÜ “_ˆFØˆGÜ˜1“Xò 6�Ü˜A˜s A™v d™{Ó+�Ü˜a¤Ô)Ø+˜×+Ñ+Ñ4¨eÑ4�AØ—‘˜q &¨!¡)¨D¡.°1Ñ!4Ñ4Õ5ð	6ð
 ˜˜Q  Q¡™Z™¬¨W¨Ñ5Ñ5Ð5ô �aœÔ 1§6¡6¨!¡9¬b´©dÑ#3×"@Ò"@ÀAÈ"ÌaÔRSÐQSÈÑDTà�BŠwÜ˜!˜Q˜“y‘�‘1Ø”a’Ü˜!˜Q˜“y‘�‘1Ø”q�b’Ü˜"˜a˜“z‘�‘1à—f‘f˜Q‘i ¤2¡¤a¡Ñ(�Ü˜#Ÿ%™% §¡˜Ó(‘��1ÜÜ"'¨£(ö,Øô ˜Qœr™T¤!™V A™X a™Z¨™\Ó*¨1¨a©4Ñ/´°Q¸¸Q¹À¹	Ó0BÓBò ,ð -ð -ô ˜˜1˜aÓ Ð ùò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   )r:   Úargindexr<   r=   r>   s        rL   Úfdiffzlerchphi.fdiffÄ   sj   € Ø—)‘)‰ˆˆ1ˆaØ�qŠ=Ø�2”h˜q ! a¡%¨Ó+Ñ+Ð+Ø˜Š]Ü˜Q  A¡ qÓ)¨A¬h°q¸!¸QÓ.?Ñ,?Ñ?ÀÑBÐBä$Ð$ó    c                 óL   — | j                  «       }|j                  |«      r|S | S ©N)r8   Úhas)r:   Útargetr@   s      rL   Ú_eval_rewrite_helperzlerchphi._eval_rewrite_helperÍ   s%   € Ø×$Ñ$Ó&ˆØ�7‰7�6Œ?ØˆJàˆKrQ   c                 ó,   — | j                  t        «      S rS   )rV   r*   ©r:   r<   r=   r>   Úkwargss        rL   Ú_eval_rewrite_as_zetazlerchphi._eval_rewrite_as_zetaÔ   s   € Ø×(Ñ(¬Ó.Ð.rQ   c                 ó,   — | j                  t        «      S rS   )rV   r6   rX   s        rL   Ú_eval_rewrite_as_polylogz!lerchphi._eval_rewrite_as_polylog×   s   € Ø×(Ñ(¬Ó1Ð1rQ   N©r#   )	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r8   rP   rV   rZ   r\   r(   rQ   rL   r!   r!      s#   „ ñgòR?!óB%òò/ó2rQ   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 )
r6   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   r2   r*   ÚNegativeOneÚdirichlet_etar,   Ú_dilogtableÚis_zeroÚequalsrT   r   r   r   r   )Úclsr=   r<   Ú
dilogtableÚzones        rL   Úevalzpolylog.eval%  s-  € à�;Š;Ø”A—E‘E‰zÜ˜A“w�Ø”a—m‘mÑ#Ü% aÓ(Ð(Ð(Ø”a—f‘f‘Ü—v‘v�Ø�a’Ü(›]�
Ø˜
‘?Ø% a™=Ð(à�9Š9Ü—6‘6ˆMð �x‰xœŸ™‹ˆáÜ˜“7ˆNØ�U‰]ð
 ”A—F‘F‰{Ø˜!˜a™%‘yÐ Ø”a—m‘mÑ#Ø˜!˜a™% !™‘|Ð#Ø�yŠyØ˜!˜a™%‘yÐ ð �5‰5”œJÔ'©T´c¸!³fÄÇÁ±oÈ$Ò5NÙ�qœ* Q›-Ó(Ð(ð 6OÐ'rQ   c                 óZ   — | j                   \  }}|dk(  rt        |dz
  |«      |z  S t        ‚)Nr%   r#   )r)   r6   r   )r:   rO   r=   r<   s       rL   rP   zpolylog.fdiffL  s2   € Ø�y‰y‰ˆˆ1Ø�qŠ=Ü˜1˜q™5 !Ó$ QÑ&Ð&Ü Ð rQ   c                 ó"   — |t        ||d«      z  S ©Nr#   ©r!   )r:   r=   r<   rY   s       rL   Ú_eval_rewrite_as_lerchphiz!polylog._eval_rewrite_as_lerchphiR  s   € Ø”˜!˜Q Ó"Ñ"Ð"rQ   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   r3   r/   r   r0   r6   )r:   r;   r=   r<   rt   r?   Ú_s          rL   r8   zpolylog._eval_expand_funcU  s“   € Ø�y‰y‰ˆˆ1Ø�Š6Ü˜˜A™“J�;ÐØ�<Š<˜A šFÜ�c“
ˆAØ�q˜1‘u‘IˆEÜ˜A˜2“Yò (�Ø˜%Ÿ*™* Q›-™‘ð(ä˜eÓ$×)Ñ)¨!¨QÓ/Ð/Ü�q˜!‹}ÐrQ   c                 ó<   — | j                   d   }|j                  ryy )Nr#   T)r)   rh   )r:   r<   s     rL   Ú_eval_is_zerozpolylog._eval_is_zeroa  s   € Ø�I‰I�a‰LˆØ�9Š9Øð rQ   c                 óš  •— ddl m} | j                  \  }}|j                  |d«      }|t        j
                  u r+|j                  |dt        |«      j                  rdnd¬«      }|j                  r®	 |j                  |«      \  }	}
|
j                  r�t        ||
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)   r0   r   ÚNaNÚlimitr   Úis_negativerh   ÚleadtermÚ
ValueErrorÚNotImplementedErrorÚis_positiver   Ú_eval_nseriesÚremoveOr,   r3   r9   r   Úsuperr6   )r:   ÚxrD   ÚlogxÚcdirry   Únur<   Úz0ru   r   ÚnewnÚoÚrÚtermr=   rE   Ú	__class__s                    €rL   r…   zpolylog._eval_nseriesf  s@  ø€ Ý,Ø—	‘	‰ˆˆAà�V‰V�A�q‹\ˆØ”—‘‰;Ø—‘˜˜A¬"¨T«(×*>Ò*>¡3ÀC�ÓHˆBà�:Š:ðØŸ™ A›‘��3ð �ŠÜ˜q ™u“~�Ù˜!˜Q™$ “N�Ø—O‘O A q¨$°Ó5×=Ñ=Ó?�ØœŸ™‘;Ø�Hà�Ø�F�Ü˜q $›ò )�AØ˜A‘I�DØ—H‘H˜T ! R¡%™ZÕ(ð)ô ˜A�w ‘{Ð"ä”W˜dÑ1°!°Q¸¸dÓCÐCøô# Ô 3Ð4ò Ø’ðús   Á3D6 Ä6E
Å	E
r]   )r   )r^   r_   r`   ra   Úclassmethodrm   rP   rr   r8   rw   r…   Ú__classcell__©r‘   s   @rL   r6   r6   ß   s?   ø„ ñCðJ ñ$)ó ð$)óL!ò#ò
ò÷
Dñ DrQ   r6   c                   ó`   ‡ — 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ˆ 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   r2   r~   ÚComplexInfinityÚInfinityr,   r+   Úis_nonpositiver   Úis_evenr	   r
   r   r„   r   Ú
is_integer)rj   r=   r>   Úsints       rL   rm   z	zeta.evalö  s[  € à”—‘‰:Ù�q“6ˆMØ”!—%‘%‰Z˜1¤§¡™:Ü—5‘5ˆLØ”!—%‘%‰ZÜ×$Ñ$Ð$Ø”!—*‘*‰_Ü—5‘5ˆLØ”!—*‘*‰_Ü—6‘6ˆMà�|‰|ˆØˆ9Ü—‘ˆAÙ�A×$Ò$Ü˜Q˜q™S !Ó$¨¨!©Ñ,Ð,Ø”!—%‘%‰ZÙ˜Ÿ	š	Øœ2™œa™ !™�|¤i°£lÑ2°a¼	À!»±nÑEÐEð "ˆtá�a—l’l q§}¢}Ù�q“6œH Q q¡S¨!Ó,Ñ,Ð,Ø�\Š\˜a×.Ò.Ø—‘ Ñ&¨!×*:Ñ*:¸eÑ*CÜ—5‘5ˆLð +Dð /ˆ\rQ   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   ©r:   r=   r>   rY   s       rL   Ú_eval_rewrite_as_bernoullizzeta._eval_rewrite_as_bernoulli  sa   € Ø�Š6�a—l’l q×'7Ò'7¸A¿IºIØ”r‘Tœ!‘V˜a‘K�<¤)¨A£,Ñ.°!´I¸a³L±.ÑAÐAÜ˜˜1™˜aÓ  A a¡CÑ(Ð(rQ   c                 ó\   — |dk7  r| S | j                   d   }t        |«      ddd|z
  z  z
  z  S )Nr#   r   r%   )r)   rf   rŸ   s       rL   Ú_eval_rewrite_as_dirichlet_etaz#zeta._eval_rewrite_as_dirichlet_eta  s7   € Ø�Š6ØˆKØ�I‰I�a‰LˆÜ˜QÓ  Q¨¨Q©¡Z¡Ñ0Ð0rQ   c                 ó   — t        d||«      S rp   rq   rŸ   s       rL   rr   zzeta._eval_rewrite_as_lerchphi  s   € Ü˜˜1˜aÓ Ð rQ   c                 óL   — t        | j                  d   dz
  j                  «      S )Nr   r#   )r   r)   rh   )r:   s    rL   Ú_eval_is_finitezzeta._eval_is_finite  s    € Ü˜$Ÿ)™) A™,¨Ñ*×3Ñ3Ó4Ð4rQ   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   r2   r›   r„   r*   r   r™   r~   )r:   r;   r=   r>   s       rL   r8   zzeta._eval_expand_func"  s‰   € Ø�I‰I�a‰LˆÜ §	¡	›N¨QÒ.ˆD�I‰I�aŠL´A·E±EˆØ�<Š<Ø�}Š}Ü˜A“w¤¨!¨A©#¨qÓ!1Ñ1Ð1Ø×Ò Q§\¡\°UÑ%:Ø×$Ñ$¨Ñ-Ü—u‘u�ØˆrQ   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   )r:   rO   r=   r>   s       rL   rP   z
zeta.fdiff-  sU   € Üˆt�y‰y‹>˜QÒØ—9‘9‰DˆA‰qà—9‘9˜tÑ#‰DˆAˆqØ�qŠ=Ø�2”d˜1˜q™5 !“nÑ$Ð$ä$Ð$rQ   c                 óJ  •— 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§   r)   r   r2   r�   rƒ   r€   r„   r‡   r*   Ú_eval_as_leading_term)	r:   rˆ   r‰   rŠ   r=   r>   rA   Úer‘   s	           €rL   rª   zzeta._eval_as_leading_term7  s’   ø€ Üˆt�y‰y‹>˜QÒØ—9‘9‰DˆA‰qà—9‘9¤§¡˜xÑ'‰DˆAˆqð	Ø—:‘:˜a“=‰DˆAˆqð �=Š= §¢Ü%Ð%ä”T˜4Ñ6°q¸tÈ$Ð6ÓOÐOøô #ò 	ØŠKð	ús   ÁB ÂB"Â!B"rS   r]   )r^   r_   r`   ra   r’   rm   r    r¢   rr   r¥   r8   rP   rª   r“   r”   s   @rL   r*   r*   ‹  sH   ø„ ñhðT òó ðó4)ó
1ó!ò5ò	ó%÷Pð PrQ   r*   c                   óN   — e Zd ZdZedd„«       Zdd„Zej                  fd„Z	d„ Z
y)	rf   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   r2   r   r*   rT   Ú'sympy.functions.special.gamma_functionsr¯   )rj   r=   r>   r<   r¯   Úz1Úz2s          rL   rm   zdirichlet_eta.evalw  sÚ   € à”—‘‰:Ù�q“6ˆMØˆ9Ø�AŠvÜ˜1“v�Ü�Q“ˆAØ—5‘5œ”;Ø˜A  !¡™H™¨Ñ)Ð)ØØ�!ŠVÝGÜ�q“6™G A›JÑ&©°!°A±#°q±Ó)9Ñ9Ð9Ü�!�Q‹ZˆÜ�!�a˜‘c˜1‘WÓˆØ�v‰v”dŒ| B§F¡F¬4¤LØ˜˜A˜a™C™ 2™Ñ%Ð%ð %1ˆ|rQ   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*   ©r:   r=   r>   rY   r¯   s        rL   rZ   z#dirichlet_eta._eval_rewrite_as_zetaŠ  s¬   € ÝCØ�Š6Üœc !›f¤b¨¨A£hÐ/°1°q¸1¸Q¹3±x±<Ä4ÈÃ7Ñ2JÈDÐ1QÓRÐRÜœ#˜a›&¡7¨1£:Ñ-±¸¸1¹¸a¹Ó0@Ñ@Ä"ÀQÈÃ(ÐKÜ�a˜“˜a ! A¡#™h¬¨a°!°A±#°q±Ó)9Ñ9Ñ9¸4Ð@óBð 	BrQ   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        rL   Ú_eval_rewrite_as_genocchiz'dirichlet_eta._eval_rewrite_as_genocchi‘  s^   € ÝCÜœ#˜a›&¡7¨1£:Ñ-±¸¸1¹¸a¹Ó0@Ñ@Ä"ÀQÈÃ(ÐKÜ˜!˜A™#˜qÓ! Q¨!¨A©#¡YÑ/°Ð6ó8ð 	8rQ   c                 ó„   — t        d„ | j                  D «       «      r$| j                  t        «      j	                  |«      S y )Nc              3   ó4   K  — | ]  }|j                   –— Œ y ­wrS   )rd   )Ú.0Úis     rL   ú	<genexpr>z,dirichlet_eta._eval_evalf.<locals>.<genexpr>—  s   è ø€ Ò.˜qˆq�{�{Ñ.ùs   ‚)Úallr)   Úrewriter*   Ú_eval_evalf)r:   Úprecs     rL   r¾   zdirichlet_eta._eval_evalf–  s3   € ÜÑ. D§I¡IÔ.Ô.Ø—<‘<¤Ó%×1Ñ1°$Ó7Ð7ð /rQ   rS   r]   )r^   r_   r`   ra   r’   rm   rZ   r   r2   r¶   r¾   r(   rQ   rL   rf   rf   H  s5   „ ñ,ð\ ò&ó ð&ó$Bð ./¯U©Uó 8ó
8rQ   rf   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,   r2   ÚHalfr7   r	   )rj   r=   rÄ   r<   s       rL   rm   zriemann_xi.eval³  sk   € åAÜ�‹GˆØ”—‘œŸ™�ÑÜ—6‘6ˆMä˜!œTÔ"Ø�a˜!‘e‘9™U 1 Q¡3›ZÑ'¨Ñ)¨1¬R°!°A±#©Y©;Ñ7Ð7ð #rQ   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	   )r:   r=   rY   rÄ   s       rL   rZ   z riemann_xi._eval_rewrite_as_zeta½  s:   € ÝAØ�!�a‘%‰y™˜q ™s›Ñ#¤D¨£GÑ+¨Q¬r°A°a±C©y©[Ñ9Ð9rQ   N)r^   r_   r`   ra   r’   rm   rZ   r(   rQ   rL   rÁ   rÁ   ›  s    „ ñð. ñ8ó ð8ó:rQ   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   rp   F)r   r   r~   r+   r™   r—   Ú	is_Numberr,   Ú
EulerGammaÚis_extended_negativerh   r›   )rj   rD   r>   s      rL   rm   zstieltjes.evalç  sä   € àˆ=Ü˜“
ˆAØ”A—E‘E‰zÜ—u‘u�Ø�|Š| × 0Ò 0Ü×(Ñ(Ð(à�;Š;Ø”A—E‘E‰zÜ—u‘u�Ø�Q’Ü×(Ñ(Ð(Ø—\’\Ü×(Ñ(Ð(Ø”a—f‘f‘  i¡Ü—|‘|Ð#à×!Ò!Ü×$Ñ$Ð$à�9Š9˜˜i™Ü—<‘<Ðà�<‰<˜5Ò Ü×$Ñ$Ð$ð !rQ   rS   )r^   r_   r`   ra   r’   rm   r(   rQ   rL   rÈ   rÈ   Â  s   „ ñ"ðH ò%ó ñ%rQ   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#   é   é
   rN   é0   é   é   é`   )r   rÅ   r	   r   r   r
   r   ÚCatalanr(   rQ   rL   rg   rg     s  € ô 	
�‰”�A‘�b‘œ3˜q›6 1™9 Q™;Ñ&Ü�‹
”R˜‘U˜1‘Wœq¤™t¤C¨£F™{Ñ*Ü
ˆq‹'�A‰+ˆ�qÑœB ™E˜6 "™9¤s¬D°«G°A©I°q©=Ó'9¸1Ñ'<¸QÑ'>Ñ>Ü
ˆq‹'�A‰+ˆ�qÑœB ™E˜6 "™9¤s¬D°«G°A©I°q©=Ó'9¸1Ñ'<Ñ<Ø	
ŒT�!‹W‰�a‰œ"˜a™% ™(¤S¬$¨q«'°!©)°Q©Ó%7¸Ñ%:Ñ:Ü	ˆa‹�1‰�a‰œ"˜a™% ™(¤S¬$¨q«'°!©)°Q©Ó%7¸Ñ%:Ñ:Ü	ŒAŒa�i‰i‰Kœ"˜a™% ™(Ñ"Ü	
ˆŒaˆR”—	‘	‰\œB ™E "™HÑ$Ø	ŒA‰”�A‘�b‘œ1œQŸY™Y™;Ñ&¬¬A©¨a©´°A³©Ñ6Ø	ŒA‰”�A‘�b‘œ1œQŸY™Y™;Ñ&¬¬A©¨a©´°A³©Ñ6Ø	
ŒQ‰�‰	”S˜“V˜Q‘Y�J˜q‘L¤2¤a¡4¬¨A«¡;¨q¡=Ñ0°1´R¸±U±7¸2±:Ñ=ÄÄ!Ç)Á)ÁÑKðð rQ   N)5ra   Úsympy.core.addr   Úsympy.core.cacher   Úsympy.core.functionr   r   r   Úsympy.core.logicr   Ú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!   r6   r*   rf   rÁ   rÈ   rg   r(   rQ   rL   ú<module>rç      sµ   ðÙ *å Ý $ß OÑ OÝ &ß -Ñ -Ý $Ý "Ý #Ý &ß ZÓ Zß PÓ Pß FÑ Fß >Ý 9Ý :Ý &ô2ˆô 2ôLeDˆoô eDôXzPˆ?ô zPôzP8�Oô P8ôf$:�ô $:ôN?%�ô ?%ðD 	ñó 	ñrQ   