Skip to content

Commit 59bf01f

Browse files
author
Release Manager
committed
sagemathgh-39391: 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. <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [ ] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [x] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#39391 Reported by: Pierre Lairez Reviewer(s): Marc Mezzarobba
2 parents 9646a4e + 0625fc1 commit 59bf01f

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,
@@ -1258,6 +1259,70 @@ class ComplexBallField(UniqueRepresentation, sage.rings.abc.ComplexBallField):
12581259

12591260
return res
12601261

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

12621327
cdef inline bint _do_sig(long prec) noexcept:
12631328
"""

0 commit comments

Comments
 (0)