本文整理汇总了Python中sage.databases.cremona.parse_cremona_label函数的典型用法代码示例。如果您正苦于以下问题:Python parse_cremona_label函数的具体用法?Python parse_cremona_label怎么用?Python parse_cremona_label使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parse_cremona_label函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: curve_cmp
def curve_cmp(E1, E2):
r"""
Comparison function for elliptic curves over `Q`.
Order by label if in the database, else first by conductor, then
by c_invariants.
"""
t = cmp(E1.conductor(), E2.conductor())
if t:
return t
# Now they have the same conductor
try:
from sage.databases.cremona import parse_cremona_label, class_to_int
k1 = parse_cremona_label(E1.label())
k2 = parse_cremona_label(E2.label())
t = cmp(class_to_int(k1[1]), class_to_int(k2[1]))
if t:
return t
return cmp(k1[2], k2[2])
except RuntimeError: # if not in database, label() will fail
pass
return cmp(E1.ainvs(), E2.ainvs())
示例2: cmp_label
def cmp_label(lab1, lab2):
from sage.databases.cremona import parse_cremona_label, class_to_int
a, b, c = parse_cremona_label(lab1)
id1 = int(a), class_to_int(b), int(c)
a, b, c = parse_cremona_label(lab2)
id2 = int(a), class_to_int(b), int(c)
return cmp(id1, id2)
示例3: curve_key
def curve_key(E1):
r"""
Comparison key for elliptic curves over `\QQ`.
The key is a tuple:
- if the curve is in the database: (conductor, 0, label, number)
- otherwise: (conductor, 1, a_invariants)
EXAMPLES::
sage: from sage.schemes.elliptic_curves.ell_egros import curve_key
sage: E = EllipticCurve_from_j(1728)
sage: curve_key(E)
(32, 0, 0, 2)
sage: E = EllipticCurve_from_j(1729)
sage: curve_key(E)
(2989441, 1, (1, 0, 0, -36, -1))
"""
try:
from sage.databases.cremona import parse_cremona_label, class_to_int
N, l, k = parse_cremona_label(E1.label())
return (N, 0, class_to_int(l), k)
except RuntimeError:
return (E1.conductor(), 1, E1.ainvs())
示例4: curve_cmp
def curve_cmp(E1, E2):
r"""
Comparison function for elliptic curves over `\QQ`.
Order by label if in the database, else first by conductor, then
by c_invariants.
Deprecated, please use instead `curve_key`.
EXAMPLES::
sage: from sage.schemes.elliptic_curves.ell_egros import curve_cmp
sage: E1 = EllipticCurve_from_j(1728)
sage: E2 = EllipticCurve_from_j(1729)
sage: curve_cmp(E1,E2)
doctest:...: DeprecationWarning: Please use 'curve_key' instead.
See http://trac.sagemath.org/21142 for details.
-1
"""
from sage.misc.superseded import deprecation
deprecation(21142, "Please use 'curve_key' instead.")
t = cmp(E1.conductor(), E2.conductor())
if t:
return t
# Now they have the same conductor
try:
from sage.databases.cremona import parse_cremona_label, class_to_int
k1 = parse_cremona_label(E1.label())
k2 = parse_cremona_label(E2.label())
t = cmp(class_to_int(k1[1]),class_to_int(k2[1]))
if t:
return t
return cmp(k1[2], k2[2])
except RuntimeError: # if not in database, label() will fail
pass
return cmp(E1.ainvs(),E2.ainvs())
示例5: _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
示例6: __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
示例7: make_allcurves_lines
def make_allcurves_lines(outfile, code, ainvs, r, t):
E = EllipticCurve(ainvs)
N, cl, n = parse_cremona_label(code)
for i, F in enumerate(E.isogeny_class().curves):
put_allcurves_line(outfile,N,cl,str(i+1),list(F.ainvs()),r,F.torsion_order())
outfile.flush()
示例8: _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 +- a
power of 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)
TESTS::
sage: E = EllipticCurve('19a1')
sage: m = E.modular_symbol(sign=+1, implementation='sage', normalize='none')
sage: m._find_scaling_period()
sage: m._scaling
1
sage: E = EllipticCurve('19a2')
sage: m = E.modular_symbol(sign=+1, implementation='sage', normalize='none')
sage: m._scaling
1
sage: m._find_scaling_period()
sage: m._scaling
3
"""
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
print("Warning : Could not normalize the modular symbols, maybe all further results will be multiplied by a rational number.")
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
c = self(0) # required, to change base point from oo to 0
if c<0:
c *= -1
self._scaling *= -1
self._at_zero = c
self._e *= self._scaling
示例9: cmp_label
def cmp_label(lab1, lab2):
a, b, c = parse_cremona_label(lab1)
id1 = int(a), class_to_int(b), int(c)
a, b, c = parse_cremona_label(lab2)
id2 = int(a), class_to_int(b), int(c)
return cmp(id1, id2)