Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagesmc
Path: blob/master/src/sage/databases/odlyzko.py
8814 views
1
"""
2
Tables of zeros of the Riemann-Zeta function
3
"""
4
5
#*****************************************************************************
6
#
7
# Sage: Copyright (C) 2004 William Stein <[email protected]>
8
#
9
# Distributed under the terms of the GNU General Public License (GPL)
10
#
11
# This code is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
# General Public License for more details.
15
#
16
# The full text of the GPL is available at:
17
#
18
# http://www.gnu.org/licenses/
19
#*****************************************************************************
20
21
import os
22
23
import sage.misc.db as db
24
import sage.misc.misc as misc
25
26
def zeta_zeros():
27
r"""
28
List of the imaginary parts of the first 100,000 nontrivial zeros
29
of the Riemann zeta function. Andrew Odlyzko computed these to
30
precision within `3\cdot 10^{-9}`.
31
32
In order to use ``zeta_zeros()``, you will need to
33
install the optional Odlyzko database package: ``sage -i
34
database_odlyzko_zeta``. You can see a list of all
35
available optional packages with ``sage --optional``.
36
37
REFERENCES:
38
39
- http://www.dtc.umn.edu/~odlyzko/zeta_tables/
40
41
EXAMPLES:
42
43
The following example prints the imaginary part of the 13th
44
nontrivial zero of the Riemann zeta function. Note that only the
45
first 9 digits after the decimal come from the database. Subsequent
46
digits are the result of the inherent imprecision of a binary
47
representation of decimal numbers.
48
49
::
50
51
sage: zz = zeta_zeros() # optional - database_odlyzko_zeta
52
sage: zz[12] # optional - database_odlyzko_zeta
53
59.347044003...
54
"""
55
path = os.path.join(misc.SAGE_SHARE,'odlyzko')
56
file = os.path.join(path,'zeros1')
57
if os.path.exists(file+".pickle"):
58
misc.verbose("Loading Odlyzko database from " + file + ".pickle")
59
return db.load(file+".pickle")
60
misc.verbose("Creating Odlyzko Database.")
61
F = [eval(x) for x in open(file).read().split()]
62
db.save(F, file+".pickle")
63
return F
64
65
66