m2m模型翻译
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

721 lines
21 KiB

6 months ago
  1. """ Riemann zeta and related function. """
  2. from sympy.core.add import Add
  3. from sympy.core import Function, S, sympify, pi, I
  4. from sympy.core.function import ArgumentIndexError, expand_mul
  5. from sympy.core.symbol import Dummy
  6. from sympy.functions.combinatorial.numbers import bernoulli, factorial, harmonic
  7. from sympy.functions.elementary.complexes import re, unpolarify, Abs, polar_lift
  8. from sympy.functions.elementary.exponential import log, exp_polar, exp
  9. from sympy.functions.elementary.integers import floor
  10. from sympy.functions.elementary.miscellaneous import sqrt
  11. ###############################################################################
  12. ###################### LERCH TRANSCENDENT #####################################
  13. ###############################################################################
  14. class lerchphi(Function):
  15. r"""
  16. Lerch transcendent (Lerch phi function).
  17. Explanation
  18. ===========
  19. For $\operatorname{Re}(a) > 0$, $|z| < 1$ and $s \in \mathbb{C}$, the
  20. Lerch transcendent is defined as
  21. .. math :: \Phi(z, s, a) = \sum_{n=0}^\infty \frac{z^n}{(n + a)^s},
  22. where the standard branch of the argument is used for $n + a$,
  23. and by analytic continuation for other values of the parameters.
  24. A commonly used related function is the Lerch zeta function, defined by
  25. .. math:: L(q, s, a) = \Phi(e^{2\pi i q}, s, a).
  26. **Analytic Continuation and Branching Behavior**
  27. It can be shown that
  28. .. math:: \Phi(z, s, a) = z\Phi(z, s, a+1) + a^{-s}.
  29. This provides the analytic continuation to $\operatorname{Re}(a) \le 0$.
  30. Assume now $\operatorname{Re}(a) > 0$. The integral representation
  31. .. math:: \Phi_0(z, s, a) = \int_0^\infty \frac{t^{s-1} e^{-at}}{1 - ze^{-t}}
  32. \frac{\mathrm{d}t}{\Gamma(s)}
  33. provides an analytic continuation to $\mathbb{C} - [1, \infty)$.
  34. Finally, for $x \in (1, \infty)$ we find
  35. .. math:: \lim_{\epsilon \to 0^+} \Phi_0(x + i\epsilon, s, a)
  36. -\lim_{\epsilon \to 0^+} \Phi_0(x - i\epsilon, s, a)
  37. = \frac{2\pi i \log^{s-1}{x}}{x^a \Gamma(s)},
  38. using the standard branch for both $\log{x}$ and
  39. $\log{\log{x}}$ (a branch of $\log{\log{x}}$ is needed to
  40. evaluate $\log{x}^{s-1}$).
  41. This concludes the analytic continuation. The Lerch transcendent is thus
  42. branched at $z \in \{0, 1, \infty\}$ and
  43. $a \in \mathbb{Z}_{\le 0}$. For fixed $z, a$ outside these
  44. branch points, it is an entire function of $s$.
  45. Examples
  46. ========
  47. The Lerch transcendent is a fairly general function, for this reason it does
  48. not automatically evaluate to simpler functions. Use ``expand_func()`` to
  49. achieve this.
  50. If $z=1$, the Lerch transcendent reduces to the Hurwitz zeta function:
  51. >>> from sympy import lerchphi, expand_func
  52. >>> from sympy.abc import z, s, a
  53. >>> expand_func(lerchphi(1, s, a))
  54. zeta(s, a)
  55. More generally, if $z$ is a root of unity, the Lerch transcendent
  56. reduces to a sum of Hurwitz zeta functions:
  57. >>> expand_func(lerchphi(-1, s, a))
  58. zeta(s, a/2)/2**s - zeta(s, a/2 + 1/2)/2**s
  59. If $a=1$, the Lerch transcendent reduces to the polylogarithm:
  60. >>> expand_func(lerchphi(z, s, 1))
  61. polylog(s, z)/z
  62. More generally, if $a$ is rational, the Lerch transcendent reduces
  63. to a sum of polylogarithms:
  64. >>> from sympy import S
  65. >>> expand_func(lerchphi(z, s, S(1)/2))
  66. 2**(s - 1)*(polylog(s, sqrt(z))/sqrt(z) -
  67. polylog(s, sqrt(z)*exp_polar(I*pi))/sqrt(z))
  68. >>> expand_func(lerchphi(z, s, S(3)/2))
  69. -2**s/z + 2**(s - 1)*(polylog(s, sqrt(z))/sqrt(z) -
  70. polylog(s, sqrt(z)*exp_polar(I*pi))/sqrt(z))/z
  71. The derivatives with respect to $z$ and $a$ can be computed in
  72. closed form:
  73. >>> lerchphi(z, s, a).diff(z)
  74. (-a*lerchphi(z, s, a) + lerchphi(z, s - 1, a))/z
  75. >>> lerchphi(z, s, a).diff(a)
  76. -s*lerchphi(z, s + 1, a)
  77. See Also
  78. ========
  79. polylog, zeta
  80. References
  81. ==========
  82. .. [1] Bateman, H.; Erdelyi, A. (1953), Higher Transcendental Functions,
  83. Vol. I, New York: McGraw-Hill. Section 1.11.
  84. .. [2] http://dlmf.nist.gov/25.14
  85. .. [3] https://en.wikipedia.org/wiki/Lerch_transcendent
  86. """
  87. def _eval_expand_func(self, **hints):
  88. from sympy.polys.polytools import Poly
  89. z, s, a = self.args
  90. if z == 1:
  91. return zeta(s, a)
  92. if s.is_Integer and s <= 0:
  93. t = Dummy('t')
  94. p = Poly((t + a)**(-s), t)
  95. start = 1/(1 - t)
  96. res = S.Zero
  97. for c in reversed(p.all_coeffs()):
  98. res += c*start
  99. start = t*start.diff(t)
  100. return res.subs(t, z)
  101. if a.is_Rational:
  102. # See section 18 of
  103. # Kelly B. Roach. Hypergeometric Function Representations.
  104. # In: Proceedings of the 1997 International Symposium on Symbolic and
  105. # Algebraic Computation, pages 205-211, New York, 1997. ACM.
  106. # TODO should something be polarified here?
  107. add = S.Zero
  108. mul = S.One
  109. # First reduce a to the interaval (0, 1]
  110. if a > 1:
  111. n = floor(a)
  112. if n == a:
  113. n -= 1
  114. a -= n
  115. mul = z**(-n)
  116. add = Add(*[-z**(k - n)/(a + k)**s for k in range(n)])
  117. elif a <= 0:
  118. n = floor(-a) + 1
  119. a += n
  120. mul = z**n
  121. add = Add(*[z**(n - 1 - k)/(a - k - 1)**s for k in range(n)])
  122. m, n = S([a.p, a.q])
  123. zet = exp_polar(2*pi*I/n)
  124. root = z**(1/n)
  125. return add + mul*n**(s - 1)*Add(
  126. *[polylog(s, zet**k*root)._eval_expand_func(**hints)
  127. / (unpolarify(zet)**k*root)**m for k in range(n)])
  128. # TODO use minpoly instead of ad-hoc methods when issue 5888 is fixed
  129. if isinstance(z, exp) and (z.args[0]/(pi*I)).is_Rational or z in [-1, I, -I]:
  130. # TODO reference?
  131. if z == -1:
  132. p, q = S([1, 2])
  133. elif z == I:
  134. p, q = S([1, 4])
  135. elif z == -I:
  136. p, q = S([-1, 4])
  137. else:
  138. arg = z.args[0]/(2*pi*I)
  139. p, q = S([arg.p, arg.q])
  140. return Add(*[exp(2*pi*I*k*p/q)/q**s*zeta(s, (k + a)/q)
  141. for k in range(q)])
  142. return lerchphi(z, s, a)
  143. def fdiff(self, argindex=1):
  144. z, s, a = self.args
  145. if argindex == 3:
  146. return -s*lerchphi(z, s + 1, a)
  147. elif argindex == 1:
  148. return (lerchphi(z, s - 1, a) - a*lerchphi(z, s, a))/z
  149. else:
  150. raise ArgumentIndexError
  151. def _eval_rewrite_helper(self, z, s, a, target):
  152. res = self._eval_expand_func()
  153. if res.has(target):
  154. return res
  155. else:
  156. return self
  157. def _eval_rewrite_as_zeta(self, z, s, a, **kwargs):
  158. return self._eval_rewrite_helper(z, s, a, zeta)
  159. def _eval_rewrite_as_polylog(self, z, s, a, **kwargs):
  160. return self._eval_rewrite_helper(z, s, a, polylog)
  161. ###############################################################################
  162. ###################### POLYLOGARITHM ##########################################
  163. ###############################################################################
  164. class polylog(Function):
  165. r"""
  166. Polylogarithm function.
  167. Explanation
  168. ===========
  169. For $|z| < 1$ and $s \in \mathbb{C}$, the polylogarithm is
  170. defined by
  171. .. math:: \operatorname{Li}_s(z) = \sum_{n=1}^\infty \frac{z^n}{n^s},
  172. where the standard branch of the argument is used for $n$. It admits
  173. an analytic continuation which is branched at $z=1$ (notably not on the
  174. sheet of initial definition), $z=0$ and $z=\infty$.
  175. The name polylogarithm comes from the fact that for $s=1$, the
  176. polylogarithm is related to the ordinary logarithm (see examples), and that
  177. .. math:: \operatorname{Li}_{s+1}(z) =
  178. \int_0^z \frac{\operatorname{Li}_s(t)}{t} \mathrm{d}t.
  179. The polylogarithm is a special case of the Lerch transcendent:
  180. .. math:: \operatorname{Li}_{s}(z) = z \Phi(z, s, 1).
  181. Examples
  182. ========
  183. For $z \in \{0, 1, -1\}$, the polylogarithm is automatically expressed
  184. using other functions:
  185. >>> from sympy import polylog
  186. >>> from sympy.abc import s
  187. >>> polylog(s, 0)
  188. 0
  189. >>> polylog(s, 1)
  190. zeta(s)
  191. >>> polylog(s, -1)
  192. -dirichlet_eta(s)
  193. If $s$ is a negative integer, $0$ or $1$, the polylogarithm can be
  194. expressed using elementary functions. This can be done using
  195. ``expand_func()``:
  196. >>> from sympy import expand_func
  197. >>> from sympy.abc import z
  198. >>> expand_func(polylog(1, z))
  199. -log(1 - z)
  200. >>> expand_func(polylog(0, z))
  201. z/(1 - z)
  202. The derivative with respect to $z$ can be computed in closed form:
  203. >>> polylog(s, z).diff(z)
  204. polylog(s - 1, z)/z
  205. The polylogarithm can be expressed in terms of the lerch transcendent:
  206. >>> from sympy import lerchphi
  207. >>> polylog(s, z).rewrite(lerchphi)
  208. z*lerchphi(z, s, 1)
  209. See Also
  210. ========
  211. zeta, lerchphi
  212. """
  213. @classmethod
  214. def eval(cls, s, z):
  215. s, z = sympify((s, z))
  216. if z is S.One:
  217. return zeta(s)
  218. elif z is S.NegativeOne:
  219. return -dirichlet_eta(s)
  220. elif z is S.Zero:
  221. return S.Zero
  222. elif s == 2:
  223. if z == S.Half:
  224. return pi**2/12 - log(2)**2/2
  225. elif z == 2:
  226. return pi**2/4 - I*pi*log(2)
  227. elif z == -(sqrt(5) - 1)/2:
  228. return -pi**2/15 + log((sqrt(5)-1)/2)**2/2
  229. elif z == -(sqrt(5) + 1)/2:
  230. return -pi**2/10 - log((sqrt(5)+1)/2)**2
  231. elif z == (3 - sqrt(5))/2:
  232. return pi**2/15 - log((sqrt(5)-1)/2)**2
  233. elif z == (sqrt(5) - 1)/2:
  234. return pi**2/10 - log((sqrt(5)-1)/2)**2
  235. if z.is_zero:
  236. return S.Zero
  237. # Make an effort to determine if z is 1 to avoid replacing into
  238. # expression with singularity
  239. zone = z.equals(S.One)
  240. if zone:
  241. return zeta(s)
  242. elif zone is False:
  243. # For s = 0 or -1 use explicit formulas to evaluate, but
  244. # automatically expanding polylog(1, z) to -log(1-z) seems
  245. # undesirable for summation methods based on hypergeometric
  246. # functions
  247. if s is S.Zero:
  248. return z/(1 - z)
  249. elif s is S.NegativeOne:
  250. return z/(1 - z)**2
  251. if s.is_zero:
  252. return z/(1 - z)
  253. # polylog is branched, but not over the unit disk
  254. if z.has(exp_polar, polar_lift) and (zone or (Abs(z) <= S.One) == True):
  255. return cls(s, unpolarify(z))
  256. def fdiff(self, argindex=1):
  257. s, z = self.args
  258. if argindex == 2:
  259. return polylog(s - 1, z)/z
  260. raise ArgumentIndexError
  261. def _eval_rewrite_as_lerchphi(self, s, z, **kwargs):
  262. return z*lerchphi(z, s, 1)
  263. def _eval_expand_func(self, **hints):
  264. s, z = self.args
  265. if s == 1:
  266. return -log(1 - z)
  267. if s.is_Integer and s <= 0:
  268. u = Dummy('u')
  269. start = u/(1 - u)
  270. for _ in range(-s):
  271. start = u*start.diff(u)
  272. return expand_mul(start).subs(u, z)
  273. return polylog(s, z)
  274. def _eval_is_zero(self):
  275. z = self.args[1]
  276. if z.is_zero:
  277. return True
  278. def _eval_nseries(self, x, n, logx, cdir=0):
  279. from sympy.functions.elementary.integers import ceiling
  280. from sympy.series.order import Order
  281. nu, z = self.args
  282. z0 = z.subs(x, 0)
  283. if z0 is S.NaN:
  284. z0 = z.limit(x, 0, dir='-' if re(cdir).is_negative else '+')
  285. if z0.is_zero:
  286. # In case of powers less than 1, number of terms need to be computed
  287. # separately to avoid repeated callings of _eval_nseries with wrong n
  288. try:
  289. _, exp = z.leadterm(x)
  290. except (ValueError, NotImplementedError):
  291. return self
  292. if exp.is_positive:
  293. newn = ceiling(n/exp)
  294. o = Order(x**n, x)
  295. r = z._eval_nseries(x, n, logx, cdir).removeO()
  296. if r is S.Zero:
  297. return o
  298. term = r
  299. s = [term]
  300. for k in range(2, newn):
  301. term *= r
  302. s.append(term/k**nu)
  303. return Add(*s) + o
  304. return super(polylog, self)._eval_nseries(x, n, logx, cdir)
  305. ###############################################################################
  306. ###################### HURWITZ GENERALIZED ZETA FUNCTION ######################
  307. ###############################################################################
  308. class zeta(Function):
  309. r"""
  310. Hurwitz zeta function (or Riemann zeta function).
  311. Explanation
  312. ===========
  313. For $\operatorname{Re}(a) > 0$ and $\operatorname{Re}(s) > 1$, this
  314. function is defined as
  315. .. math:: \zeta(s, a) = \sum_{n=0}^\infty \frac{1}{(n + a)^s},
  316. where the standard choice of argument for $n + a$ is used. For fixed
  317. $a$ with $\operatorname{Re}(a) > 0$ the Hurwitz zeta function admits a
  318. meromorphic continuation to all of $\mathbb{C}$, it is an unbranched
  319. function with a simple pole at $s = 1$.
  320. Analytic continuation to other $a$ is possible under some circumstances,
  321. but this is not typically done.
  322. The Hurwitz zeta function is a special case of the Lerch transcendent:
  323. .. math:: \zeta(s, a) = \Phi(1, s, a).
  324. This formula defines an analytic continuation for all possible values of
  325. $s$ and $a$ (also $\operatorname{Re}(a) < 0$), see the documentation of
  326. :class:`lerchphi` for a description of the branching behavior.
  327. If no value is passed for $a$, by this function assumes a default value
  328. of $a = 1$, yielding the Riemann zeta function.
  329. Examples
  330. ========
  331. For $a = 1$ the Hurwitz zeta function reduces to the famous Riemann
  332. zeta function:
  333. .. math:: \zeta(s, 1) = \zeta(s) = \sum_{n=1}^\infty \frac{1}{n^s}.
  334. >>> from sympy import zeta
  335. >>> from sympy.abc import s
  336. >>> zeta(s, 1)
  337. zeta(s)
  338. >>> zeta(s)
  339. zeta(s)
  340. The Riemann zeta function can also be expressed using the Dirichlet eta
  341. function:
  342. >>> from sympy import dirichlet_eta
  343. >>> zeta(s).rewrite(dirichlet_eta)
  344. dirichlet_eta(s)/(1 - 2**(1 - s))
  345. The Riemann zeta function at positive even integer and negative odd integer
  346. values is related to the Bernoulli numbers:
  347. >>> zeta(2)
  348. pi**2/6
  349. >>> zeta(4)
  350. pi**4/90
  351. >>> zeta(-1)
  352. -1/12
  353. The specific formulae are:
  354. .. math:: \zeta(2n) = (-1)^{n+1} \frac{B_{2n} (2\pi)^{2n}}{2(2n)!}
  355. .. math:: \zeta(-n) = -\frac{B_{n+1}}{n+1}
  356. At negative even integers the Riemann zeta function is zero:
  357. >>> zeta(-4)
  358. 0
  359. No closed-form expressions are known at positive odd integers, but
  360. numerical evaluation is possible:
  361. >>> zeta(3).n()
  362. 1.20205690315959
  363. The derivative of $\zeta(s, a)$ with respect to $a$ can be computed:
  364. >>> from sympy.abc import a
  365. >>> zeta(s, a).diff(a)
  366. -s*zeta(s + 1, a)
  367. However the derivative with respect to $s$ has no useful closed form
  368. expression:
  369. >>> zeta(s, a).diff(s)
  370. Derivative(zeta(s, a), s)
  371. The Hurwitz zeta function can be expressed in terms of the Lerch
  372. transcendent, :class:`~.lerchphi`:
  373. >>> from sympy import lerchphi
  374. >>> zeta(s, a).rewrite(lerchphi)
  375. lerchphi(1, s, a)
  376. See Also
  377. ========
  378. dirichlet_eta, lerchphi, polylog
  379. References
  380. ==========
  381. .. [1] http://dlmf.nist.gov/25.11
  382. .. [2] https://en.wikipedia.org/wiki/Hurwitz_zeta_function
  383. """
  384. @classmethod
  385. def eval(cls, z, a_=None):
  386. if a_ is None:
  387. z, a = list(map(sympify, (z, 1)))
  388. else:
  389. z, a = list(map(sympify, (z, a_)))
  390. if a.is_Number:
  391. if a is S.NaN:
  392. return S.NaN
  393. elif a is S.One and a_ is not None:
  394. return cls(z)
  395. # TODO Should a == 0 return S.NaN as well?
  396. if z.is_Number:
  397. if z is S.NaN:
  398. return S.NaN
  399. elif z is S.Infinity:
  400. return S.One
  401. elif z.is_zero:
  402. return S.Half - a
  403. elif z is S.One:
  404. return S.ComplexInfinity
  405. if z.is_integer:
  406. if a.is_Integer:
  407. if z.is_negative:
  408. zeta = S.NegativeOne**z * bernoulli(-z + 1)/(-z + 1)
  409. elif z.is_even and z.is_positive:
  410. B, F = bernoulli(z), factorial(z)
  411. zeta = (S.NegativeOne**(z/2+1) * 2**(z - 1) * B * pi**z) / F
  412. else:
  413. return
  414. if a.is_negative:
  415. return zeta + harmonic(abs(a), z)
  416. else:
  417. return zeta - harmonic(a - 1, z)
  418. if z.is_zero:
  419. return S.Half - a
  420. def _eval_rewrite_as_dirichlet_eta(self, s, a=1, **kwargs):
  421. if a != 1:
  422. return self
  423. s = self.args[0]
  424. return dirichlet_eta(s)/(1 - 2**(1 - s))
  425. def _eval_rewrite_as_lerchphi(self, s, a=1, **kwargs):
  426. return lerchphi(1, s, a)
  427. def _eval_is_finite(self):
  428. arg_is_one = (self.args[0] - 1).is_zero
  429. if arg_is_one is not None:
  430. return not arg_is_one
  431. def fdiff(self, argindex=1):
  432. if len(self.args) == 2:
  433. s, a = self.args
  434. else:
  435. s, a = self.args + (1,)
  436. if argindex == 2:
  437. return -s*zeta(s + 1, a)
  438. else:
  439. raise ArgumentIndexError
  440. class dirichlet_eta(Function):
  441. r"""
  442. Dirichlet eta function.
  443. Explanation
  444. ===========
  445. For $\operatorname{Re}(s) > 0$, this function is defined as
  446. .. math:: \eta(s) = \sum_{n=1}^\infty \frac{(-1)^{n-1}}{n^s}.
  447. It admits a unique analytic continuation to all of $\mathbb{C}$.
  448. It is an entire, unbranched function.
  449. Examples
  450. ========
  451. The Dirichlet eta function is closely related to the Riemann zeta function:
  452. >>> from sympy import dirichlet_eta, zeta
  453. >>> from sympy.abc import s
  454. >>> dirichlet_eta(s).rewrite(zeta)
  455. (1 - 2**(1 - s))*zeta(s)
  456. See Also
  457. ========
  458. zeta
  459. References
  460. ==========
  461. .. [1] https://en.wikipedia.org/wiki/Dirichlet_eta_function
  462. """
  463. @classmethod
  464. def eval(cls, s):
  465. if s == 1:
  466. return log(2)
  467. z = zeta(s)
  468. if not z.has(zeta):
  469. return (1 - 2**(1 - s))*z
  470. def _eval_rewrite_as_zeta(self, s, **kwargs):
  471. return (1 - 2**(1 - s)) * zeta(s)
  472. class riemann_xi(Function):
  473. r"""
  474. Riemann Xi function.
  475. Examples
  476. ========
  477. The Riemann Xi function is closely related to the Riemann zeta function.
  478. The zeros of Riemann Xi function are precisely the non-trivial zeros
  479. of the zeta function.
  480. >>> from sympy import riemann_xi, zeta
  481. >>> from sympy.abc import s
  482. >>> riemann_xi(s).rewrite(zeta)
  483. s*(s - 1)*gamma(s/2)*zeta(s)/(2*pi**(s/2))
  484. References
  485. ==========
  486. .. [1] https://en.wikipedia.org/wiki/Riemann_Xi_function
  487. """
  488. @classmethod
  489. def eval(cls, s):
  490. from sympy.functions.special.gamma_functions import gamma
  491. z = zeta(s)
  492. if s in (S.Zero, S.One):
  493. return S.Half
  494. if not isinstance(z, zeta):
  495. return s*(s - 1)*gamma(s/2)*z/(2*pi**(s/2))
  496. def _eval_rewrite_as_zeta(self, s, **kwargs):
  497. from sympy.functions.special.gamma_functions import gamma
  498. return s*(s - 1)*gamma(s/2)*zeta(s)/(2*pi**(s/2))
  499. class stieltjes(Function):
  500. r"""
  501. Represents Stieltjes constants, $\gamma_{k}$ that occur in
  502. Laurent Series expansion of the Riemann zeta function.
  503. Examples
  504. ========
  505. >>> from sympy import stieltjes
  506. >>> from sympy.abc import n, m
  507. >>> stieltjes(n)
  508. stieltjes(n)
  509. The zero'th stieltjes constant:
  510. >>> stieltjes(0)
  511. EulerGamma
  512. >>> stieltjes(0, 1)
  513. EulerGamma
  514. For generalized stieltjes constants:
  515. >>> stieltjes(n, m)
  516. stieltjes(n, m)
  517. Constants are only defined for integers >= 0:
  518. >>> stieltjes(-1)
  519. zoo
  520. References
  521. ==========
  522. .. [1] https://en.wikipedia.org/wiki/Stieltjes_constants
  523. """
  524. @classmethod
  525. def eval(cls, n, a=None):
  526. n = sympify(n)
  527. if a is not None:
  528. a = sympify(a)
  529. if a is S.NaN:
  530. return S.NaN
  531. if a.is_Integer and a.is_nonpositive:
  532. return S.ComplexInfinity
  533. if n.is_Number:
  534. if n is S.NaN:
  535. return S.NaN
  536. elif n < 0:
  537. return S.ComplexInfinity
  538. elif not n.is_Integer:
  539. return S.ComplexInfinity
  540. elif n is S.Zero and a in [None, 1]:
  541. return S.EulerGamma
  542. if n.is_extended_negative:
  543. return S.ComplexInfinity
  544. if n.is_zero and a in [None, 1]:
  545. return S.EulerGamma
  546. if n.is_integer == False:
  547. return S.ComplexInfinity