ó
    ‰*£h^  ã                   ó�  • S r SSKJr  SSKJr  SSKJrJrJr  SSK	J
r
  SSKJrJrJr  SSKJr  SSKJr  SS	KJr  SS
KJr  SSKJrJrJrJr  SSKJrJrJrJ r   SSK!J"r"J#r#J$r$  SSK%J&r&J'r'  SSK(J)r)  SSK*J+r+  SSK,J-r-   " S S\5      r. " S S\5      r/ " S S\5      r0 " S S\5      r1 " S S\5      r2 " S S\5      r3\S 5       r4g) 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                   ó:   • \ rS rSrSrS rS
S jrS rS rS r	Sr
g	)Úlerchphié   aB  
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                 ót  • U R                   u  p#nUS:X  a  [        X45      $ UR                  (       a†  US::  a€  [        S5      n[	        XT-   U* -  U5      nSSU-
  -  n[
        R                  n[        UR                  5       5       H  n	X‰U-  -  nXWR                  U5      -  nM     UR                  XR5      $ UR                  (       Ga–  [
        R                  n
[
        R                  nUS:”  aN  [        U5      nXÄ:X  a  US-  nXL-  nX,* -  n[        [        U5       Vs/ s H  oÒXÜ-
  -  * XM-   U-  -  PM     sn6 n
ORUS::  aL  [        U* 5      S-   nXL-  nX,-  n[        [        U5       Vs/ s H  oÒUS-
  U-
  -  XM-
  S-
  U-  -  PM     sn6 n
[        UR                   UR"                  /5      u  pì[%        S[&        -  [(        -  U-  5      nUSU-  -  n[+        U5      n/ n[        U5       HX  n[-        X?U-  U-  5      n[/        U[,        5      (       a  UR0                  " S0 UD6nUR3                  UUU-  U-  U-  -  5        MZ     X«XÃS-
  -  -  [        U6 -  -   $ [/        U[4        5      (       a,  UR                   S   [&        [(        -  -  R                  (       d  US[(        [(        * 4;   aì  US:X  a  [        SS/5      u  nnO{U[(        :X  a  [        SS/5      u  nnO`U[(        * :X  a  [        SS/5      u  nnODUR                   S   S[&        -  [(        -  -  n[        UR                   UR"                  /5      u  nn[        [        U5       Vs/ s H=  n[5        S[&        -  [(        -  U-  U-  U-  5      UU-  -  [        X=U-   U-  5      -  PM?     sn6 $ [7        X#U5      $ s  snf s  snf s  snf )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%   r5   ÚstartÚresÚcÚaddÚmulÚnÚkÚmÚzetÚrootÚup_zetÚaddargsr6   Úargs                        Úc/home/mande/repo/quber/.venv/lib/python3.13/site-packages/sympy/functions/special/zeta_functions.pyr9   Úlerchphi._eval_expand_funcƒ   sn  € Ø—)‘)‰ˆˆaØ�‹6Ü˜“:ÐØ�<�<˜A ›FÜ�c“
ˆAÜ�a‘e ˜r‘] AÓ&ˆAØ�q˜1‘u‘IˆEÜ—&‘&ˆCÜ˜aŸl™l›nÖ-�Ø˜‘w‘�ØŸ*™* Q›-™’ñ .ð —8‘8˜A“>Ð!à�=�=ˆ=ô —&‘&ˆCÜ—%‘%ˆCà�1‹uÜ˜!“H�Ø“6Ø˜‘F�AØ‘�Ø˜"‘g�Ü¼EÀ!¼HÓEºH°q ¡™Z˜K¨©°©
Ô2¹HÑEÐF‘Ø�a“Ü˜1˜"“I ‘M�Ø‘�Ø‘d�ÜÄ5ÈÄ8ÓLÂ8¸a  A¡¨¡	™N¨A©E°A©I¸©>Ô9Á8ÑLÐM�ä�a—c‘c˜1Ÿ3™3�Z“=‰DˆAÜ˜Aœb™D¤™F 1™HÓ%ˆCØ�q˜‘s‘8ˆDÜ “_ˆFØˆGÜ˜1–X�Ü˜A A™v d™{Ó+�Ü˜a¤×)Ñ)Ø×+Ò+Ñ4¨eÑ4�AØ—‘˜q &¨!¡)¨D¡.°1Ñ!4Ñ4Ö5ñ	 ð
 ˜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ô ˜Qœr™T¤!™V A™X a™Z¨™\Ó*¨1¨a©4Ñ/´°Q¸Q¹À¹	Ó0BÔBÙ"*ñ,ð -ð -ô ˜˜aÓ Ð ùòE Fùò
 Mùò4,s   Ä N+Å-N0ÍAN5c                 ó®   • U R                   u  p#nUS:X  a  U* [        X#S-   U5      -  $ US:X  a"  [        X#S-
  U5      U[        X#U5      -  -
  U-  $ [        e)Né   r$   )r*   r!   r   )r;   Úargindexr=   r>   r?   s        rM   ÚfdiffÚlerchphi.fdiffÄ   sb   € Ø—)‘)‰ˆˆaØ�q‹=Ø�2”h˜q a¡%¨Ó+Ñ+Ð+Ø˜‹]Ü˜Q A¡ qÓ)¨A¬h°q¸QÓ.?Ñ,?Ñ?ÀÑBÐBä$Ð$ó    c                 óV   • U R                  5       nUR                  U5      (       a  U$ U $ ©N)r9   Úhas)r;   ÚtargetrA   s      rM   Ú_eval_rewrite_helperÚlerchphi._eval_rewrite_helperÍ   s'   € Ø×$Ñ$Ó&ˆØ�7‰7�6�?‰?ØˆJàˆKrT   c                 ó,   • U R                  [        5      $ rV   )rY   r+   ©r;   r=   r>   r?   Úkwargss        rM   Ú_eval_rewrite_as_zetaÚlerchphi._eval_rewrite_as_zetaÔ   s   € Ø×(Ñ(¬Ó.Ð.rT   c                 ó,   • U R                  [        5      $ rV   )rY   r7   r\   s        rM   Ú_eval_rewrite_as_polylogÚ!lerchphi._eval_rewrite_as_polylog×   s   € Ø×(Ñ(¬Ó1Ð1rT   r)   N©r$   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r9   rR   rY   r^   ra   Ú__static_attributes__r)   rT   rM   r!   r!      s#   † ñgòR?!ôB%òò/õ2rT   r!   c                   ó\   ^ • \ rS rSrSr\S 5       rS
S jrS rS r	S r
SU 4S jjrS	rU =r$ )r7   éß   aR  
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                 ó  • UR                   (       ay  U[        R                  L a  [        U5      $ U[        R                  L a  [        U5      * $ U[        R                  L a  [        R                  $ US:X  a  [        5       nX#;   a  X2   $ UR                  (       a  [        R                  $ UR                  [        R                  5      nU(       a  [        U5      $ USL aR  U[        R                  L a  USU-
  -  $ U[        R                  L a  USU-
  S-  -  $ UR                  (       a  USU-
  -  $ UR                  [        [        5      (       a:  U(       d   [        U5      [        R                  :*  S:X  a  U " U[        U5      5      $ g g )Nr&   Fr$   T)Ú	is_numberr   r3   r+   ÚNegativeOneÚdirichlet_etar-   Ú_dilogtableÚis_zeroÚequalsrW   r   r   r   r   )Úclsr>   r=   Ú
dilogtableÚzones        rM   ÚevalÚpolylog.eval%  s,  € à�;�;Ø”A—E‘EŠzÜ˜A“w�Ø”a—m‘mÒ#Ü% aÓ(Ð(Ð(Ø”a—f‘f’Ü—v‘v�Ø�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Ð'rT   c                 óZ   • U R                   u  p#US:X  a  [        US-
  U5      U-  $ [        e)Nr&   r$   )r*   r7   r   )r;   rQ   r>   r=   s       rM   rR   Úpolylog.fdiffL  s0   € Ø�y‰y‰ˆØ�q‹=Ü˜1˜q™5 !Ó$ QÑ&Ð&Ü Ð rT   c                 ó    • U[        X!S5      -  $ ©Nr$   ©r!   )r;   r>   r=   r]   s       rM   Ú_eval_rewrite_as_lerchphiÚ!polylog._eval_rewrite_as_lerchphiR  s   € Ø”˜! Ó"Ñ"Ð"rT   c                 ó2  • U R                   u  p#US:X  a  [        SU-
  5      * $ UR                  (       aY  US::  aS  [        S5      nUSU-
  -  n[	        U* 5       H  nXER                  U5      -  nM     [        U5      R                  XC5      $ [        X#5      $ )Nr$   r   Úu)	r*   r   r,   r   r4   r0   r   r1   r7   )r;   r<   r>   r=   r€   r@   Ú_s          rM   r9   Úpolylog._eval_expand_funcU  s†   € Ø�y‰y‰ˆØ�‹6Ü˜˜A™“J�;ÐØ�<�<˜A ›FÜ�c“
ˆAØ�q˜1‘u‘IˆEÜ˜A˜2–Y�ØŸ*™* Q›-™’ñ ä˜eÓ$×)Ñ)¨!Ó/Ð/Ü�q‹}ÐrT   c                 óF   • U R                   S   nUR                  (       a  gg )Nr$   T)r*   rq   )r;   r=   s     rM   Ú_eval_is_zeroÚpolylog._eval_is_zeroa  s   € Ø�I‰I�a‰LˆØ�9�9Øð rT   c                 óª  >• SSK Jn  U R                  u  pgUR                  US5      nU[        R
                  L a-  UR                  US[        U5      R                  (       a  SOSS9nUR                  (       a°   UR                  U5      u  pšU
R                  (       a‹  [        X*-  5      nU" X-  U5      nUR                  XX45      R!                  5       nU[        R"                  L a  U$ UnU/n[%        SU5       H  nXí-  nUR'                  UUU-  -  5        M      [)        U6 U-   $ [*        [,        U ]?  XX45      $ ! [        [        4 a    U s $ f = f)Nr   )ÚOrderÚ-Ú+)Údirr&   )Úsympy.series.orderr‡   r*   r1   r   ÚNaNÚlimitr   Úis_negativerq   ÚleadtermÚ
ValueErrorÚNotImplementedErrorÚis_positiver   Ú_eval_nseriesÚremoveOr-   r4   r:   r   Úsuperr7   )r;   ÚxrE   ÚlogxÚcdirr‡   Únur=   Úz0r�   r   ÚnewnÚoÚrÚtermr>   rF   Ú	__class__s                    €rM   r“   Úpolylog._eval_nseriesf  s)  ø€ Ý,Ø—	‘	‰ˆà�V‰V�A�q‹\ˆØ”—‘Š;Ø—‘˜˜A¬"¨T«(×*>×*>¡3ÀC�ÐHˆBà�:�:ðØŸ™ A›‘�ð ��Ü˜q™u“~�Ù˜!™$ “N�Ø—O‘O A¨$Ó5×=Ñ=Ó?�ØœŸ™’;Ø�Hà�Ø�F�Ü˜q $ž�AØ‘I�DØ—H‘H˜T ! R¡%™ZÖ(ñ (ô ˜A�w ‘{Ð"ä”W˜dÑ1°!¸ÓCÐCøô# Ô 3Ð4ó Ø’ðús   Á:D= Ä=EÅEr)   rc   )r   )rd   re   rf   rg   rh   Úclassmethodrv   rR   r}   r9   r„   r“   ri   Ú__classcell__©rŸ   s   @rM   r7   r7   ß   s?   ø† ñCðJ ñ$)ó ð$)ôL!ò#ò
ò÷
Dõ DrT   r7   c                   ót   ^ • \ rS rSrSr\SS j5       rSS jrSS jrSS jr	S r
S rSS	 jrU 4S
 jrSrU =r$ )r+   i‹  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                 óî  • U[         R                  L a  U " U5      $ U[         R                  L d  U[         R                  L a  [         R                  $ U[         R                  L a  [         R                  $ U[         R                  L a  [         R                  $ U[         R                  L a  [         R
                  $ UR                  nUc  [         R                  nU(       a&  UR                  (       a  [        SU-
  U5      US-
  -  $ U[         R                  L aI  U(       aA  UR                  (       a/  S[        -  [        -  U-  * [        U5      -  S[        U5      -  -  $ g g U(       a:  UR                  (       a)  UR                  (       a  U " U5      [        US-
  U5      -
  $ UR                  (       aA  UR                  (       a/  UR                  SL d  UR                  SL a  [         R                  $ g g g )Nr$   r&   F)r   r3   rŒ   ÚComplexInfinityÚInfinityr-   r,   Úis_nonpositiver   Úis_evenr	   r
   r   r’   r   Ú
is_integer)rs   r>   r?   Úsints       rM   rv   Ú	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ð /ˆ\rT   c                 óü   • US:X  ab  UR                   (       aQ  UR                  (       a@  UR                  (       a/  S[        -  [        -  U-  * [        U5      -  S[        U5      -  -  $ [        SU-
  U5      US-
  -  $ )Nr$   r&   )rª   Úis_nonnegativer©   r	   r
   r   r   ©r;   r>   r?   r]   s       rM   Ú_eval_rewrite_as_bernoulliÚ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Ñ(Ð(rT   c                 ó^   • US:w  a  U $ U R                   S   n[        U5      SSSU-
  -  -
  -  $ )Nr$   r   r&   )r*   ro   r¯   s       rM   Ú_eval_rewrite_as_dirichlet_etaÚ#zeta._eval_rewrite_as_dirichlet_eta  s7   € Ø�‹6ØˆKØ�I‰I�a‰LˆÜ˜QÓ  Q¨¨Q©¡Z¡Ñ0Ð0rT   c                 ó   • [        SX5      $ r{   r|   r¯   s       rM   r}   Úzeta._eval_rewrite_as_lerchphi  s   € Ü˜˜1Ó Ð rT   c                 óL   • [        U R                  S   S-
  R                  5      $ )Nr   r$   )r   r*   rq   )r;   s    rM   Ú_eval_is_finiteÚzeta._eval_is_finite  s    € Ü˜$Ÿ)™) A™,¨Ñ*×3Ñ3Ó4Ð4rT   c                 óŒ  • U R                   S   n[        U R                   5      S:”  a  U R                   S   O[        R                  nUR                  (       ak  UR
                  (       a  [        U5      [        US-
  U5      -
  $ UR                  (       a.  UR                  SL d  UR                  SL a  [        R                  $ U $ )Nr   r$   F)
r*   Úlenr   r3   rª   r’   r+   r   r¨   rŒ   )r;   r<   r>   r?   s       rM   r9   Ú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�ØˆrT   c                 ó²   • [        U R                  5      S:X  a  U R                  u  p#OU R                  S-   u  p#US:X  a  U* [        US-   U5      -  $ [        e)Nr&   rc   r$   )r»   r*   r+   r   )r;   rQ   r>   r?   s       rM   rR   Ú
zeta.fdiff-  sS   € Üˆt�y‰y‹>˜QÓØ—9‘9‰DˆAˆqà—9‘9˜tÑ#‰DˆAØ�q‹=Ø�2”d˜1˜q™5 !“nÑ$Ð$ä$Ð$rT   c                 óT  >• [        U R                  5      S:X  a  U R                  u  pEO U R                  [        R                  4-   u  pE UR	                  U5      u  pgUR                  (       a  UR                  (       d  [
        e[        [        U ]+  XUS9$ ! [
         a    U s $ f = f)Nr&   )r—   r˜   )r»   r*   r   r3   r�   r‘   rŽ   r’   r•   r+   Ú_eval_as_leading_term)	r;   r–   r—   r˜   r>   r?   rB   ÚerŸ   s	           €rM   rÀ   Úzeta._eval_as_leading_term7  sŒ   ø€ Üˆt�y‰y‹>˜QÓØ—9‘9‰DˆAˆqà—9‘9¤§¡˜xÑ'‰DˆAð	Ø—:‘:˜a“=‰DˆAð �=�= §§Ü%Ð%ä”T˜4Ñ6°qÈ$Ð6ÐOÐOøô #ó 	ØŠKð	ús   ÁB ÂB'Â&B'r)   rV   rc   )rd   re   rf   rg   rh   r¡   rv   r°   r³   r}   r¸   r9   rR   rÀ   ri   r¢   r£   s   @rM   r+   r+   ‹  sH   ø† ñhðT óó ðô4)ô
1ô!ò5ò	ô%÷Pó PrT   r+   c                   ó\   • \ rS rSrSr\S	S j5       rS
S jr\R                  4S jr
S rSrg)ro   iH  aE  
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                 óæ  • U[         R                  L a  U " U5      $ UcE  US:X  a  [        S5      $ [        U5      nUR	                  [        5      (       d  SSSU-
  -  -
  U-  $ g US:X  a)  SSKJn  [        S5      U" U5      -
  U" US-   S-  5      -   $ [        X5      n[        XS-   S-  5      nUR	                  [        5      (       d)  UR	                  [        5      (       d  USSU-
  -  U-  -
  $ g g )Nr$   r&   r   ©Údigamma)r   r3   r   r+   rW   Ú'sympy.functions.special.gamma_functionsrÆ   )rs   r>   r?   r=   rÆ   Úz1Úz2s          rM   rv   Ú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Ü�!‹ZˆÜ�!˜‘c˜1‘WÓˆØ�v‰v”d�|‰| B§F¡F¬4§L¡LØ˜˜A˜a™C™ 2™Ñ%Ð%ð %1ˆ|rT   c           
      óH  • SSK Jn  US:X  a8  [        [        S5      [	        US5      4SSSU-
  -  -
  [        U5      -  S45      $ [        [        S5      U" U5      -
  U" US-   S-  5      -   [	        US5      4[        X5      SSU-
  -  [        XS-   S-  5      -  -
  S45      $ )Nr   rÅ   r$   r&   T)rÇ   rÆ   r   r   r   r+   ©r;   r>   r?   r]   rÆ   s        rM   r^   Ú#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rT   c                 ó°   • SSK Jn  [        [        S5      U" U5      -
  U" US-   S-  5      -   [	        US5      4[        SU-
  U5      SUS-
  -  -  S45      $ )Nr   rÅ   r&   r$   T)rÇ   rÆ   r   r   r   r   rÌ   s        rM   Ú_eval_rewrite_as_genocchiÚ'dirichlet_eta._eval_rewrite_as_genocchi‘  s^   € ÝCÜœ#˜a›&¡7¨1£:Ñ-±¸¸1¹¸a¹Ó0@Ñ@Ä"ÀQÈÃ(ÐKÜ˜!˜A™#˜qÓ! Q¨!¨A©#¡YÑ/°Ð6ó8ð 	8rT   c                 óŽ   • [        S U R                   5       5      (       a$  U R                  [        5      R	                  U5      $ g )Nc              3   ó8   #   • U  H  oR                   v •  M     g 7frV   )rm   )Ú.0Úis     rM   Ú	<genexpr>Ú,dirichlet_eta._eval_evalf.<locals>.<genexpr>—  s   é € Ð.¢I˜q�{Ž{¢Iùs   ‚)Úallr*   Úrewriter+   Ú_eval_evalf)r;   Úprecs     rM   rÙ   Údirichlet_eta._eval_evalf–  s6   € ÜÑ. D§I¢IÓ.×.Ñ.Ø—<‘<¤Ó%×1Ñ1°$Ó7Ð7ð /rT   r)   rV   rc   )rd   re   rf   rg   rh   r¡   rv   r^   r   r3   rÏ   rÙ   ri   r)   rT   rM   ro   ro   H  s5   † ñ,ð\ ó&ó ð&ô$Bð ./¯U©Uô 8õ
8rT   ro   c                   ó.   • \ rS rSrSr\S 5       rS rSrg)Ú
riemann_xii›  a¯  
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                 ó  • SSK Jn  [        U5      nU[        R                  [        R
                  4;   a  [        R                  $ [        U[        5      (       d&  XS-
  -  U" US-  5      -  U-  S[        US-  -  -  -  $ g ©Nr   )Úgammar$   r&   )	rÇ   rà   r+   r   r-   r3   ÚHalfr8   r	   )rs   r>   rà   r=   s       rM   rv   Úriemann_xi.eval³  sl   € åAÜ�‹GˆØ”—‘œŸ™�ÓÜ—6‘6ˆMä˜!œT×"Ñ"Ø˜!‘e‘9™U 1 Q¡3›ZÑ'¨Ñ)¨1¬R°!°A±#©Y©;Ñ7Ð7ð #rT   c                 ól   • SSK Jn  XS-
  -  U" US-  5      -  [        U5      -  S[        US-  -  -  -  $ rß   )rÇ   rà   r+   r	   )r;   r>   r]   rà   s       rM   r^   Ú riemann_xi._eval_rewrite_as_zeta½  s8   € ÝAØ�a‘%‰y™˜q ™s›Ñ#¤D¨£GÑ+¨Q¬r°A°a±C©y©[Ñ9Ð9rT   r)   N)	rd   re   rf   rg   rh   r¡   rv   r^   ri   r)   rT   rM   rÝ   rÝ   ›  s    † ñð. ñ8ó ð8õ:rT   rÝ   c                   ó,   • \ rS rSrSr\SS j5       rSrg)Ú	stieltjesiÂ  a$  
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                 óÂ  • Ub`  [        U5      nU[        R                  L a  [        R                  $ UR                  (       a!  UR                  (       a  [        R
                  $ UR                  (       aƒ  U[        R                  L a  [        R                  $ US:  a  [        R
                  $ UR                  (       d  [        R
                  $ U[        R                  L a  US;   a  [        R                  $ UR                  (       a  [        R
                  $ UR                  (       a  US;   a  [        R                  $ UR                  S:X  a  [        R
                  $ g )Nr   r{   F)r   r   rŒ   r,   r¨   r¦   Ú	is_Numberr-   Ú
EulerGammaÚis_extended_negativerq   rª   )rs   rE   r?   s      rM   rv   Ú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Ó Ü×$Ñ$Ð$ð !rT   r)   rV   )rd   re   rf   rg   rh   r¡   rv   ri   r)   rT   rM   ræ   ræ   Â  s   † ñ"ðH ó%ó ó%rT   ræ   c                  ó  • [         R                  [        S-  S-  [        S5      S-  S-  -
  [	        S5      [        S-  S-  [
        [        -  [        S5      -  -
  [        S5      S-
  * S-  [        S-  * S-  [        [        S5      S-
  S-  5      S-  S-  -   [        S5      S-   * S-  [        S-  * S-  [        [        S5      S-   S-  5      S-  -
  S[        S5      -
  S-  [        S-  S-  [        [        S5      S-
  S-  5      S-  -
  [        S5      S-
  S-  [        S-  S-  [        [        S5      S-
  S-  5      S-  -
  [
        [
        [         R                  -  [        S-  S	-  -
  [
        * [
        * [         R                  -  [        S-  S	-  -
  S[
        -
  [        S-  S
-  [
        [         R                  -  -
  [        [
        -  S-  [        S5      -  -
  S[
        -   [        S-  S
-  [
        [         R                  -  -   [        [
        -  S-  [        S5      -  -   S[
        -
  S-  [        S5      S-  * S-  [        [
        -  [        S5      -  S-  -   S[        S-  -  S-  -   [
        [         R                  -  -
  0$ )Nr&   é   r(   é   r$   é   é
   rP   é0   é   é   é`   )r   rá   r	   r   r   r
   r   ÚCatalanr)   rT   rM   rp   rp     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ðð rT   N)5rh   Ú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!   r7   r+   ro   rÝ   ræ   rp   r)   rT   rM   Ú<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 	ñó 	ñrT   