This repository has been archived by the owner on Jan 30, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
period_lattice.py
1928 lines (1532 loc) · 69.2 KB
/
period_lattice.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# -*- coding: utf-8 -*-
r"""
Period lattices of elliptic curves and related functions
Let `E` be an elliptic curve defined over a number field `K`
(including `\QQ`). We attach a period lattice (a discrete rank 2
subgroup of `\CC`) to each embedding of `K` into `\CC`.
In the case of real embeddings, the lattice is stable under complex
conjugation and is called a real lattice. These have two types:
rectangular, (the real curve has two connected components and positive
discriminant) or non-rectangular (one connected component, negative
discriminant).
The periods are computed to arbitrary precision using the AGM (Gauss's
Arithmetic-Geometric Mean).
EXAMPLES::
sage: K.<a> = NumberField(x^3-2)
sage: E = EllipticCurve([0,1,0,a,a])
First we try a real embedding::
sage: emb = K.embeddings(RealField())[0]
sage: L = E.period_lattice(emb); L
Period lattice associated to Elliptic Curve defined by y^2 = x^3 + x^2 + a*x + a over Number Field in a with defining polynomial x^3 - 2 with respect to the embedding Ring morphism:
From: Number Field in a with defining polynomial x^3 - 2
To: Algebraic Real Field
Defn: a |--> 1.259921049894873?
The first basis period is real::
sage: L.basis()
(3.81452977217855, 1.90726488608927 + 1.34047785962440*I)
sage: L.is_real()
True
For a basis `\omega_1,\omega_2` normalised so that `\omega_1/\omega_2`
is in the fundamental region of the upper half-plane, use the function
``normalised_basis()`` instead::
sage: L.normalised_basis()
(1.90726488608927 - 1.34047785962440*I, -1.90726488608927 - 1.34047785962440*I)
Next a complex embedding::
sage: emb = K.embeddings(ComplexField())[0]
sage: L = E.period_lattice(emb); L
Period lattice associated to Elliptic Curve defined by y^2 = x^3 + x^2 + a*x + a over Number Field in a with defining polynomial x^3 - 2 with respect to the embedding Ring morphism:
From: Number Field in a with defining polynomial x^3 - 2
To: Algebraic Field
Defn: a |--> -0.6299605249474365? - 1.091123635971722?*I
In this case, the basis `\omega_1`, `\omega_2` is always normalised so
that `\tau = \omega_1/\omega_2` is in the fundamental region in the
upper half plane::
sage: w1,w2 = L.basis(); w1,w2
(-1.37588604166076 - 2.58560946624443*I, -2.10339907847356 + 0.428378776460622*I)
sage: L.is_real()
False
sage: tau = w1/w2; tau
0.387694505032876 + 1.30821088214407*I
sage: L.normalised_basis()
(-1.37588604166076 - 2.58560946624443*I, -2.10339907847356 + 0.428378776460622*I)
We test that bug #8415 (caused by a PARI bug fixed in v2.3.5) is OK::
sage: E = EllipticCurve('37a')
sage: K.<a> = QuadraticField(-7)
sage: EK = E.change_ring(K)
sage: EK.period_lattice(K.complex_embeddings()[0])
Period lattice associated to Elliptic Curve defined by y^2 + y = x^3 + (-1)*x over Number Field in a with defining polynomial x^2 + 7 with respect to the embedding Ring morphism:
From: Number Field in a with defining polynomial x^2 + 7
To: Algebraic Field
Defn: a |--> -2.645751311064591?*I
REFERENCES:
.. [CT] \J. E. Cremona and T. Thongjunthug, The Complex AGM, periods of
elliptic curves over $\CC$ and complex elliptic logarithms.
Journal of Number Theory Volume 133, Issue 8, August 2013, pages
2813-2841.
AUTHORS:
- ?: initial version.
- John Cremona:
- Adapted to handle real embeddings of number fields, September 2008.
- Added basis_matrix function, November 2008
- Added support for complex embeddings, May 2009.
- Added complex elliptic logs, March 2010; enhanced, October 2010.
"""
from sage.modules.free_module import FreeModule_generic_pid
from sage.rings.all import ZZ, QQ, RealField, ComplexField, QQbar, AA
from sage.rings.real_mpfr import is_RealField
from sage.rings.complex_field import is_ComplexField
from sage.rings.real_mpfr import RealNumber as RealNumber
from sage.rings.complex_number import ComplexNumber as ComplexNumber
from sage.rings.number_field.number_field import refine_embedding
from sage.rings.infinity import Infinity
from sage.schemes.elliptic_curves.constructor import EllipticCurve
from sage.misc.cachefunc import cached_method
class PeriodLattice(FreeModule_generic_pid):
"""
The class for the period lattice of an algebraic variety.
"""
pass
class PeriodLattice_ell(PeriodLattice):
r"""
The class for the period lattice of an elliptic curve.
Currently supported are elliptic curves defined over `\QQ`, and
elliptic curves defined over a number field with a real or complex
embedding, where the lattice constructed depends on that
embedding.
"""
def __init__(self, E, embedding=None):
r"""
Initialises the period lattice by storing the elliptic curve and the embedding.
INPUT:
- ``E`` -- an elliptic curve
- ``embedding`` (default: ``None``) -- an embedding of the base
field `K` of ``E`` into a real or complex field. If
``None``:
- use the built-in coercion to `\RR` for `K=\QQ`;
- use the first embedding into `\RR` given by
``K.embeddings(RealField())``, if there are any;
- use the first embedding into `\CC` given by
``K.embeddings(ComplexField())``, if `K` is totally complex.
.. note::
No periods are computed on creation of the lattice; see the
functions ``basis()``, ``normalised_basis()`` and
``real_period()`` for precision setting.
EXAMPLES:
This function is not normally called directly, but will be
called by the period_lattice() function of classes
ell_number_field and ell_rational_field::
sage: from sage.schemes.elliptic_curves.period_lattice import PeriodLattice_ell
sage: E = EllipticCurve('37a')
sage: PeriodLattice_ell(E)
Period lattice associated to Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field
::
sage: K.<a> = NumberField(x^3-2)
sage: emb = K.embeddings(RealField())[0]
sage: E = EllipticCurve([0,1,0,a,a])
sage: L = PeriodLattice_ell(E,emb); L
Period lattice associated to Elliptic Curve defined by y^2 = x^3 + x^2 + a*x + a over Number Field in a with defining polynomial x^3 - 2 with respect to the embedding Ring morphism:
From: Number Field in a with defining polynomial x^3 - 2
To: Algebraic Real Field
Defn: a |--> 1.259921049894873?
sage: emb = K.embeddings(ComplexField())[0]
sage: L = PeriodLattice_ell(E,emb); L
Period lattice associated to Elliptic Curve defined by y^2 = x^3 + x^2 + a*x + a over Number Field in a with defining polynomial x^3 - 2 with respect to the embedding Ring morphism:
From: Number Field in a with defining polynomial x^3 - 2
To: Algebraic Field
Defn: a |--> -0.6299605249474365? - 1.091123635971722?*I
TESTS::
sage: from sage.schemes.elliptic_curves.period_lattice import PeriodLattice_ell
sage: K.<a> = NumberField(x^3-2)
sage: emb = K.embeddings(RealField())[0]
sage: E = EllipticCurve([0,1,0,a,a])
sage: L = PeriodLattice_ell(E,emb)
sage: L == loads(dumps(L))
True
"""
# First we cache the elliptic curve with this period lattice:
self.E = E
# Next we cache the embedding into QQbar or AA which extends
# the given embedding:
K = E.base_field()
if embedding is None:
embs = K.embeddings(AA)
real = len(embs)>0
if not real:
embs = K.embeddings(QQbar)
embedding = embs[0]
else:
embedding = refine_embedding(embedding,Infinity)
real = embedding(K.gen()).imag().is_zero()
self.embedding = embedding
# Next we compute and cache (in self.real_flag) the type of
# the lattice: +1 for real rectangular, -1 for real
# non-rectangular, 0 for non-real:
self.real_flag = 0
if real:
self.real_flag = +1
if embedding(E.discriminant())<0:
self.real_flag = -1
# The following algebraic data associated to E and the
# embedding is cached:
#
# Ebar: the curve E base-changed to QQbar (or AA)
# f2: the 2-division polynomial of Ebar
# ei: the roots e1, e2, e3 of f2, as elements of QQbar (or AA)
#
# The ei are used both for period computation and elliptic
# logarithms.
self.Ebar = self.E.change_ring(self.embedding)
self.f2 = self.Ebar.two_division_polynomial()
if self.real_flag == 1: # positive discriminant
self._ei = self.f2.roots(AA,multiplicities=False)
self._ei.sort() # e1 < e2 < e3
e1, e2, e3 = self._ei
elif self.real_flag == -1: # negative discriminant
self._ei = self.f2.roots(QQbar,multiplicities=False)
self._ei = list(sorted(self._ei,key=lambda z: z.imag()))
e1, e3, e2 = self._ei # so e3 is real
e3 = AA(e3)
self._ei = [e1, e2, e3]
else:
self._ei = self.f2.roots(QQbar,multiplicities=False)
e1, e2, e3 = self._ei
# The quantities sqrt(e_i-e_j) are cached (as elements of
# QQbar) to be used in period computations:
self._abc = (e3-e1).sqrt(), (e3-e2).sqrt(), (e2-e1).sqrt()
PeriodLattice.__init__(self, base_ring=ZZ, rank=2, degree=1, sparse=False)
def __cmp__(self, other):
r"""
Comparison function for period lattices
TESTS::
sage: from sage.schemes.elliptic_curves.period_lattice import PeriodLattice_ell
sage: K.<a> = NumberField(x^3-2)
sage: E = EllipticCurve([0,1,0,a,a])
sage: embs = K.embeddings(ComplexField())
sage: L1,L2,L3 = [PeriodLattice_ell(E,e) for e in embs]
sage: L1 < L2 < L3
True
"""
if not isinstance(other, PeriodLattice_ell): return -1
t = cmp(self.E, other.E)
if t: return t
a = self.E.base_field().gen()
return cmp(self.embedding(a), other.embedding(a))
def __repr__(self):
"""
Returns the string representation of this period lattice.
EXAMPLES::
sage: E = EllipticCurve('37a')
sage: E.period_lattice()
Period lattice associated to Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field
::
sage: K.<a> = NumberField(x^3-2)
sage: emb = K.embeddings(RealField())[0]
sage: E = EllipticCurve([0,1,0,a,a])
sage: L = E.period_lattice(emb); L
Period lattice associated to Elliptic Curve defined by y^2 = x^3 + x^2 + a*x + a over Number Field in a with defining polynomial x^3 - 2 with respect to the embedding Ring morphism:
From: Number Field in a with defining polynomial x^3 - 2
To: Algebraic Real Field
Defn: a |--> 1.259921049894873?
"""
if self.E.base_field() is QQ:
return "Period lattice associated to %s"%(self.E)
else:
return "Period lattice associated to %s with respect to the embedding %s"%(self.E, self.embedding)
def __call__(self, P, prec=None):
r"""
Return the elliptic logarithm of a point `P`.
INPUT:
- ``P`` (point) -- a point on the elliptic curve associated
with this period lattice.
- ``prec`` (default: ``None``) -- precision in bits (default
precision if ``None``).
OUTPUT:
(complex number) The elliptic logarithm of the point `P` with
respect to this period lattice. If `E` is the elliptic curve
and `\sigma:K\to\CC` the embedding, then the returned value `z`
is such that `z\pmod{L}` maps to `\sigma(P)` under the
standard Weierstrass isomorphism from `\CC/L` to `\sigma(E)`.
EXAMPLES::
sage: E = EllipticCurve('389a')
sage: L = E.period_lattice()
sage: E.discriminant() > 0
True
sage: L.real_flag
1
sage: P = E([-1,1])
sage: P.is_on_identity_component ()
False
sage: L(P, prec=96)
0.4793482501902193161295330101 + 0.985868850775824102211203849...*I
sage: Q=E([3,5])
sage: Q.is_on_identity_component()
True
sage: L(Q, prec=96)
1.931128271542559442488585220
Note that this is actually the inverse of the Weierstrass isomorphism::
sage: L.elliptic_exponential(L(Q))
(3.00000000000000 : 5.00000000000000 : 1.00000000000000)
An example with negative discriminant, and a torsion point::
sage: E = EllipticCurve('11a1')
sage: L = E.period_lattice()
sage: E.discriminant() < 0
True
sage: L.real_flag
-1
sage: P = E([16,-61])
sage: L(P)
0.253841860855911
sage: L.real_period() / L(P)
5.00000000000000
"""
return self.elliptic_logarithm(P,prec)
@cached_method
def basis(self, prec=None, algorithm='sage'):
r"""
Return a basis for this period lattice as a 2-tuple.
INPUT:
- ``prec`` (default: ``None``) -- precision in bits (default
precision if ``None``).
- ``algorithm`` (string, default 'sage') -- choice of
implementation (for real embeddings only) between 'sage'
(native Sage implementation) or 'pari' (use the PARI
library: only available for real embeddings).
OUTPUT:
(tuple of Complex) `(\omega_1,\omega_2)` where the lattice is
`\ZZ\omega_1 + \ZZ\omega_2`. If the lattice is real then
`\omega_1` is real and positive, `\Im(\omega_2)>0` and
`\Re(\omega_1/\omega_2)` is either `0` (for rectangular
lattices) or `\frac{1}{2}` (for non-rectangular lattices).
Otherwise, `\omega_1/\omega_2` is in the fundamental region of
the upper half-plane. If the latter normalisation is required
for real lattices, use the function ``normalised_basis()``
instead.
EXAMPLES::
sage: E = EllipticCurve('37a')
sage: E.period_lattice().basis()
(2.99345864623196, 2.45138938198679*I)
This shows that the issue reported at :trac:`3954` is fixed::
sage: E = EllipticCurve('37a')
sage: b1 = E.period_lattice().basis(prec=30)
sage: b2 = E.period_lattice().basis(prec=30)
sage: b1 == b2
True
This shows that the issue reported at :trac:`4064` is fixed::
sage: E = EllipticCurve('37a')
sage: E.period_lattice().basis(prec=30)[0].parent()
Real Field with 30 bits of precision
sage: E.period_lattice().basis(prec=100)[0].parent()
Real Field with 100 bits of precision
::
sage: K.<a> = NumberField(x^3-2)
sage: emb = K.embeddings(RealField())[0]
sage: E = EllipticCurve([0,1,0,a,a])
sage: L = E.period_lattice(emb)
sage: L.basis(64)
(3.81452977217854509, 1.90726488608927255 + 1.34047785962440202*I)
sage: emb = K.embeddings(ComplexField())[0]
sage: L = E.period_lattice(emb)
sage: w1,w2 = L.basis(); w1,w2
(-1.37588604166076 - 2.58560946624443*I, -2.10339907847356 + 0.428378776460622*I)
sage: L.is_real()
False
sage: tau = w1/w2; tau
0.387694505032876 + 1.30821088214407*I
"""
# We divide into two cases: (1) Q, or a number field with a
# real embedding; (2) a number field with a complex embedding.
# In each case the periods are computed by a different
# internal function.
if self.is_real():
return self._compute_periods_real(prec=prec, algorithm=algorithm)
else:
return self._compute_periods_complex(prec=prec)
@cached_method
def normalised_basis(self, prec=None, algorithm='sage'):
r"""
Return a normalised basis for this period lattice as a 2-tuple.
INPUT:
- ``prec`` (default: ``None``) -- precision in bits (default
precision if ``None``).
- ``algorithm`` (string, default 'sage') -- choice of
implementation (for real embeddings only) between 'sage'
(native Sage implementation) or 'pari' (use the PARI
library: only available for real embeddings).
OUTPUT:
(tuple of Complex) `(\omega_1,\omega_2)` where the lattice has
the form `\ZZ\omega_1 + \ZZ\omega_2`. The basis is normalised
so that `\omega_1/\omega_2` is in the fundamental region of
the upper half-plane. For an alternative normalisation for
real lattices (with the first period real), use the function
basis() instead.
EXAMPLES::
sage: E = EllipticCurve('37a')
sage: E.period_lattice().normalised_basis()
(2.99345864623196, -2.45138938198679*I)
::
sage: K.<a> = NumberField(x^3-2)
sage: emb = K.embeddings(RealField())[0]
sage: E = EllipticCurve([0,1,0,a,a])
sage: L = E.period_lattice(emb)
sage: L.normalised_basis(64)
(1.90726488608927255 - 1.34047785962440202*I, -1.90726488608927255 - 1.34047785962440202*I)
sage: emb = K.embeddings(ComplexField())[0]
sage: L = E.period_lattice(emb)
sage: w1,w2 = L.normalised_basis(); w1,w2
(-1.37588604166076 - 2.58560946624443*I, -2.10339907847356 + 0.428378776460622*I)
sage: L.is_real()
False
sage: tau = w1/w2; tau
0.387694505032876 + 1.30821088214407*I
"""
w1, w2 = periods = self.basis(prec=prec, algorithm=algorithm)
periods, mat = normalise_periods(w1,w2)
return periods
@cached_method
def tau(self, prec=None, algorithm='sage'):
r"""
Return the upper half-plane parameter in the fundamental region.
INPUT:
- ``prec`` (default: ``None``) -- precision in bits (default
precision if ``None``).
- ``algorithm`` (string, default 'sage') -- choice of
implementation (for real embeddings only) between 'sage'
(native Sage implementation) or 'pari' (use the PARI
library: only available for real embeddings).
OUTPUT:
(Complex) `\tau = \omega_1/\omega_2` where the lattice has the
form `\ZZ\omega_1 + \ZZ\omega_2`, normalised so that `\tau =
\omega_1/\omega_2` is in the fundamental region of the upper
half-plane.
EXAMPLES::
sage: E = EllipticCurve('37a')
sage: L = E.period_lattice()
sage: L.tau()
1.22112736076463*I
::
sage: K.<a> = NumberField(x^3-2)
sage: emb = K.embeddings(RealField())[0]
sage: E = EllipticCurve([0,1,0,a,a])
sage: L = E.period_lattice(emb)
sage: tau = L.tau(); tau
-0.338718341018919 + 0.940887817679340*I
sage: tau.abs()
1.00000000000000
sage: -0.5 <= tau.real() <= 0.5
True
sage: emb = K.embeddings(ComplexField())[0]
sage: L = E.period_lattice(emb)
sage: tau = L.tau(); tau
0.387694505032876 + 1.30821088214407*I
sage: tau.abs()
1.36444961115933
sage: -0.5 <= tau.real() <= 0.5
True
"""
w1, w2 = self.normalised_basis(prec=prec, algorithm=algorithm)
return w1/w2
@cached_method
def _compute_periods_real(self, prec=None, algorithm='sage'):
r"""
Internal function to compute the periods (real embedding case).
INPUT:
- `prec` (int or ``None`` (default)) -- floating point
precision (in bits); if None, use the default precision.
- `algorithm` (string, default 'sage') -- choice of implementation between
- `pari`: use the PARI library
- `sage`: use a native Sage implementation (with the same underlying algorithm).
OUTPUT:
(tuple of Complex) `(\omega_1,\omega_2)` where the lattice has
the form `\ZZ\omega_1 + \ZZ\omega_2`, `\omega_1` is real and
`\omega_1/\omega_2` has real part either `0` or `frac{1}{2}`.
EXAMPLES::
sage: K.<a> = NumberField(x^3-2)
sage: E = EllipticCurve([0,1,0,a,a])
sage: embs = K.embeddings(CC)
sage: Ls = [E.period_lattice(e) for e in embs]
sage: [L.is_real() for L in Ls]
[False, False, True]
sage: Ls[2]._compute_periods_real(100)
(3.8145297721785450936365098936,
1.9072648860892725468182549468 + 1.3404778596244020196600112394*I)
sage: Ls[2]._compute_periods_real(100, algorithm='pari')
(3.8145297721785450936365098936,
1.9072648860892725468182549468 - 1.3404778596244020196600112394*I)
"""
if prec is None:
prec = RealField().precision()
R = RealField(prec)
C = ComplexField(prec)
if algorithm=='pari':
if self.E.base_field() is QQ:
periods = self.E.pari_curve().omega(prec).sage()
return (R(periods[0]), C(periods[1]))
from sage.libs.pari.all import pari
E_pari = pari([R(self.embedding(ai).real()) for ai in self.E.a_invariants()]).ellinit()
periods = E_pari.omega(prec).sage()
return (R(periods[0]), C(periods[1]))
if algorithm!='sage':
raise ValueError("invalid value of 'algorithm' parameter")
pi = R.pi()
# Up to now everything has been exact in AA or QQbar, but now
# we must go transcendental. Only now is the desired
# precision used!
if self.real_flag == 1: # positive discriminant
a, b, c = (R(x) for x in self._abc)
w1 = R(pi/a.agm(b)) # least real period
w2 = C(0,pi/a.agm(c)) # least pure imaginary period
else:
a = C(self._abc[0])
x, y, r = a.real().abs(), a.imag().abs(), a.abs()
w1 = R(pi/r.agm(x)) # least real period
w2 = R(pi/r.agm(y)) # least pure imaginary period /i
w2 = C(w1,w2)/2
return (w1,w2)
@cached_method
def _compute_periods_complex(self, prec=None, normalise=True):
r"""
Internal function to compute the periods (complex embedding case).
INPUT:
- `prec` (int or ``None`` (default)) -- floating point precision (in bits); if None,
use the default precision.
- `normalise` (bool, default True) -- whether to normalise the
basis after computation.
OUTPUT:
(tuple of Complex) `(\omega_1,\omega_2)` where the lattice has
the form `\ZZ\omega_1 + \ZZ\omega_2`. If `normalise` is
`True`, the basis is normalised so that `(\omega_1/\omega_2)`
is in the fundamental region of the upper half plane.
EXAMPLES::
sage: K.<a> = NumberField(x^3-2)
sage: E = EllipticCurve([0,1,0,a,a])
sage: embs = K.embeddings(CC)
sage: Ls = [E.period_lattice(e) for e in embs]
sage: [L.is_real() for L in Ls]
[False, False, True]
sage: L = Ls[0]
sage: w1,w2 = L._compute_periods_complex(100); w1,w2
(-1.3758860416607626645495991458 - 2.5856094662444337042877901304*I, -2.1033990784735587243397865076 + 0.42837877646062187766760569686*I)
sage: tau = w1/w2; tau
0.38769450503287609349437509561 + 1.3082108821440725664008561928*I
sage: tau.real()
0.38769450503287609349437509561
sage: tau.abs()
1.3644496111593345713923386773
Without normalisation::
sage: w1,w2 = L._compute_periods_complex(normalise=False); w1,w2
(2.10339907847356 - 0.428378776460622*I, 0.727513036812796 - 3.01398824270506*I)
sage: tau = w1/w2; tau
0.293483964608883 + 0.627038168678760*I
sage: tau.real()
0.293483964608883
sage: tau.abs() # > 1
0.692321964451917
"""
if prec is None:
prec = RealField().precision()
C = ComplexField(prec)
# Up to now everything has been exact in AA, but now we
# must go transcendental. Only now is the desired
# precision used!
pi = C.pi()
a, b, c = (C(x) for x in self._abc)
if (a+b).abs() < (a-b).abs(): b=-b
if (a+c).abs() < (a-c).abs(): c=-c
w1 = pi/a.agm(b)
w2 = pi*C.gen()/a.agm(c)
if (w1/w2).imag()<0: w2=-w2
if normalise:
w1w2, mat = normalise_periods(w1,w2)
return w1w2
return (w1,w2)
def is_real(self):
r"""
Return True if this period lattice is real.
EXAMPLES::
sage: f = EllipticCurve('11a')
sage: f.period_lattice().is_real()
True
::
sage: K.<i> = QuadraticField(-1)
sage: E = EllipticCurve(K,[0,0,0,i,2*i])
sage: emb = K.embeddings(ComplexField())[0]
sage: L = E.period_lattice(emb)
sage: L.is_real()
False
::
sage: K.<a> = NumberField(x^3-2)
sage: E = EllipticCurve([0,1,0,a,a])
sage: [E.period_lattice(emb).is_real() for emb in K.embeddings(CC)]
[False, False, True]
ALGORITHM:
The lattice is real if it is associated to a real embedding;
such lattices are stable under conjugation.
"""
return self.real_flag!=0
def is_rectangular(self):
r"""
Return True if this period lattice is rectangular.
.. note::
Only defined for real lattices; a RuntimeError is raised for
non-real lattices.
EXAMPLES::
sage: f = EllipticCurve('11a')
sage: f.period_lattice().basis()
(1.26920930427955, 0.634604652139777 + 1.45881661693850*I)
sage: f.period_lattice().is_rectangular()
False
::
sage: f = EllipticCurve('37b')
sage: f.period_lattice().basis()
(1.08852159290423, 1.76761067023379*I)
sage: f.period_lattice().is_rectangular()
True
ALGORITHM:
The period lattice is rectangular precisely if the
discriminant of the Weierstrass equation is positive, or
equivalently if the number of real components is 2.
"""
if self.is_real():
return self.real_flag == +1
raise RuntimeError("Not defined for non-real lattices.")
def real_period(self, prec = None, algorithm='sage'):
"""
Returns the real period of this period lattice.
INPUT:
- ``prec`` (int or ``None`` (default)) -- real precision in
bits (default real precision if ``None``)
- ``algorithm`` (string, default 'sage') -- choice of
implementation (for real embeddings only) between 'sage'
(native Sage implementation) or 'pari' (use the PARI
library: only available for real embeddings).
.. note::
Only defined for real lattices; a RuntimeError is raised for
non-real lattices.
EXAMPLES::
sage: E = EllipticCurve('37a')
sage: E.period_lattice().real_period()
2.99345864623196
::
sage: K.<a> = NumberField(x^3-2)
sage: emb = K.embeddings(RealField())[0]
sage: E = EllipticCurve([0,1,0,a,a])
sage: L = E.period_lattice(emb)
sage: L.real_period(64)
3.81452977217854509
"""
if self.is_real():
return self.basis(prec,algorithm)[0]
raise RuntimeError("Not defined for non-real lattices.")
def omega(self, prec = None):
r"""
Returns the real or complex volume of this period lattice.
INPUT:
- ``prec`` (int or ``None``(default)) -- real precision in
bits (default real precision if ``None``)
OUTPUT:
(real) For real lattices, this is the real period times the
number of connected components. For non-real lattices it is
the complex area.
.. note::
If the curve is defined over `\QQ` and is given by a
*minimal* Weierstrass equation, then this is the correct
period in the BSD conjecture, i.e., it is the least real
period * 2 when the period lattice is rectangular. More
generally the product of this quantity over all embeddings
appears in the generalised BSD formula.
EXAMPLES::
sage: E = EllipticCurve('37a')
sage: E.period_lattice().omega()
5.98691729246392
This is not a minimal model::
sage: E = EllipticCurve([0,-432*6^2])
sage: E.period_lattice().omega()
0.486109385710056
If you were to plug the above omega into the BSD conjecture, you
would get nonsense. The following works though::
sage: F = E.minimal_model()
sage: F.period_lattice().omega()
0.972218771420113
::
sage: K.<a> = NumberField(x^3-2)
sage: emb = K.embeddings(RealField())[0]
sage: E = EllipticCurve([0,1,0,a,a])
sage: L = E.period_lattice(emb)
sage: L.omega(64)
3.81452977217854509
A complex example (taken from J.E.Cremona and E.Whitley,
*Periods of cusp forms and elliptic curves over imaginary
quadratic fields*, Mathematics of Computation 62 No. 205
(1994), 407-429)::
sage: K.<i> = QuadraticField(-1)
sage: E = EllipticCurve([0,1-i,i,-i,0])
sage: L = E.period_lattice(K.embeddings(CC)[0])
sage: L.omega()
8.80694160502647
"""
if self.is_real():
n_components = (self.real_flag+3)//2
return self.real_period(prec) * n_components
else:
return self.complex_area()
@cached_method
def basis_matrix(self, prec=None, normalised=False):
r"""
Return the basis matrix of this period lattice.
INPUT:
- ``prec`` (int or ``None``(default)) -- real precision in
bits (default real precision if ``None``).
- ``normalised`` (bool, default None) -- if True and the
embedding is real, use the normalised basis (see
``normalised_basis()``) instead of the default.
OUTPUT:
A 2x2 real matrix whose rows are the lattice basis vectors,
after identifying `\CC` with `\RR^2`.
EXAMPLES::
sage: E = EllipticCurve('37a')
sage: E.period_lattice().basis_matrix()
[ 2.99345864623196 0.000000000000000]
[0.000000000000000 2.45138938198679]
::
sage: K.<a> = NumberField(x^3-2)
sage: emb = K.embeddings(RealField())[0]
sage: E = EllipticCurve([0,1,0,a,a])
sage: L = E.period_lattice(emb)
sage: L.basis_matrix(64)
[ 3.81452977217854509 0.000000000000000000]
[ 1.90726488608927255 1.34047785962440202]
See :trac:`4388`::
sage: L = EllipticCurve('11a1').period_lattice()
sage: L.basis_matrix()
[ 1.26920930427955 0.000000000000000]
[0.634604652139777 1.45881661693850]
sage: L.basis_matrix(normalised=True)
[0.634604652139777 -1.45881661693850]
[-1.26920930427955 0.000000000000000]
::
sage: L = EllipticCurve('389a1').period_lattice()
sage: L.basis_matrix()
[ 2.49021256085505 0.000000000000000]
[0.000000000000000 1.97173770155165]
sage: L.basis_matrix(normalised=True)
[ 2.49021256085505 0.000000000000000]
[0.000000000000000 -1.97173770155165]
"""
from sage.matrix.all import Matrix
if normalised:
return Matrix([list(w) for w in self.normalised_basis(prec)])
w1,w2 = self.basis(prec)
if self.is_real():
return Matrix([[w1,0],list(w2)])
else:
return Matrix([list(w) for w in (w1,w2)])
def complex_area(self, prec=None):
"""
Return the area of a fundamental domain for the period lattice
of the elliptic curve.
INPUT:
- ``prec`` (int or ``None``(default)) -- real precision in
bits (default real precision if ``None``).
EXAMPLES::
sage: E = EllipticCurve('37a')
sage: E.period_lattice().complex_area()
7.33813274078958
::
sage: K.<a> = NumberField(x^3-2)
sage: embs = K.embeddings(ComplexField())
sage: E = EllipticCurve([0,1,0,a,a])
sage: [E.period_lattice(emb).is_real() for emb in K.embeddings(CC)]
[False, False, True]
sage: [E.period_lattice(emb).complex_area() for emb in embs]
[6.02796894766694, 6.02796894766694, 5.11329270448345]
"""
w1,w2 = self.basis(prec)
return (w1*w2.conjugate()).imag().abs()
def sigma(self, z, prec = None, flag=0):
r"""
Returns the value of the Weierstrass sigma function for this elliptic curve period lattice.
INPUT:
- ``z`` -- a complex number
- ``prec`` (default: ``None``) -- real precision in bits
(default real precision if None).
- ``flag`` --
0: (default) ???;
1: computes an arbitrary determination of log(sigma(z))
2, 3: same using the product expansion instead of theta series. ???
.. note::
The reason for the ???'s above, is that the PARI
documentation for ellsigma is very vague. Also this is
only implemented for curves defined over `\QQ`.
TODO:
This function does not use any of the PeriodLattice functions
and so should be moved to ell_rational_field.
EXAMPLES::
sage: EllipticCurve('389a1').period_lattice().sigma(CC(2,1))
2.60912163570108 - 0.200865080824587*I
"""
if prec is None:
prec = RealField().precision()