Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagelib
Path: blob/master/sage/databases/odlyzko.py
6915 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
PATH = "%s/data/"%misc.SAGE_ROOT
27
28
def zeta_zeros():
29
r"""
30
List of the imaginary parts of the first 100,000 nontrivial zeros
31
of the Riemann zeta function. Andrew Odlyzko computed these to
32
precision within `3\cdot 10^{-9}`.
33
34
In order to use ``zeta_zeros()``, you will need to
35
install the optional Odlyzko database package: ``sage -i
36
database_odlyzko_zeta``. You can see a list of all
37
available optional packages with ``sage -optional``.
38
39
REFERENCES:
40
41
- http://www.dtc.umn.edu/~odlyzko/zeta_tables/
42
43
EXAMPLES:
44
45
The following example prints the imaginary part of the 13th
46
nontrivial zero of the Riemann zeta function. Note that only the
47
first 9 digits after the decimal come from the database. Subsequent
48
digits are the result of the inherent imprecision of a binary
49
representation of decimal numbers.
50
51
::
52
53
sage: zz = zeta_zeros() # optional
54
sage: zz[12] # optional
55
59.347044003000001
56
"""
57
path = "%s/odlyzko"%PATH
58
file = "%s/zeros1"%path
59
if os.path.exists(file+".pickle"):
60
misc.verbose("Loading Odlyzko database from " + file + ".pickle")
61
return db.load(file+".pickle")
62
misc.verbose("Creating Odlyzko Database.")
63
F = [eval(x) for x in open(file).read().split()]
64
db.save(F, file+".pickle")
65
return F
66
67
68