magma_utils

parent 50890bae
......@@ -47,7 +47,7 @@ int main() {
cin >> D2;
// The following assertion should be true for a nodal curve
assert(g == C.degree() - E.degree());
assert(g == ((C.degree()-1)*(C.degree()-2))/2 - E.degree());
EffectiveDivisor R = AddReduced(g, O, E, D1, D2);
......
1009
[ 5 [863 161 817 949 344 184] [132 747 1002 226 891] [768 119 991 128] [645 84 865] [351 37] [1] ]
< [1] [] >
{ < [503 216 395 835 891 697 316 553 1] [773 952 513 814 518 605 87 42] > < [510 1] [928] > }
// In this file, we provide some magma functions to test that the output of rrspace is correct.
RRSPACE_PATH="/users/pspaenle/repos/rrspace"
// Given a function f and a finite set B of functions on a curve, check if the k-vector space generated by B
// contains f
// The base curve should be defined over a finite field.
// This is a probabilistic algorithm.
function CheckBelongsSpan(f, B)
assert (Parent(f) eq Universe(B));
FF := Universe(B);
assert Type(FF) eq FldFunFracSch;
K := BaseRing(BaseRing(FF));
assert Type(K) eq FldFin;
C := Curve(FF);
nbtests := 2*#B + 2;
lM := [];
lv := [];
for i in [1..nbtests] do
repeat
P := Random(C);
until P ne Infinity() and
&and[Evaluate(g, P) ne Infinity() : g in B] and
Evaluate(f, P) ne Infinity();
lM cat:= [Evaluate(g, P) : g in B];
lv cat:= [Evaluate(f, P)];
end for;
M := Matrix(K, nbtests, #B, lM);
return IsConsistent(Transpose(M), Matrix(K, 1, nbtests, lv));
end function;
// Given two finite sets of functions on a curve, check if they span the same k-vector space in k(C)
function CheckEqualSpan(B1, B2)
return &and[CheckBelongsSpan(g, B2) : g in B1] and
&and[CheckBelongsSpan(g, B1) : g in B2];
end function;
// Set variable order y > x > z
function Check_rrspace(C, D)
// first compute the input representation for rrspace
K := BaseRing(C);
assert Type(K) eq FldFin;
assert AmbientSpace(C) eq ProjectiveSpace(K, 2);
Dp, Dm := SignDecomposition(D);
Ip := Ideal(Dp);
Im := Ideal(Dm);
R := Universe(Generators(Ip));
Gp := GroebnerBasis(ChangeOrder(Ip+Ideal(R.3-1), "lex"));
Gm := GroebnerBasis(ChangeOrder(Im+Ideal(R.3-1), "lex"));
assert(Degree(Gp[2]) eq Degree(Ip));
assert(Degree(Gm[2]) eq Degree(Im));
Runiv := PolynomialRing(K);
fp := Evaluate( Gp[2], [0, Runiv.1, 0]);
gp := Evaluate(-Gp[1], [0, Runiv.1, 0]);
fm := Evaluate( Gm[2], [0, Runiv.1, 0]);
gm := Evaluate(-Gm[1], [0, Runiv.1, 0]);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment