Sharedgröbner basis calculations / Discriminant of an Elliptic Curve.sagewsOpen in CoCalc
Relation between an Elliptic Curve defined by f=0 and the ideal I=(f,fx,fy)
#Let E be the elliptic curve defined by f = y^2 + a1*x*y + a3*y - x^3 - a2*x^2 - a4*x - a6 over ZZ[a1,a2,a3,a4,a6].
#We want to show, that the intersection of I=(f,fx,fy) with ZZ[a1,a2,a3,a4,a6] is generated by the discriminant of E,  Delta in ZZ[a1,a2,a3,a4,a6].
from sage.rings.polynomial.toy_d_basis import d_basis
R.<x,y,a1,a2,a3,a4,a6> = PolynomialRing(ZZ, 7, order = 'deglex(2),deglex(5)')
f = y^2 + a1*x*y + a3*y - x^3 - a2*x^2 - a4*x - a6
fx = f.derivative(x)
fy = f.derivative(y)
I = R.ideal(f,fx,fy)
I_gb = d_basis(I); I_gb
Polynomial Sequence with 46 Polynomials in 7 Variables
#We calculate the intersection of I_gb and ZZ[a1,a2,a3,a4,a6]. This gives a Gröbner basis of I=(f,fx,fy) \cap ZZ[a1,a2,a3,a4,a6]
I_neu = [el for el in I_gb if el.lm() < y]; I_neu
[a1^6*a6 - a1^5*a3*a4 + a1^4*a2*a3^2 + 12*a1^4*a2*a6 - a1^4*a4^2 - 8*a1^3*a2*a3*a4 - a1^3*a3^3 + 8*a1^2*a2^2*a3^2 - 36*a1^3*a3*a6 + 48*a1^2*a2^2*a6 - 8*a1^2*a2*a4^2 + 30*a1^2*a3^2*a4 - 16*a1*a2^2*a3*a4 - 36*a1*a2*a3^3 + 16*a2^3*a3^2 - 72*a1^2*a4*a6 - 144*a1*a2*a3*a6 + 96*a1*a3*a4^2 + 64*a2^3*a6 - 16*a2^2*a4^2 - 72*a2*a3^2*a4 + 27*a3^4 - 288*a2*a4*a6 + 216*a3^2*a6 + 64*a4^3 + 432*a6^2]
#We see that I_neu only contains one element and this elements coincides with (-1)* the discriminant of the elliptic curve defined by f.
E = EllipticCurve([a1,a2,a3,a4,a6])
E.discriminant() == -I_neu[0]
True