Let us consider the following code:
var( 'u,v,a,b,c,q,x,y' );
f = a*u^4 + b*u^3 + c*u^2 + d*u + q^2
# we want to find an algebraic passage from u, v and the quartic
# v^2 = f
# to a Weierstass equation in two new variables x, y
Q = 2*q
x = ( Q*(v+q) + d*u ) / u^2
y = ( Q^3*(v+q) + Q^2*( d*u + c*u^2 ) - d^2*u^2 ) / Q / u^3
# inverse transformation:
# u = ( Q*(x+c) - d^2/q ) / y
# v = -q + u*(u*x-d)/Q
# one can easily define rational functions (u,v) -> (x,y) and (x,y) -> (u,v)
# to be used in the concrete situation
a1 = d/q
a2 = c - (d/Q)^2
a3 = b*Q
a4 = -a*Q^2
a6 = a2*a4
( ( y^2 + a1*x*y + a3*y ) - ( x^3 + a2*x^2 + a4*x + a6 ) ) . factor()
The required factorization above delivers:
4*(a*u^4 + b*u^3 + c*u^2 + q^2 - v^2)*(c*u^2 + 2*q^2 + 2*q*v)*q^2/u^6
and this means, that starting from
0 == (a*u^4 + b*u^3 + c*u^2 + q^2 - v^2)
we get
0 == ( ( y^2 + a1*x*y + a3*y ) - ( x^3 + a2*x^2 + a4*x + a6 ) )
So the function doing the passage is defined "manually" as:
def passageQuarticToWeierstrass( a, b, c, d, q, field=QQ ):
"""we simply implement the standard formulas
"""
Q = 2*q
a1, a2, a3, a4 = d/q, c - (d/Q)^2, b*Q, -a*Q^2
a6 = a2 * a4
# print ( a1, a2, a3, a4, a6 )
return EllipticCurve( field, ( a1, a2, a3, a4, a6 ) )
In our case, we may build the following dialog:
# a*u^4 + b*u^3 + c*u^2 + d*u + q^2 is u^4 - 2*u^3 + 5*u^2 + 8*u + 4
a, b, c, d, q = 1, -2, 5, 8, 2
E = passageQuarticToWeierstrass( a, b, c, d, q )
# print E.ainvs()
And we can use the curve for further investigation, for instance:
sage: E = passageQuarticToWeierstrass( a, b, c, d, q )
sage: E
Elliptic Curve defined by y^2 + 4*x*y - 8*y = x^3 + x^2 - 16*x - 16 over Rational Field
sage: E.ainvs()
(4, 1, -8, -16, -16)
sage: E.gens()
[(-4 : 0 : 1)]
sage: E.torsion_points()
[(0 : 1 : 0), (0 : 4 : 1)]
sage: E.minimal_model()
Elliptic Curve defined by y^2 + x*y = x^3 + x^2 - 2*x over Rational Field