Skip to content

Commit 196b020

Browse files
Release Managervbraun
Release Manager
authored andcommitted
Trac #19948: Upgrade to pynac-0.6.1
Brand new pynac has: * Stieltjes constant function (#19834) * `zeta` expansion at 1 using `stieltjes()` (#19836, thanks Benjamin Hackl) * fix hashing of infinities (#19928) * fix `exp` and `atan` of `oo` (#19918) * fix `pseries` print order * speedups and fixes from GiNaC '''Tarball''': https://github.com/pynac/pynac/releases/download/pynac-0. 6.1/pynac-0.6.1.tar.bz2 URL: http://trac.sagemath.org/19948 Reported by: rws Ticket author(s): Ralf Stephan Reviewer(s): Benjamin Hackl
2 parents 5003a1b + 8a9b6ac commit 196b020

File tree

5 files changed

+51
-5
lines changed

5 files changed

+51
-5
lines changed

build/pkgs/pynac/checksums.ini

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
tarball=pynac-VERSION.tar.bz2
2-
sha1=1c955b11dd52b6eefb43d5ebf00c3a735140faec
3-
md5=4cdac770128d41e230b06e3c82d928e0
4-
cksum=2890824965
2+
sha1=8de4355307261c4012922560b4257e07606aabea
3+
md5=551c7a8b07d8b5dbc7bf9adb8f710362
4+
cksum=226559555

build/pkgs/pynac/package-version.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.6.0
1+
0.6.1

src/sage/functions/transcendental.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def __init__(self):
8383
Check that :trac:`15846` is resolved::
8484
8585
sage: zeta(x).series(x==1, 1)
86-
1*(x - 1)^(-1) + (euler_gamma + log(2) + log(pi) + 2*zetaderiv(1, 0)) + Order(x - 1)
86+
1*(x - 1)^(-1) + (euler_gamma) + Order(x - 1)
8787
sage: zeta(x).residue(x==1)
8888
1
8989

src/sage/symbolic/ginac.pxd

+3
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ cdef extern from "sage/symbolic/ginac_wrap.h":
367367
GEx g_H "GiNaC::H" (GEx m, GEx x) except + # harmonic polylogarithm
368368
GEx g_zeta "GiNaC::zeta" (GEx m) except + # Riemann's zeta function as well as multiple zeta value
369369
GEx g_zeta2 "GiNaC::zeta" (GEx m, GEx s) except + # alternating Euler sum
370+
GEx g_stieltjes "GiNaC::stieltjes" (GEx m) except + # Stieltjes constants
370371
GEx g_zetaderiv "GiNaC::zetaderiv" (GEx n, GEx x) except + # derivatives of Riemann's zeta function
371372
GEx g_tgamma "GiNaC::tgamma" (GEx x) except + # gamma function
372373
GEx g_lgamma "GiNaC::lgamma" (GEx x) except + # logarithm of gamma function
@@ -473,6 +474,7 @@ cdef extern from "sage/symbolic/ginac_wrap.h":
473474
unsigned H_serial "GiNaC::H_SERIAL::serial" # harmonic polylogarithm
474475
unsigned zeta1_serial "GiNaC::zeta1_SERIAL::serial" # Riemann's zeta function as well as multiple zeta value
475476
unsigned zeta2_serial "GiNaC::zeta2_SERIAL::serial" # alternating Euler sum
477+
unsigned stieltjes1_serial "GiNaC::stieltjes1_SERIAL::serial" # Stieltjes constants
476478
unsigned zetaderiv_serial "GiNaC::zetaderiv_SERIAL::serial" # derivatives of Riemann's zeta function
477479
unsigned tgamma_serial "GiNaC::tgamma_SERIAL::serial" # gamma function
478480
unsigned lgamma_serial "GiNaC::lgamma_SERIAL::serial" # logarithm of gamma function
@@ -527,6 +529,7 @@ cdef extern from "sage/symbolic/ginac_wrap.h":
527529
object (*py_bernoulli)(object x) except +
528530
object (*py_sin)(object x) except +
529531
object (*py_cos)(object x) except +
532+
object (*py_stieltjes)(object x) except +
530533
object (*py_zeta)(object x) except +
531534
object (*py_exp)(object x) except +
532535
object (*py_log)(object x) except +

src/sage/symbolic/pynac.pyx

+43
Original file line numberDiff line numberDiff line change
@@ -1457,6 +1457,48 @@ cdef object py_cos(object x) except +:
14571457
except (TypeError, ValueError):
14581458
return CC(x).cos()
14591459

1460+
cdef object py_stieltjes(object x) except +:
1461+
"""
1462+
Return the Stieltjes constant of the given index.
1463+
1464+
The value is expected to be a non-negative integer.
1465+
1466+
TESTS::
1467+
1468+
sage: from sage.symbolic.pynac import py_stieltjes_for_doctests as py_stieltjes
1469+
sage: py_stieltjes(0)
1470+
0.577215664901533
1471+
sage: py_stieltjes(1.0)
1472+
-0.0728158454836767
1473+
sage: py_stieltjes(RealField(100)(5))
1474+
0.00079332381730106270175333487744
1475+
sage: py_stieltjes(-1)
1476+
Traceback (most recent call last):
1477+
...
1478+
ValueError: Stieltjes constant of negative index
1479+
"""
1480+
n = ZZ(x)
1481+
if n < 0:
1482+
raise ValueError("Stieltjes constant of negative index")
1483+
import mpmath
1484+
if isinstance(x, Element) and hasattr((<Element>x)._parent, 'prec'):
1485+
prec = (<Element>x)._parent.prec()
1486+
else:
1487+
prec = 53
1488+
return mpmath_utils.call(mpmath.stieltjes, n, prec=prec)
1489+
1490+
def py_stieltjes_for_doctests(x):
1491+
"""
1492+
This function is for testing py_stieltjes().
1493+
1494+
EXAMPLES::
1495+
1496+
sage: from sage.symbolic.pynac import py_stieltjes_for_doctests
1497+
sage: py_stieltjes_for_doctests(0.0)
1498+
0.577215664901533
1499+
"""
1500+
return py_stieltjes(x)
1501+
14601502
cdef object py_zeta(object x) except +:
14611503
"""
14621504
Return the value of the zeta function at the given value.
@@ -2264,6 +2306,7 @@ def init_function_table():
22642306
py_funcs.py_bernoulli = &py_bernoulli
22652307
py_funcs.py_sin = &py_sin
22662308
py_funcs.py_cos = &py_cos
2309+
py_funcs.py_stieltjes = &py_stieltjes
22672310
py_funcs.py_zeta = &py_zeta
22682311
py_funcs.py_exp = &py_exp
22692312
py_funcs.py_log = &py_log

0 commit comments

Comments
 (0)