# This Maple file gives the power series of Section 2
# of the article "Finding Rational Points on Bielliptic Genus 2 Curves"
# by E.V. Flynn and J.L. Wetherell.
interface(prettyprint,prettyprint=false);
# The follwing is an elliptic curve, where we assume the
# discriminant to be nonzero, and the identity is the point at infinity.
curve1 := y^2 = g3*x^3 + g2*x^2 + g1*x + g0;
# Change variable to: z=-x/y, w=-1/y. Reverse: x=z/w, y=-1/w.
# (so that identity becomes (z,w) = (0,0))
curve2 := expand( subs(x=z/w, y=-1/w, curve1)*w^3 );
# On recursively applying curve2, we can write w as a power series
# in z, for which the following gives the terms up to z^9.
w(z) := g3*z^3
+ g2*g3*z^5
+ (g1*g3^2+g3*g2^2)*z^7
+ (g0*g3^3+g2^3*g3+3*g1*g3^2*g2)*z^9;
# The following gives 1/x as a power series in z (just w(z)/z) up to z^8.
g3*z^2
+ g2*g3*z^4
+ (g1*g3^2+g3*g2^2)*z^6
+ (g0*g3^3+g2^3*g3+3*g1*g3^2*g2)*z^8;
# If (x0,y0) is not in the kernel of reduction, and
# (x0,y0) + (z/w,-1/w) = (x3,y3), then x3
# is given by the following power series in z, up to z^4.
x0
+ 2*y0*z
+ (3*x0^2*g3+2*x0*g2+g1)*z^2
+ (4*x0*g3*y0+2*g2*y0)*z^3
+ (4*x0^3*g3^2+6*x0^2*g3*g2+2*x0*g3*g1+2*x0*g2^2+g3*g0+g3*y0^2+g2*g1)*z^4;
# The following gives the log map up to z^9.
log(z) := z
+ 1/3*g2*z^3
+ (1/5*g2^2+2/5*g1*g3)*z^5
+ (1/7*g2^3+3/7*g0*g3^2+6/7*g2*g1*g3)*z^7
+ (1/9*g2^4+2/3*g3^2*g1^2+4/3*g3*g2^2*g1+4/3*g3^2*g2*g0)*z^9;
# The following gives the exp map up to z^9.
exp(z) := z
- 1/3*g2*z^3
+ (-2/5*g1*g3+2/15*g2^2)*z^5
+ (-17/315*g2^3+22/105*g2*g1*g3-3/7*g0*g3^2)*z^7
+ (62/2835*g2^4-38/315*g3*g2^2*g1+2/21*g3^2*g2*g0+2/15*g3^2*g1^2)*z^9;