本文整理汇总了Python中sage.misc.all.verbose函数的典型用法代码示例。如果您正苦于以下问题:Python verbose函数的具体用法?Python verbose怎么用?Python verbose使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了verbose函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: derivative
def derivative(self, s, k=1):
r"""
Return the `k`-th derivative of the `L`-series at
`s`.
.. warning::
If `k` is greater than the order of vanishing of
`L` at `s` you may get nonsense.
EXAMPLES::
sage: E = EllipticCurve('389a')
sage: L = E.lseries().dokchitser()
sage: L.derivative(1,E.rank())
1.51863300057685
"""
self.__check_init()
s = self.__CC(s)
k = Integer(k)
z = self.gp().eval('L(%s,,%s)'%(s,k))
if 'pole' in z:
raise ArithmeticError(z)
elif 'Warning' in z:
i = z.rfind('\n')
msg = z[:i].replace('digits','decimal digits')
verbose(msg, level=-1)
return self.__CC(z[i:])
return self.__CC(z)
开发者ID:drupel,项目名称:sage,代码行数:29,代码来源:dokchitser.py
示例2: zeta_zeros
def zeta_zeros():
r"""
List of the imaginary parts of the first 2,001,052 zeros of the
Riemann zeta function, accurate to within 4e-9.
In order to use ``zeta_zeros()``, you will need to
install the optional Odlyzko database package::
sage -i database_odlyzko_zeta
You can see a list of all available optional packages with
``sage --optional``.
REFERENCES:
- http://www.dtc.umn.edu/~odlyzko/zeta_tables/index.html
EXAMPLES:
The following example prints the imaginary part of the 13th
nontrivial zero of the Riemann zeta function::
sage: zz = zeta_zeros() # optional - database_odlyzko_zeta
sage: zz[12] # optional - database_odlyzko_zeta
59.347044003
sage: len(zz) # optional - database_odlyzko_zeta
2001052
"""
sobj = os.path.join(SAGE_SHARE, 'odlyzko', 'zeros.sobj')
verbose("Loading Odlyzko database from " + sobj)
return load(sobj)
开发者ID:Babyll,项目名称:sage,代码行数:31,代码来源:odlyzko.py
示例3: cuspidal_submodule_q_expansion_basis
def cuspidal_submodule_q_expansion_basis(self, weight, prec=None):
r"""
Calculate a basis of `q`-expansions for the space of cusp forms of
weight ``weight`` for this group.
INPUT:
- ``weight`` (integer) -- the weight
- ``prec`` (integer or None) -- precision of `q`-expansions to return
ALGORITHM: Uses the method :meth:`cuspidal_ideal_generators` to
calculate generators of the ideal of cusp forms inside this ring. Then
multiply these up to weight ``weight`` using the generators of the
whole modular form space returned by :meth:`q_expansion_basis`.
EXAMPLES::
sage: R = ModularFormsRing(Gamma0(3))
sage: R.cuspidal_submodule_q_expansion_basis(20)
[q - 8532*q^6 - 88442*q^7 + O(q^8), q^2 + 207*q^6 + 24516*q^7 + O(q^8), q^3 + 456*q^6 + O(q^8), q^4 - 135*q^6 - 926*q^7 + O(q^8), q^5 + 18*q^6 + 135*q^7 + O(q^8)]
We compute a basis of a space of very large weight, quickly (using this
module) and slowly (using modular symbols), and verify that the answers
are the same. ::
sage: A = R.cuspidal_submodule_q_expansion_basis(80, prec=30) # long time (1s on sage.math, 2013)
sage: B = R.modular_forms_of_weight(80).cuspidal_submodule().q_expansion_basis(prec=30) # long time (19s on sage.math, 2013)
sage: A == B # long time
True
"""
d = self.modular_forms_of_weight(weight).cuspidal_submodule().dimension()
if d == 0: return []
minprec = self.modular_forms_of_weight(weight).sturm_bound()
if prec is None:
prec = working_prec = minprec
else:
working_prec = max(prec, minprec)
gen_weight = min(6, weight)
while True:
verbose("Trying to generate the %s-dimensional cuspidal submodule at weight %s using generators of weight up to %s" % (d, weight, gen_weight))
G = self.cuspidal_ideal_generators(maxweight=gen_weight, prec=working_prec)
flist = []
for (j, f, F) in G:
for g in self.q_expansion_basis(weight - j, prec=working_prec):
flist.append(g*f)
A = self.base_ring() ** working_prec
W = A.span([A(f.padded_list(working_prec)) for f in flist])
if W.rank() == d and (self.base_ring().is_field() or W.index_in_saturation() == 1):
break
else:
gen_weight += 1
verbose("Need more generators: trying again with generators of weight up to %s" % gen_weight)
R = G[0][1].parent()
return [R(list(x), prec=prec) for x in W.gens()]
开发者ID:saraedum,项目名称:sage-renamed,代码行数:60,代码来源:find_generators.py
示例4: taylor_series
def taylor_series(self, a=0, k=6, var='z'):
r"""
Return the first `k` terms of the Taylor series expansion
of the `L`-series about `a`.
This is returned as a series in ``var``, where you
should view ``var`` as equal to `s-a`. Thus
this function returns the formal power series whose coefficients
are `L^{(n)}(a)/n!`.
INPUT:
- ``a`` -- complex number (default: 0); point about
which to expand
- ``k`` -- integer (default: 6), series is
`O(``var``^k)`
- ``var`` -- string (default: 'z'), variable of power
series
EXAMPLES::
sage: L = Dokchitser(conductor=1, gammaV=[0], weight=1, eps=1, poles=[1], residues=[-1], init='1')
sage: L.taylor_series(2, 3)
1.64493406684823 - 0.937548254315844*z + 0.994640117149451*z^2 + O(z^3)
sage: E = EllipticCurve('37a')
sage: L = E.lseries().dokchitser()
sage: L.taylor_series(1)
0.000000000000000 + 0.305999773834052*z + 0.186547797268162*z^2 - 0.136791463097188*z^3 + 0.0161066468496401*z^4 + 0.0185955175398802*z^5 + O(z^6)
We compute a Taylor series where each coefficient is to high
precision. ::
sage: E = EllipticCurve('389a')
sage: L = E.lseries().dokchitser(200)
sage: L.taylor_series(1,3)
-9.094...e-82 + (5.1538...e-82)*z + 0.75931650028842677023019260789472201907809751649492435158581*z^2 + O(z^3)
"""
self.__check_init()
a = self.__CC(a)
k = Integer(k)
try:
z = self._gp_call_inst('Lseries', a, '', k - 1)
z = self.gp()('Vec(%s)' % z)
except TypeError as msg:
raise RuntimeError("%s\nUnable to compute Taylor expansion (try lowering the number of terms)" % msg)
r = repr(z)
if 'pole' in r:
raise ArithmeticError(r)
elif 'Warning' in r:
i = r.rfind('\n')
msg = r[:i].replace('digits', 'decimal digits')
verbose(msg, level=-1)
v = list(z)
K = self.__CC
v = [K(repr(x)) for x in v]
R = self.__CC[[var]]
return R(v, len(v))
开发者ID:mcognetta,项目名称:sage,代码行数:59,代码来源:dokchitser.py
示例5: __call__
def __call__(self, args):
"""
Used to call sympow with given args
"""
cmd = "sympow %s" % args
v = os.popen(cmd).read().strip()
verbose(v, level=2)
return v
开发者ID:JRSijsling,项目名称:lmfdb,代码行数:8,代码来源:sympowlmfdb.py
示例6: _delta_poly
def _delta_poly(prec=10):
"""
Return the q-expansion of Delta as a FLINT polynomial. Used internally by
the :func:`~delta_qexp` function. See the docstring of :func:`~delta_qexp`
for more information.
INPUT:
- ``prec`` -- integer; the absolute precision of the output
OUTPUT:
the q-expansion of Delta to precision ``prec``, as a FLINT
:class:`~sage.libs.flint.fmpz_poly.Fmpz_poly` object.
EXAMPLES::
sage: from sage.modular.modform.vm_basis import _delta_poly
sage: _delta_poly(7)
7 0 1 -24 252 -1472 4830 -6048
"""
if prec <= 0:
raise ValueError("prec must be positive")
v = [0] * prec
# Let F = \sum_{n >= 0} (-1)^n (2n+1) q^(floor(n(n+1)/2)).
# Then delta is F^8.
# First compute F^2 directly by naive polynomial multiplication,
# since F is very sparse.
stop = int((-1+math.sqrt(1+8*prec))/2.0)
# make list of index/value pairs for the sparse poly
values = [(n*(n+1)//2, ((-2*n-1) if (n & 1) else (2*n+1))) \
for n in xrange(stop+1)]
for (i1, v1) in values:
for (i2, v2) in values:
try:
v[i1 + i2] += v1 * v2
except IndexError:
break
f = Fmpz_poly(v)
t = verbose('made series')
f = f*f
f._unsafe_mutate_truncate(prec)
t = verbose('squared (2 of 3)', t)
f = f*f
f._unsafe_mutate_truncate(prec - 1)
t = verbose('squared (3 of 3)', t)
f = f.left_shift(1)
t = verbose('shifted', t)
return f
开发者ID:BlairArchibald,项目名称:sage,代码行数:55,代码来源:vm_basis.py
示例7: _delta_poly_modulo
def _delta_poly_modulo(N, prec=10):
"""
Return the q-expansion of `\Delta` modulo `N`. Used internally by
the :func:`~delta_qexp` function. See the docstring of :func:`~delta_qexp`
for more information.
INPUT:
- `N` -- positive integer modulo which we want to compute `\Delta`
- ``prec`` -- integer; the absolute precision of the output
OUTPUT:
the polynomial of degree ``prec``-1 which is the truncation
of `\Delta` modulo `N`, as an element of the polynomial
ring in `q` over the integers modulo `N`.
EXAMPLES::
sage: from sage.modular.modform.vm_basis import _delta_poly_modulo
sage: _delta_poly_modulo(5, 7)
2*q^6 + 3*q^4 + 2*q^3 + q^2 + q
sage: _delta_poly_modulo(10, 12)
2*q^11 + 7*q^9 + 6*q^7 + 2*q^6 + 8*q^4 + 2*q^3 + 6*q^2 + q
"""
if prec <= 0:
raise ValueError( "prec must be positive" )
v = [0] * prec
# Let F = \sum_{n >= 0} (-1)^n (2n+1) q^(floor(n(n+1)/2)).
# Then delta is F^8.
stop = int((-1+math.sqrt(8*prec))/2.0)
for n in xrange(stop+1):
v[n*(n+1)//2] = ((N-1)*(2*n+1) if (n & 1) else (2*n+1))
from sage.rings.all import Integers
P = PolynomialRing(Integers(N), 'q')
f = P(v)
t = verbose('made series')
# fast way of computing f*f truncated at prec
f = f._mul_trunc(f, prec)
t = verbose('squared (1 of 3)', t)
f = f._mul_trunc(f, prec)
t = verbose('squared (2 of 3)', t)
f = f._mul_trunc(f, prec - 1)
t = verbose('squared (3 of 3)', t)
f = f.shift(1)
t = verbose('shifted', t)
return f
开发者ID:BlairArchibald,项目名称:sage,代码行数:54,代码来源:vm_basis.py
示例8: load
def load(self):
"""
Load the entire encyclopedia into memory from a file. This is done
automatically if the user tries to perform a lookup or a search.
"""
if self.__loaded__ == True:
return
try:
file_seq = bz2.BZ2File(self.__file__, "r")
except IOError:
raise IOError(
"The Sloane Encyclopedia database must be installed. Use e.g. 'SloaneEncyclopedia.install()' to download and install it."
)
self.__data__ = {}
tm = verbose("Loading Sloane encyclopedia from disk")
entry = re.compile(r"A(?P<num>\d{6}) ,(?P<body>.*),$")
for L in file_seq:
if len(L) == 0:
continue
m = entry.search(L)
if m:
seqnum = int(m.group("num"))
msg = m.group("body").strip()
self.__data__[seqnum] = [seqnum, None, "," + msg + ",", None]
file_seq.close()
try:
file_names = bz2.BZ2File(self.__file_names__, "r")
entry = re.compile(r"A(?P<num>\d{6}) (?P<body>.*)$")
for L in file_names:
if len(L) == 0:
continue
m = entry.search(L)
if m:
seqnum = int(m.group("num"))
self.__data__[seqnum][3] = m.group("body").strip()
file_names.close()
self.__loaded_names__ = True
except KeyError:
### Some sequence in the names file isn't in the database
raise KeyError(
"Sloane OEIS sequence and name files do not match. Try reinstalling, e.g. SloaneEncyclopedia.install(overwrite=True)."
)
except IOError as msg:
### The names database is not installed
self.__loaded_names__ = False
verbose("Finished loading", tm)
self.__loaded__ = True
开发者ID:sharmaeklavya2,项目名称:sage,代码行数:51,代码来源:sloane.py
示例9: install
def install(self, oeis_url="http://oeis.org/stripped.gz", names_url="http://oeis.org/names.gz", overwrite=False):
"""
Download and install the online encyclopedia, raising an IOError if
either step fails.
INPUT:
- ``oeis_url`` - string (default: "http://oeis.org...")
The URL of the stripped.gz encyclopedia file.
- ``names_url`` - string (default: "http://oeis.org...")
The URL of the names.gz encyclopedia file. If you do not want to
download this file, set names_url=None.
- ``overwrite`` - boolean (default: False) If the encyclopedia is
already installed and overwrite=True, download and install the latest
version over the installed one.
"""
### See if the encyclopedia already exists
if not overwrite and os.path.exists(self.__file__):
raise IOError("Sloane encyclopedia is already installed")
tm = verbose("Downloading stripped version of Sloane encyclopedia")
try:
fname, _ = urllib.urlretrieve(oeis_url)
except IOError as msg:
raise IOError(
"%s\nError fetching the following website:\n %s\nTry checking your internet connection."
% (msg, oeis_url)
)
if not names_url is None:
try:
nname, _ = urllib.urlretrieve(names_url)
except IOError as msg:
raise IOError(
"%s\nError fetching the following website:\n %s\nTry checking your internet connection."
% (msg, names_url)
)
else:
nname = None
verbose("Finished downloading", tm)
self.install_from_gz(fname, nname, overwrite)
# Delete the temporary downloaded files
os.remove(fname)
if not nname is None:
os.remove(nname)
开发者ID:sharmaeklavya2,项目名称:sage,代码行数:48,代码来源:sloane.py
示例10: install
def install(self, oeis_url="http://oeis.org/classic/stripped.gz", names_url="http://oeis.org/classic/names.gz", overwrite=False):
"""
Download and install the online encyclopedia, raising an IOError if
either step fails.
INPUT:
- ``oeis_url`` - string (default: "http://www.research.att.com...")
The URL of the stripped.gz encyclopedia file.
- ``names_url`` - string (default: "http://www.research.att.com...")
The URL of the names.gz encyclopedia file. If you do not want to
download this file, set names_url=None.
- ``overwrite`` - boolean (default: False) If the encyclopedia is
already installed and overwrite=True, download and install the latest
version over the installed one.
"""
### See if the encyclopedia already exists
if not overwrite and os.path.exists(self.__file__):
raise IOError, "Sloane encyclopedia is already installed"
tm = verbose("Downloading stripped version of Sloane encyclopedia")
try:
fname, _ = urllib.urlretrieve(oeis_url);
except IOError, msg:
raise IOError, "%s\nError fetching the following website:\n %s\nTry checking your internet connection."%(msg, oeis_url)
开发者ID:bgxcpku,项目名称:sagelib,代码行数:27,代码来源:sloane.py
示例11: __call__
def __call__(self, s, c=None):
r"""
INPUT:
- ``s`` - complex number
.. note::
Evaluation of the function takes a long time, so each
evaluation is cached. Call ``self._clear_value_cache()`` to
clear the evaluation cache.
EXAMPLES::
sage: E = EllipticCurve('5077a')
sage: L = E.lseries().dokchitser(100)
sage: L(1)
0.00000000000000000000000000000
sage: L(1+I)
-1.3085436607849493358323930438 + 0.81298000036784359634835412129*I
"""
self.__check_init()
s = self.__CC(s)
try:
return self.__values[s]
except AttributeError:
self.__values = {}
except KeyError:
pass
z = self.gp().eval('L(%s)'%s)
if 'pole' in z:
print(z)
raise ArithmeticError
elif '***' in z:
print(z)
raise RuntimeError
elif 'Warning' in z:
i = z.rfind('\n')
msg = z[:i].replace('digits','decimal digits')
verbose(msg, level=-1)
ans = self.__to_CC(z[i+1:])
self.__values[s] = ans
return ans
ans = self.__to_CC(z)
self.__values[s] = ans
return ans
开发者ID:drupel,项目名称:sage,代码行数:46,代码来源:dokchitser.py
示例12: _find_scaling_period
def _find_scaling_period(self):
r"""
Uses the integral period map of the modular symbol implementation in sage
in order to determine the scaling. The resulting modular symbol is correct
only for the `X_0`-optimal curve, at least up to a possible factor +-1 or +-2.
EXAMPLES::
sage: E = EllipticCurve('11a1')
sage: m = sage.schemes.elliptic_curves.ell_modular_symbols.ModularSymbolSage(E,+1,normalize='period')
sage: m._e
(1/5, 1)
sage: E = EllipticCurve('11a2')
sage: m = sage.schemes.elliptic_curves.ell_modular_symbols.ModularSymbolSage(E,+1,normalize='period')
sage: m._e
(1, 5)
sage: E = EllipticCurve('121b2')
sage: m = sage.schemes.elliptic_curves.ell_modular_symbols.ModularSymbolSage(E,+1,normalize='period')
sage: m._e
(0, 11/2, 0, 11/2, 11/2, 0, 0, -3, 2, 1/2, -1, 3/2)
"""
P = self._modsym.integral_period_mapping()
self._e = P.matrix().transpose().row(0)
self._e /= 2
E = self._E
try :
crla = parse_cremona_label(E.label())
except RuntimeError: # raised when curve is outside of the table
self._scaling = 1
else :
cr0 = Integer(crla[0]).str() + crla[1] + '1'
E0 = EllipticCurve(cr0)
if self._sign == 1:
q = E0.period_lattice().basis()[0]/E.period_lattice().basis()[0]
else:
q = E0.period_lattice().basis()[1].imag()/E.period_lattice().basis()[1].imag()
if E0.real_components() == 1:
q *= 2
if E.real_components() == 1:
q /= 2
q = QQ(int(round(q*200)))/200
verbose('scale modular symbols by %s'%q)
self._scaling = q
self._e *= self._scaling
开发者ID:drupel,项目名称:sage,代码行数:46,代码来源:ell_modular_symbols.py
示例13: __scale_by_periods_only__
def __scale_by_periods_only__(self):
r"""
If we fail to scale with ``_find_scaling_L_ratio``, we drop here
to try and find the scaling by the quotient of the
periods to the `X_0`-optimal curve. The resulting ``_scaling``
is not guaranteed to be correct, but could well be.
EXAMPLES::
sage: E = EllipticCurve('19a1')
sage: m = E.modular_symbol(sign=+1)
sage: m.__scale_by_periods_only__()
Warning : Could not normalize the modular symbols, maybe all further results will be multiplied by -1, 2 or -2.
sage: m._scaling
1
sage: E = EllipticCurve('19a2')
sage: m = E.modular_symbol(sign=+1)
sage: m._scaling
3/2
sage: m.__scale_by_periods_only__()
Warning : Could not normalize the modular symbols, maybe all further results will be multiplied by -1, 2 or -2.
sage: m._scaling
3
"""
# we only do this inside the cremona-tables.
try :
crla = parse_cremona_label(self._E.label())
except RuntimeError: # raised when curve is outside of the table
print("Warning : Could not normalize the modular symbols, maybe all further results will be multiplied by a rational number.")
self._scaling = 1
else :
print("Warning : Could not normalize the modular symbols, maybe all further results will be multiplied by -1, 2 or -2.")
cr0 = Integer(crla[0]).str() + crla[1] + '1'
E0 = EllipticCurve(cr0)
if self._sign == 1:
q = E0.period_lattice().basis()[0]/self._E.period_lattice().basis()[0]
else:
q = E0.period_lattice().basis()[1].imag()/self._E.period_lattice().basis()[1].imag()
if E0.real_components() == 1:
q *= 2
if self._E.real_components() == 1:
q /= 2
q = ZZ(int(round(q*200)))/200
verbose('scale modular symbols by %s'%q)
self._scaling = q
开发者ID:drupel,项目名称:sage,代码行数:46,代码来源:ell_modular_symbols.py
示例14: new_decomposition
def new_decomposition(self):
"""
Return complete irreducible Hecke decomposition of "new"
subspace of self.
OUTPUT:
- sorted Sequence of subspaces of self
EXAMPLES::
sage: from sage.modular.hilbert.sqrt5_hmf import F, QuaternionicModule
sage: H = QuaternionicModule(3 * F.prime_above(31)); H
Quaternionic module of dimension 6, level 15*a-6 (of norm 279=3^2*31) over QQ(sqrt(5))
sage: H.new_decomposition()
[
Subspace of dimension 1 ...,
Subspace of dimension 1 ...,
Subspace of dimension 1 ...,
Subspace of dimension 1 ...
]
"""
V = self.degeneracy_matrix().kernel()
primes = PrimesCoprimeTo(self.level())
p = primes.next()
T = self.hecke_matrix(p)
D = T.decomposition_of_subspace(V)
while len([X for X in D if not X[1]]) > 0:
p = primes.next()
verbose('Norm(p) = %s'%p.norm())
T = self.hecke_matrix(p)
D2 = []
for X in D:
if X[1]:
D2.append(X)
else:
for Z in T.decomposition_of_subspace(X[0]):
D2.append(Z)
D = D2
D = [self.subspace(X[0]) for X in D]
D.sort()
S = Sequence(D, immutable=True, cr=True, universe=int, check=False)
return S
开发者ID:williamstein,项目名称:hilbert-sqrt5,代码行数:44,代码来源:sqrt5_hmf.py
示例15: __lalg__
def __lalg__(self,D):
r"""
For positive `D`, this function evaluates the quotient
`L(E_D,1)\cdot \sqrt(D)/\Omega_E` where `E_D` is the twist of
`E` by `D`, `\Omega_E` is the least positive period of `E`.
For negative `E`, it is the quotient
`L(E_D,1)\cdot \sqrt(-D)/\Omega^{-}_E`
where `\Omega^{-}_E` is the least positive imaginary part of a
non-real period of `E`.
EXAMPLES::
sage: E = EllipticCurve('11a1')
sage: m = E.modular_symbol(sign=+1, implementation='sage')
sage: m.__lalg__(1)
1/5
sage: m.__lalg__(3)
5/2
"""
from sage.functions.all import sqrt
# the computation of the L-value could take a lot of time,
# but then the conductor is so large
# that the computation of modular symbols for E took even longer
E = self._E
ED = E.quadratic_twist(D)
lv = ED.lseries().L_ratio() # this is L(ED,1) divided by the Néron period omD of ED
lv *= ED.real_components() # now it is by the least positive period
omD = ED.period_lattice().basis()[0]
if D > 0 :
om = E.period_lattice().basis()[0]
q = sqrt(D)*omD/om * 8
else :
om = E.period_lattice().basis()[1].imag()
if E.real_components() == 1:
om *= 2
q = sqrt(-D)*omD/om*8
# see padic_lseries.pAdicLeries._quotient_of_periods_to_twist
# for the explanation of the second factor
verbose('real approximation is %s'%q)
return lv/8 * QQ(int(round(q)))
开发者ID:mcognetta,项目名称:sage,代码行数:43,代码来源:ell_modular_symbols.py
示例16: __init__
def __init__(self, ambient_space):
"""
Return the Eisenstein submodule of the given space.
EXAMPLES::
sage: E = ModularForms(23,4).eisenstein_subspace() ## indirect doctest
sage: E
Eisenstein subspace of dimension 2 of Modular Forms space of dimension 7 for Congruence Subgroup Gamma0(23) of weight 4 over Rational Field
sage: E == loads(dumps(E))
True
"""
verbose('creating eisenstein submodule of %s'%ambient_space)
d = ambient_space._dim_eisenstein()
V = ambient_space.module()
n = V.dimension()
self._start_position = int(n - d)
S = V.submodule([V.gen(i) for i in range(n-d,n)], check=False,
already_echelonized=True)
submodule.ModularFormsSubmodule.__init__(self, ambient_space, S)
开发者ID:Babyll,项目名称:sage,代码行数:20,代码来源:eisenstein_submodule.py
示例17: zeta_zeros
def zeta_zeros():
r"""
List of the imaginary parts of the first 100,000 nontrivial zeros
of the Riemann zeta function. Andrew Odlyzko computed these to
precision within `3\cdot 10^{-9}`.
In order to use ``zeta_zeros()``, you will need to
install the optional Odlyzko database package: ``sage -i
database_odlyzko_zeta``. You can see a list of all
available optional packages with ``sage --optional``.
REFERENCES:
- http://www.dtc.umn.edu/~odlyzko/zeta_tables/
EXAMPLES:
The following example prints the imaginary part of the 13th
nontrivial zero of the Riemann zeta function. Note that only the
first 9 digits after the decimal come from the database. Subsequent
digits are the result of the inherent imprecision of a binary
representation of decimal numbers.
::
sage: zz = zeta_zeros() # optional - database_odlyzko_zeta
sage: zz[12] # optional - database_odlyzko_zeta
59.347044003...
"""
path = os.path.join(SAGE_SHARE,'odlyzko')
file = os.path.join(path,'zeros1')
if os.path.exists(file+".pickle"):
verbose("Loading Odlyzko database from " + file + ".pickle")
return db.load(file+".pickle")
verbose("Creating Odlyzko Database.")
F = [eval(x) for x in open(file).read().split()]
db.save(F, file+".pickle")
return F
开发者ID:bukzor,项目名称:sage,代码行数:38,代码来源:odlyzko.py
示例18: _quotient_of_periods_to_twist
def _quotient_of_periods_to_twist(self,D):
r"""
For a fundamental discriminant `D` of a quadratic number field
this computes the constant `\eta` such that
`\sqrt{D}\cdot\Omega_{E_D}^{+} =\eta\cdot
\Omega_E^{sign(D)}`. As in [MTT]_ page 40. This is either 1
or 2 unless the condition on the twist is not satisfied,
e.g. if we are 'twisting back' to a semi-stable curve.
REFERENCES:
- [MTT] B. Mazur, J. Tate, and J. Teitelbaum,
On `p`-adic analogues of the conjectures of Birch and
Swinnerton-Dyer, Invertiones mathematicae 84, (1986), 1-48.
.. note: No check on precision is made, so this may fail for huge `D`.
EXAMPLES::
"""
from sage.functions.all import sqrt
# This funciton does not depend on p and could be moved out of this file but it is needed only here
# Note that the number of real components does not change by twisting.
if D == 1:
return 1
if D > 1:
Et = self._E.quadratic_twist(D)
qt = Et.period_lattice().basis()[0]/self._E.period_lattice().basis()[0]
qt *= sqrt(qt.parent()(D))
else:
Et = self._E.quadratic_twist(D)
qt = Et.period_lattice().basis()[0]/self._E.period_lattice().basis()[1].imag()
qt *= sqrt(qt.parent()(-D))
verbose('the real approximation is %s'%qt)
# we know from MTT that the result has a denominator 1
return QQ(int(round(8*qt)))/8
开发者ID:Alwnikrotikz,项目名称:purplesage,代码行数:37,代码来源:padic_lseries.py
示例19: _find_scaling_L_ratio
def _find_scaling_L_ratio(self):
r"""
This function is use to set ``_scaling``, the factor used to adjust the
scalar multiple of the modular symbol.
If `[0]`, the modular symbol evaluated at 0, is non-zero, we can just scale
it with respect to the approximation of the L-value. It is known that
the quotient is a rational number with small denominator.
Otherwise we try to scale using quadratic twists.
``_scaling`` will be set to a rational non-zero multiple if we succeed and to 1 otherwise.
Even if we fail we scale at least to make up the difference between the periods
of the `X_0`-optimal curve and our given curve `E` in the isogeny class.
EXAMPLES::
sage : m = EllipticCurve('11a1').modular_symbol(use_eclib=True)
sage : m._scaling
1
sage: m = EllipticCurve('11a2').modular_symbol(use_eclib=True)
sage: m._scaling
5/2
sage: m = EllipticCurve('11a3').modular_symbol(use_eclib=True)
sage: m._scaling
1/10
sage: m = EllipticCurve('11a1').modular_symbol(use_eclib=False)
sage: m._scaling
1/5
sage: m = EllipticCurve('11a2').modular_symbol(use_eclib=False)
sage: m._scaling
1
sage: m = EllipticCurve('11a3').modular_symbol(use_eclib=False)
sage: m._scaling
1/25
sage: m = EllipticCurve('37a1').modular_symbol(use_eclib=False)
sage: m._scaling
1
sage: m = EllipticCurve('37a1').modular_symbol(use_eclib=True)
sage: m._scaling
-1
sage: m = EllipticCurve('389a1').modular_symbol(use_eclib=True)
sage: m._scaling
-1/2
sage: m = EllipticCurve('389a1').modular_symbol(use_eclib=False)
sage: m._scaling
2
sage: m = EllipticCurve('196a1').modular_symbol(use_eclib=False)
sage: m._scaling
1/2
Some harder cases fail::
sage: m = EllipticCurve('121b1').modular_symbol(use_eclib=False)
Warning : Could not normalize the modular symbols, maybe all further results will be multiplied by -1, 2 or -2.
sage: m._scaling
1
TESTS::
sage: rk0 = ['11a1', '11a2', '15a1', '27a1', '37b1']
sage: for la in rk0: # long time (3s on sage.math, 2011)
... E = EllipticCurve(la)
... me = E.modular_symbol(use_eclib = True)
... ms = E.modular_symbol(use_eclib = False)
... print E.lseries().L_ratio()*E.real_components(), me(0), ms(0)
1/5 1/5 1/5
1 1 1
1/4 1/4 1/4
1/3 1/3 1/3
2/3 2/3 2/3
sage: rk1 = ['37a1','43a1','53a1', '91b1','91b2','91b3']
sage: [EllipticCurve(la).modular_symbol(use_eclib=True)(0) for la in rk1] # long time (1s on sage.math, 2011)
[0, 0, 0, 0, 0, 0]
sage: for la in rk1: # long time (8s on sage.math, 2011)
... E = EllipticCurve(la)
... m = E.modular_symbol(use_eclib = True)
... lp = E.padic_lseries(5)
... for D in [5,17,12,8]:
... ED = E.quadratic_twist(D)
... md = sum([kronecker(D,u)*m(ZZ(u)/D) for u in range(D)])
... etaa = lp._quotient_of_periods_to_twist(D)
... assert ED.lseries().L_ratio()*ED.real_components()*etaa == md
"""
E = self._E
self._scaling = 1 # by now.
self._failed_to_scale = False
if self._sign == 1 :
at0 = self(0)
# print 'modular symbol evaluates to ',at0,' at 0'
if at0 != 0 :
l1 = self.__lalg__(1)
if at0 != l1:
verbose('scale modular symbols by %s'%(l1/at0))
self._scaling = l1/at0
else :
# if [0] = 0, we can still hope to scale it correctly by considering twists of E
Dlist = [5,8,12,13,17,21,24,28,29, 33, 37, 40, 41, 44, 53, 56, 57, 60, 61, 65, 69, 73, 76, 77, 85, 88, 89, 92, 93, 97] # a list of positive fundamental discriminants
j = 0
#.........这里部分代码省略.........
开发者ID:dagss,项目名称:sage,代码行数:101,代码来源:ell_modular_symbols.py
示例20: verbose
raise IOError, "Sloane encyclopedia is already installed"
tm = verbose("Downloading stripped version of Sloane encyclopedia")
try:
fname, _ = urllib.urlretrieve(oeis_url);
except IOError, msg:
raise IOError, "%s\nError fetching the following website:\n %s\nTry checking your internet connection."%(msg, oeis_url)
if not names_url is None:
try:
nname, _ = urllib.urlretrieve(names_url);
except IOError, msg:
raise IOError, "%s\nError fetching the following website:\n %s\nTry checking your internet connection."%(msg, names_url)
else:
nname = None
verbose("Finished downloading", tm)
self.install_from_gz(fname, nname, overwrite)
# Delete the temporary downloaded files
os.remove(fname)
if not nname is None:
os.remove(nname)
def install_from_gz(self, stripped_file, names_file, overwrite=False):
"""
Install the online encyclopedia from a local stripped.gz file.
INPUT:
- ``stripped_file`` - string. The name of the stripped.gz OEIS file.
开发者ID:bgxcpku,项目名称:sagelib,代码行数:30,代码来源:sloane.py
注:本文中的sage.misc.all.verbose函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论