-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathg3tests.m
82 lines (72 loc) · 2.68 KB
/
g3tests.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/***
* Examples of use of the g2twists package
*
* Distributed under the terms of the GNU Lesser General Public License (L-GPL)
* http://www.gnu.org/licenses/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Copyright 2007-2020 R. Lercier & C. Ritzenthaler
*/
// SetVerbose("Hyperelliptic", 2);
/* Over the rationals
*********************/
CheckRationalCurves := procedure(Deg, CoeffBound)
errors := false;
Px<x> := PolynomialRing(RationalField()); x := Px.1;
for e := 0 to (2*CoeffBound)^Deg-1 do
Coeffs := Intseq(e, 2*CoeffBound);
Coeffs := [0 : c in [1..(Deg-#Coeffs)]] cat Coeffs;
Pol :=x^Deg+Px![c-CoeffBound+1 : c in Coeffs];
ret, H := IsHyperellipticCurve([Pol, 0]);
if ret then
// ""; "*** Pol :", Pol;
SI := ShiodaInvariants(H);
_H := HyperellipticCurveFromShiodaInvariants(SI);
if not ShiodaInvariantsEqual(ShiodaInvariants(_H), SI) then
"\nARGHH, unconsistent Shioda invariants at H =", H;
errors := true;
end if;
end if;
end for;
if not errors then
"\nEverything's ok in the Rational Field for Deg =", Deg, "and coeff. bound =", CoeffBound;
end if;
end procedure;
/* Exhaustive test of degree 5 polynomials */
CheckRationalCurves(7, 1);
/* Exhaustive test of degree 6 polynomials */
CheckRationalCurves(8, 1);
/* 100 random curves of medium size */
allok := true;
Px<x> := PolynomialRing(RationalField()); x := Px.1;
for k := 1 to 100 do
Pol :=x^8+Px![Random(-10^100,10^100) : i in [1..7]];
ret, H := IsHyperellipticCurve([Pol, 0]);
if ret then
"H :", H;
SI := ShiodaInvariants(H);
_H := HyperellipticCurveFromShiodaInvariants(SI);
if not ShiodaInvariantsEqual(ShiodaInvariants(_H), SI) then
"\nARGHH, unconsistent invariants at H =", H;
allok := false;
break k;
end if;
"_H :", _H; "";
end if;
end for;
if allok then
"\nEverything's ok for 100 random rational curves of medium size";
end if;