Sage Days 26
Introduction to Sage via Number Theory
Basic Algebraic Number Theory
Defining Number Fields
Elements of Number Fields
{{{id=48| K = NumberField(x^4 - 2*x^2 - 1, 'alpha'); K /// Number Field in alpha with defining polynomial x^4 - 2*x^2 - 1 }}} {{{id=25| alpha = K.0 s = (1+1/alpha)^10; s /// -120*alpha^3 + 164*alpha^2 + 336*alpha - 324 }}} {{{id=29| s.norm() /// 1024 }}} {{{id=28| s.trace() /// -640 }}} {{{id=27| s.minpoly() /// x^4 + 640*x^3 + 102464*x^2 - 30963712*x + 1024 }}} {{{id=26| alpha.minpoly() /// x^4 - 2*x^2 - 1 }}} {{{id=60| phi = K.embeddings(K); phi /// [ Ring endomorphism of Number Field in alpha with defining polynomial x^4 - 2*x^2 - 1 Defn: alpha |--> alpha, Ring endomorphism of Number Field in alpha with defining polynomial x^4 - 2*x^2 - 1 Defn: alpha |--> -alpha ] }}} {{{id=62| phi[0](s) /// -120*alpha^3 + 164*alpha^2 + 336*alpha - 324 }}} {{{id=63| phi[1](s) /// 120*alpha^3 + 164*alpha^2 - 336*alpha - 324 }}} {{{id=65| L = K.galois_closure('beta'); L /// Number Field in beta with defining polynomial x^8 - 20*x^6 + 146*x^4 - 460*x^2 + 1681 }}} {{{id=64| Phi = L.embeddings(L); Phi /// [ Ring endomorphism of Number Field in beta with defining polynomial x^8 - 20*x^6 + 146*x^4 - 460*x^2 + 1681 Defn: beta |--> beta, Ring endomorphism of Number Field in beta with defining polynomial x^8 - 20*x^6 + 146*x^4 - 460*x^2 + 1681 Defn: beta |--> -beta, Ring endomorphism of Number Field in beta with defining polynomial x^8 - 20*x^6 + 146*x^4 - 460*x^2 + 1681 Defn: beta |--> -35/33456*beta^7 - 325/33456*beta^5 + 10265/33456*beta^3 - 15639/11152*beta, Ring endomorphism of Number Field in beta with defining polynomial x^8 - 20*x^6 + 146*x^4 - 460*x^2 + 1681 Defn: beta |--> -7/8364*beta^7 - 65/8364*beta^5 + 2053/8364*beta^3 - 1455/2788*beta, Ring endomorphism of Number Field in beta with defining polynomial x^8 - 20*x^6 + 146*x^4 - 460*x^2 + 1681 Defn: beta |--> -7/11152*beta^7 - 65/11152*beta^5 + 2053/11152*beta^3 - 18305/11152*beta, Ring endomorphism of Number Field in beta with defining polynomial x^8 - 20*x^6 + 146*x^4 - 460*x^2 + 1681 Defn: beta |--> 7/11152*beta^7 + 65/11152*beta^5 - 2053/11152*beta^3 + 18305/11152*beta, Ring endomorphism of Number Field in beta with defining polynomial x^8 - 20*x^6 + 146*x^4 - 460*x^2 + 1681 Defn: beta |--> 7/8364*beta^7 + 65/8364*beta^5 - 2053/8364*beta^3 + 1455/2788*beta, Ring endomorphism of Number Field in beta with defining polynomial x^8 - 20*x^6 + 146*x^4 - 460*x^2 + 1681 Defn: beta |--> 35/33456*beta^7 + 325/33456*beta^5 - 10265/33456*beta^3 + 15639/11152*beta ] }}} {{{id=68| Phi[0](s) /// Traceback (most recent call last): File "Nice formating and Latex:
{{{id=74| show(t) ///Fractional Ideals and Residue fields
{{{id=75| K.class_group() /// Class group of order 1 with structure of Number Field in alpha with defining polynomial x^4 - 2*x^2 - 1 }}} {{{id=76| F. = QuadraticField(-23); F /// Number Field in a with defining polynomial x^2 + 23 }}} {{{id=77| F.class_group() /// Class group of order 3 with structure C3 of Number Field in a with defining polynomial x^2 + 23 }}} {{{id=80| OF = F.ring_of_integers(); OF /// Maximal Order in Number Field in a with defining polynomial x^2 + 23 }}} {{{id=88| OF.basis() /// [1/2*a + 1/2, a] }}} {{{id=81| OF.discriminant() /// -23 }}} {{{id=32| P = F.prime_above(23); P /// Fractional ideal (-a) }}} {{{id=31| I = F.ideal(2); I.factor() /// (Fractional ideal (2, 1/2*a - 1/2)) * (Fractional ideal (2, 1/2*a + 1/2)) }}} {{{id=42| P2 = I.factor()[0][0] /// }}} {{{id=82| I*P /// Fractional ideal (-2*a) }}} {{{id=83| I/P /// Fractional ideal (-2/23*a) }}} {{{id=84| P.is_principal() /// True }}} {{{id=85| P2.is_principal() /// False }}} {{{id=39| k = P.residue_field() /// }}} {{{id=38| k.order() /// 23 }}} {{{id=41| k(2+a) /// 2 }}} {{{id=45| /// }}} {{{id=86| /// }}}Elliptic Curves:
Over $\mathbb{Q}$
{{{id=89| E = EllipticCurve([1,2,3,4,5]); E /// Elliptic Curve defined by y^2 + x*y + 3*y = x^3 + 2*x^2 + 4*x + 5 over Rational Field }}} {{{id=90| E.minimal_model() /// Elliptic Curve defined by y^2 + x*y = x^3 - x^2 + 4*x + 3 over Rational Field }}} {{{id=1| E1 = EllipticCurve([3,7]); E1 /// Elliptic Curve defined by y^2 = x^3 + 3*x + 7 over Rational Field }}} {{{id=5| E2 = EllipticCurve('389a'); E2 /// Elliptic Curve defined by y^2 + y = x^3 + x^2 - 2*x over Rational Field }}} {{{id=7| E3 = EllipticCurve([0,1,1,-2,0]); E3 /// Elliptic Curve defined by y^2 + y = x^3 + x^2 - 2*x over Rational Field }}} {{{id=10| E.ap(97) /// -12 }}} {{{id=11| E.rank() /// 1 }}}Invariants
{{{id=12| E.conductor() /// 10351 }}} {{{id=14| E.discriminant().factor() /// -1 * 11 * 941 }}} {{{id=92| E.tamagawa_numbers() /// [1, 1] }}} {{{id=93| for p in prime_range(20): print E.ap(p) /// 1 0 -3 -1 -1 1 5 4 }}} {{{id=94| E.aplist(20) /// [1, 0, -3, -1, -1, 1, 5, 4] }}}Rank
{{{id=95| E.rank() /// 1 }}} {{{id=97| E.analytic_rank() /// 1 }}} {{{id=98| E.gens() /// [(1 : 2 : 1)] }}} {{{id=99| F = EllipticCurve('5077a'); F /// Elliptic Curve defined by y^2 + y = x^3 - 7*x + 6 over Rational Field }}} {{{id=100| F.rank() /// 3 }}} {{{id=101| F.analytic_rank() /// 3 }}} {{{id=102| F.gens() /// [(-2 : 3 : 1), (-7/4 : 25/8 : 1), (1 : -1 : 1)] }}} {{{id=103| F.regulator() /// 0.417143558758384 }}} {{{id=104| F.simon_two_descent() /// (3, 3, [(1 : 0 : 1), (0 : 2 : 1), (2 : -1 : 1)]) }}} {{{id=105| print F.mwrank() /// Curve [0,0,1,-7,6] : Basic pair: I=336, J=-10800 disc=35092224 2-adic index bound = 2 By Lemma 5.1(a), 2-adic index = 1 2-adic index = 1 One (I,J) pair Looking for quartics with I = 336, J = -10800 Looking for Type 2 quartics: Trying positive a from 1 up to 5 (square a first...) (1,0,-24,52,-20) --nontrivial...(x:y:z) = (1 : 1 : 0) Point = [4:6:1] height = 1.46677848399307 Rank of B=im(eps) increases to 1 (1,0,-12,4,16) --nontrivial...(x:y:z) = (1 : 1 : 0) Point = [2:0:1] height = 0.767043355331546 Rank of B=im(eps) increases to 2 Trying positive a from 1 up to 5 (...then non-square a) Trying negative a from -1 down to -1 Finished looking for Type 2 quartics. Looking for Type 1 quartics: Trying positive a from 1 up to 6 (square a first...) (1,0,6,28,25) --nontrivial...(x:y:z) = (1 : 1 : 0) Point = [-1:3:1] height = 1.20508110418585 Rank of B=im(eps) increases to 3 (The previous point is on the egg) Exiting search for Type 1 quartics after finding one which is globally soluble. Mordell rank contribution from B=im(eps) = 3 Selmer rank contribution from B=im(eps) = 3 Sha rank contribution from B=im(eps) = 0 Mordell rank contribution from A=ker(eps) = 0 Selmer rank contribution from A=ker(eps) = 0 Sha rank contribution from A=ker(eps) = 0 Used full 2-descent via multiplication-by-2 map Rank = 3 Rank of S^2(E) = 3 Searching for points (bound = 8)...done: found points of rank 3 and regulator 0.417143558758385 Processing points found during 2-descent...done: now regulator = 0.417143558758385 Saturating (bound = 100)...done: points were already saturated. Transferring points from minimal curve [0,0,1,-7,6] back to original curve [0,0,1,-7,6] Generator 1 is [1:-1:1]; height 0.668205165651928 Generator 2 is [-2:3:1]; height 1.36857250535393 Generator 3 is [-14:25:8]; height 2.71735939281229 Regulator = 0.417143558758385 The rank and full Mordell-Weil basis have been determined unconditionally. (0.264629 seconds) }}}Plotting Elliptic Curves
{{{id=106| plot(E, plot_points=300, thickness=2, color=hue(.75), xmax=2) ///Elliptic Curves over Finite Fields
{{{id=108| k. = GF(7^6); k /// Finite Field in a of size 7^6 }}} {{{id=110| E = EllipticCurve(k, [a,a^2]) E.cardinality() /// 117837 }}} {{{id=111| time E.abelian_group() /// Additive abelian group isomorphic to Z/117837 embedded in Abelian group of points on Elliptic Curve defined by y^2 = x^3 + a*x + a^2 over Finite Field in a of size 7^6 Time: CPU 0.12 s, Wall: 0.12 s }}} {{{id=116| E = EllipticCurve([1..5]) time ap = E.aplist(10^6) /// Time: CPU 3.80 s, Wall: 3.82 s }}} {{{id=113| @interact def f(p=(389,primes(3,1000))): show(EllipticCurve(GF(p), [1..5]).plot(), frame=True) /// }}}Elliptic Curves over Number Fields
{{{id=114| K.Over a number field we do not have quite as much functionality.
For example, L-series and $a_p$ are not yet implemented.
{{{id=130| /// }}}