Skip to content

Commit 5b20958

Browse files
committed
Allow construct elliptic curve given period_lattice
1 parent 1ab9992 commit 5b20958

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed

src/sage/schemes/elliptic_curves/constructor.py

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,100 @@ def create_object(self, version, key, *, names=None, **kwds):
524524
from .ell_generic import EllipticCurve_generic
525525
return EllipticCurve_generic(R, x)
526526

527+
@staticmethod
528+
def _eisenstein_series_e_eval(weight, tau, prec):
529+
r"""
530+
Private method to evaluate `E_{2k}`.
531+
532+
INPUT:
533+
534+
- prec -- precision in bits
535+
536+
OUTPUT:
537+
538+
Element of ``ComplexField(prec)`` equal to `E_{2k}(\tau)` where ``2k == weight``.
539+
540+
TESTS:
541+
542+
Example values::
543+
544+
sage: tau = CC(2/3*I+4/5)
545+
sage: weight = 6
546+
547+
Evaluating using our method::
548+
549+
sage: EllipticCurve._eisenstein_series_e_eval(weight, tau, 53) # abs tol 1e-10
550+
2.06948373064822 + 9.23822630732235*I
551+
552+
Approximately evaluate using convergent sum::
553+
554+
sage: sum((a+b*tau)^-weight for a in (-50..50) for b in (-50..50) if gcd(a, b)==1)/2 # abs tol 1e-10
555+
2.06948373572619 + 9.23822632418512*I
556+
557+
Higher precision::
558+
559+
sage: EllipticCurve._eisenstein_series_e_eval(weight, tau, 200) # abs tol 1e-60
560+
2.0694837306482189422343628966349567015465461257928410093613 + 9.2382263073223530637169893909058439360384065238856673719976*I
561+
"""
562+
from sage.modular.modform.constructor import EisensteinForms
563+
M = EisensteinForms(1, weight)
564+
f = M.gen(0)
565+
from sage.rings.complex_mpfr import ComplexField
566+
F = ComplexField(prec)
567+
return F(f.eval_at_tau(F(tau))/f.qexp(1)[0])
568+
569+
@staticmethod
570+
def _eisenstein_series_g_eval(weight, tau, prec):
571+
r"""
572+
Similar to :meth:`_eisenstein_series_e_eval`, but evaluates `G_{2k}`.
573+
574+
TESTS::
575+
576+
sage: tau = CC(2/3*I+4/5)
577+
sage: weight = 6
578+
sage: EllipticCurve._eisenstein_series_g_eval(weight, tau, 53) # abs tol 1e-10
579+
4.21074983052932 + 18.7968908775932*I
580+
581+
Higher precision::
582+
583+
sage: EllipticCurve._eisenstein_series_g_eval(weight, tau, 200) # abs tol 1e-60
584+
4.2107498305293201023614384183445982620640708046199904172058 + 18.796890877593226640592176459453734505169430012077274805656*I
585+
"""
586+
from sage.functions.transcendental import zeta
587+
e = EllipticCurve._eisenstein_series_e_eval(weight, tau, prec)
588+
return e.parent()(zeta(weight) * 2 * e)
589+
590+
@staticmethod
591+
def from_period_lattice_basis(w1, w2):
592+
r"""
593+
Construct an elliptic curve from a period lattice basis.
594+
595+
INPUT:
596+
597+
- ``w1``, ``w2`` -- basis elements, must be element of ``ComplexField(prec)`` for some ``prec``
598+
599+
OUTPUT:
600+
601+
``EllipticCurve`` instance with base ring ``ComplexField(prec)``
602+
603+
EXAMPLES::
604+
605+
sage: F = ComplexField(53)
606+
sage: w1 = F(1)
607+
sage: w2 = F(I * sqrt(7))
608+
sage: E = EllipticCurve.from_period_lattice_basis(w1, w2)
609+
sage: E.period_lattice().basis() # abs tol 1e-10
610+
(-2.64575131106483*I, -1.00000000000000)
611+
"""
612+
F = w1.parent()
613+
if F != w2.parent():
614+
raise ValueError("basis elements must have the same parent")
615+
prec = F.precision()
616+
tau = w2/w1
617+
g2 = -60*EllipticCurve._eisenstein_series_g_eval(4, tau, prec)/w1**4
618+
g3 = -140*EllipticCurve._eisenstein_series_g_eval(6, tau, prec)/w1**6
619+
return EllipticCurve(F, [(g2/4).real(), (g3/4).real()])
620+
527621

528622
EllipticCurve = EllipticCurveFactory('sage.schemes.elliptic_curves.constructor.EllipticCurve')
529623

0 commit comments

Comments
 (0)