Skip to content

Commit 0625fc1

Browse files
committed
Add wrapper for FLINT's acb_dirichlet_zeta_zeros
New method `ComplexBallField.zeta_zeros` that wraps `acb_dirichlet_zeta_zeros` for computing zeros of the Rieman ζ function.
1 parent dc99dc8 commit 0625fc1

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

src/sage/rings/complex_arb.pyx

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ from sage.libs.flint.acb_hypgeom cimport *
168168
from sage.libs.flint.acb_elliptic cimport *
169169
from sage.libs.flint.acb_modular cimport *
170170
from sage.libs.flint.acb_poly cimport *
171+
from sage.libs.flint.acb_dirichlet cimport *
171172
from sage.libs.flint.arf cimport arf_init, arf_get_d, arf_get_mpfr, arf_clear, arf_set, arf_is_nan
172173
from sage.libs.flint.mag cimport (mag_init, mag_clear, mag_set_d,
173174
MAG_BITS, mag_zero, mag_set_ui_2exp_si,
@@ -1261,6 +1262,70 @@ class ComplexBallField(UniqueRepresentation, sage.rings.abc.ComplexBallField):
12611262

12621263
return res
12631264

1265+
def zeta_zeros(self, count, start=1):
1266+
r"""
1267+
Compute consecutive zeros of the Riemann zeta function.
1268+
1269+
INPUT:
1270+
1271+
- ``count`` -- positive integer; number of zeros to be computed, must fit in a machine integer
1272+
1273+
- ``start`` -- positive integer (default: 1); index of the first zero to be computed
1274+
1275+
OUTPUT:
1276+
1277+
A list of ``count`` consecutive zeros of the Riemann zeta function, starting from the ``start``-th zero.
1278+
Indexing starts at one, following usual mathematical notations.
1279+
1280+
EXAMPLES::
1281+
1282+
sage: CBF.zeta_zeros(10)
1283+
[0.5000000000000000 + [14.134725141734...]*I,
1284+
0.5000000000000000 + [21.0220396387715...]*I,
1285+
0.5000000000000000 + [25.010857580145...]*I,
1286+
0.5000000000000000 + [30.4248761258595...]*I,
1287+
0.5000000000000000 + [32.935061587739...]*I,
1288+
0.5000000000000000 + [37.586178158825...]*I,
1289+
0.5000000000000000 + [40.918719012147...]*I,
1290+
0.5000000000000000 + [43.32707328091...]*I,
1291+
0.5000000000000000 + [48.005150881167...]*I,
1292+
0.5000000000000000 + [49.773832477672...]*I]
1293+
1294+
sage: CBF.zeta_zeros(6, start=5)
1295+
[0.5000000000000000 + [32.935061587739...]*I,
1296+
0.5000000000000000 + [37.586178158825...]*I,
1297+
0.5000000000000000 + [40.918719012147...]*I,
1298+
0.5000000000000000 + [43.32707328091...]*I,
1299+
0.5000000000000000 + [48.005150881167...]*I,
1300+
0.5000000000000000 + [49.773832477672...]*I]
1301+
"""
1302+
cdef fmpz_t _start
1303+
fmpz_init(_start)
1304+
fmpz_set_mpz(_start, (<Integer> Integer(start)).value)
1305+
1306+
cdef long _count = count
1307+
if _count < 1:
1308+
raise ValueError("count must be positive")
1309+
1310+
cdef acb_ptr ar = _acb_vec_init(_count)
1311+
1312+
sig_on()
1313+
acb_dirichlet_zeta_zeros(ar, _start, _count, self._prec)
1314+
sig_off()
1315+
1316+
res = []
1317+
cdef ComplexBall b
1318+
for i in range(_count):
1319+
b = ComplexBall.__new__(ComplexBall)
1320+
b._parent = self
1321+
acb_swap(b.value, &ar[i])
1322+
res.append(b)
1323+
1324+
_acb_vec_clear(ar, _count)
1325+
fmpz_clear(_start)
1326+
1327+
return res
1328+
12641329

12651330
cdef inline bint _do_sig(long prec) noexcept:
12661331
"""

0 commit comments

Comments
 (0)