# This is a file to be read (or pasted) into Maple.
# Any lines (like this one) beginning with # are comment lines.
# This Maple file checks the birational transformations in
# the article:
# "Large 2-torsion in Tate-Shafarevich groups of
# quadratic twists of an abelian variety"
# In particular, the birational transformations in that article:
# Part 1 of this file: between equation (1) and equation (6),
# Part 2 of this file: between equation (2) and equation (7),
# Part 3 of this file: between equation (29) and
# (equation (1) with each a_i = alpha_i^2).
################################################################
# The following command gives a nicer form for outputs.
interface(prettyprint,prettyprint=false);
################################################################
# Part 1. Birational transformation between eqn (1) and eqn (6).
# Recall from the article:
# (1) y^2 = (x - v)(vx - 1)(x^2 - a_1).....(x^2 - a_g)
# Let P := (v^2-1)(v^2 - a_1).....(v^2 - a_g).
# We claim that by replacing x by (vx + P)/x
# and y by Py/x^{g+1} gives:
# (6) y^2 = ( x + (vP)/(v^2-1) ) f_1(x) .... f_g(x),
# where f_i(x) := x^2 + (2vPx)/(v^2-a_i) + (P^2)/(v^2-a_i).
# The following checks this for any genus which is
# inputted by the user.
check1to6 := proc(g) local poly1, P, poly6, poly1var;
# The following is the poly on RHS of the curve from eqn (1):
poly1 := (x-v)*(v*x-1)*product(x^2 - a[i], i=1..g);
P := (v^2-1)*product(v^2 - a[i], i=1..g);
# The following is the poly on RHS of the curve from eqn (6):
poly6 :=
(x+(v*P)/(v^2-1))
*product(x^2+(2*v*P*x)/(v^2-a[i])+P^2/(v^2-a[i]),i=1..g);
# Replacing x by (vx + P)/x and y by Py/x^{g+1} in (1) has the
# same effect as replacing x by (vx + P)/x in poly1 and then
# multiplying the result by x^{2g+2}/P^2.
poly1var := subs(x = (v*x + P)/x, poly1)*x^(2*g+2)/P^2;
# The following should be 0, if the claim is correct:
simplify( poly1var - poly6 );
end;
# You may now check for any given g, by reading this file
# into Maple and then yourself typing, for example,
# the following (which checks g=4):
check1to6(4);
# which should always return 0. It's quite quick for g=1,2,3,4,5
# and then becomes slow from g=6 onwards (I don't recommend
# using it for g > 5).
################################################################
# Part 2. Birational transformation between eqn (2) and eqn (7).
# Recall from the article:
# A := 2(v^2+1)(v^2 - a_1)(v^2 - a_2).....(v^2 - a_g).
# b_i := (a_i v^2 - 1)/(a_i - v^2), for each i.
# (2) y^2 = A (x - v)(vx - (-1)^g)(x^2 - b_1).....(x^2 - b_g).
# We claim that replacing x by ( vx + 2(v^4 - 1) )/x and y by
# 2(v^2+1)^{floor((g+3)/2)} (v^2-1)^{floor((g+2)/2)} y/x^{g+1},
# gives:
# (7) y^2 = ( x + 2v( v^2 + (-1)^g ) ) fhat_1(x).....fhat_g(x),
# where:
# fhat_i(x) := x^2 + 4v(v^2 - a_i)x + 4(v^4 - 1)(v^2 - a_i).
check2to7 := proc(g) local poly2, A, poly7, poly2var;
A := 2*(v^2+1)*product(v^2 - a[i], i=1..g);
# The following is the poly on RHS of the curve from eqn (2):
poly2 := A*(x-v)*(v*x-(-1)^g)
*product(x^2-(a[i]*v^2-1)/(a[i]-v^2),i=1..g);
# The following is the poly on RHS of the curve from eqn (7):
poly7 := (x + 2*v*(v^2+(-1)^g))
*product(x^2 + 4*v*(v^2 - a[i])*x + 4*(v^4 - 1)*(v^2 - a[i]),
i=1..g);
# Replacing x by ( vx + 2(v^4 - 1) )/x and y by
# 2(v^2+1)^{floor((g+3)/2)} (v^2-1)^{floor((g+2)/2)} y/x^{g+1}
# in (2) has the same effect as replacing x by
# ( vx + 2(v^4 - 1) )/x in poly2 and then multiplying
# the result by:
# x^(2*g+2)
# /(4*(v^2+1)^(2*floor((g+3)/2))*(v^2-1)^(2*floor((g+2)/2))).
poly2var := subs(x=(v*x+2*(v^4-1))/x,poly2)*x^(2*g+2)
/(4*(v^2+1)^(2*floor((g+3)/2))*(v^2-1)^(2*floor((g+2)/2)));
# The following should be 0, if the claim is correct:
simplify( poly2var - poly7 );
end;
# You may now check for any given g, by reading the above into
# Maple and then yourself typing, for example, the following
# (which checks g=5):
check2to7(5);
# which should always return 0. It's quite quick for
# g=1,2,3,4,5,6,7,8,9,10 and then becomes slow from g=11 onwards
# (I don't recommend using it for g > 10).
################################################################
# Part 3. Birational transformation
# between equation (29) and
# (equation (1) with each a_i = alpha_i^2).
# Recall from the article:
# (29) y^2 = (x - v^2/(1-v^2))
# ((x+1)^2 - x^2(alpha_1/v)^2)....((x+1)^2 - x^2(alpha_g/v)^2)
# We claim that replacing x by v/(x-v) and
# y by sqrt(v/(v^2-1))*y/(x-v)^{g+1}
# gives equation (1) with each a_i = alpha_i^2, which we'll
# label here as equation (1alpha), namely:
# (1alpha) y^2 =
# (x - v)(vx - 1)(x^2 - alpha_1^2)....(x^2 - alpha_g^2)
check29to1alpha := proc(g) local poly29, poly1alpha, poly29var;
# The following is the poly on RHS of the curve from eqn (29):
poly29 := (x - v^2/(1-v^2))
*product((x+1)^2 - x^2*(alpha[i]/v)^2,i=1..g);
# The following is poly on RHS of the curve from eqn (1alpha):
poly1alpha := (x - v)*(v*x - 1)
*product(x^2 - alpha[i]^2,i=1..g);
# Replacing x by by v/(x-v) and
# y by sqrt(v/(v^2-1))*y/(x-v)^{g+1} in (29) has the same
# effect as replacing x by v/(x-v) in poly29 and then
# multiplying the result by: (x-v)^{2g+2}/(v/(v^2-1)).
poly29var := subs(x=v/(x-v), poly29)*(x-v)^(2*g+2)/(v/(v^2-1));
# The following should be 0, if the claim is correct:
simplify( poly29var - poly1alpha );
end;
# You may now check for any given g, by reading the above
# into Maple and then yourself typing, for example, the following
# (which checks g=5):
check29to1alpha(5);
# which should always return 0. It's quite quick for g=1,..,5000.
################################################################