# Compute $j$-invariant of elliptic curve in non-Weierstrass form with arbitrary coefficients

One can compute the $j$-invariant of an elliptic curve not in Weierstrass form in Sage via the following (where the curve $x+x^2+y-x^2y-xy^2+x^2y^2=0$ -- not in Weierstrass form -- is used as an example):

x,y = polygen(QQ,'x,y')
E = Jacobian(x+x^2+y-x^2*y-x*y^2+x^2*y^2)
E.j_invariant()


If we include numerical coefficients of the various terms, this still works. However, I would like Sage to compute the j-invariant of such curves in non-Weierstrass form with arbitrary coefficients, e.g. $ax+bx^2+cy-dx^2y-exy^2+fx^2y^2$. Is this possible? I tried including the line:

var('a,b,c,d,e,f')


But got an error. Can anyone help? Thanks!

edit retag close merge delete

Sort by » oldest newest most voted

Insead of symbols, you should use indeterminates in a suitable fraction field:

sage: R.<a,b,c,d,e,f> = QQ[]
sage: S = R.fraction_field()
sage: x,y = polygen(S,'x,y')
sage: P = a*x+b*x^2+c*y-d*x^2*y-e*x*y^2+f*x^2*y^2
sage: P.parent()
Multivariate Polynomial Ring in x, y over Fraction Field of Multivariate Polynomial Ring in a, b, c, d, e, f over Rational Field
sage: E = Jacobian(P)
sage: E.j_invariant()
(4096*c^6*d^6 - 12288*a*c^5*d^5*e + 24576*a^2*c^4*d^4*e^2 - 28672*a^3*c^3*d^3*e^3 + 24576*a^4*c^2*d^2*e^4 - 12288*a^5*c*d*e^5 + 4096*a^6*e^6 - 36864*b*c^6*d^4*f + 73728*a*b*c^5*d^3*e*f - 110592*a^2*b*c^4*d^2*e^2*f + 73728*a^3*b*c^3*d*e^3*f - 36864*a^4*b*c^2*e^4*f + 110592*b^2*c^6*d^2*f^2 - 110592*a*b^2*c^5*d*e*f^2 + 110592*a^2*b^2*c^4*e^2*f^2 - 110592*b^3*c^6*f^3)/(-16*b^2*c^5*d^3*e^2 + 16*a^2*c^4*d^4*e^2 + 24*a*b^2*c^4*d^2*e^3 - 32*a^3*c^3*d^3*e^3 - 27*b^4*c^4*e^4 + 24*a^2*b^2*c^3*d*e^4 + 16*a^4*c^2*d^2*e^4 - 16*a^3*b^2*c^2*e^5 + 72*b^3*c^5*d*e^2*f - 80*a^2*b*c^4*d^2*e^2*f - 36*a*b^3*c^4*e^3*f + 80*a^3*b*c^3*d*e^3*f - 32*a^4*b*c^2*e^4*f + 16*b^2*c^6*d^2*f^2 - 16*a^2*c^5*d^3*f^2 - 16*a*b^2*c^5*d*e*f^2 + 24*a^3*c^4*d^2*e*f^2 - 2*a^2*b^2*c^4*e^2*f^2 + 24*a^4*c^3*d*e^2*f^2 - 16*a^5*c^2*e^3*f^2 - 64*b^3*c^6*f^3 + 72*a^2*b*c^5*d*f^3 - 36*a^3*b*c^4*e*f^3 - 27*a^4*c^4*f^4)

more