Returns a generating set of a linear system of type {d,{m_1,...,m_k}} through the points pts in the projective space Pn.
gensLinearSystem = (Pn, type, pts) -> (
de := type_0;
mults := type_1;
if (max mults) == 0 then (
return basis(de,Pn)
)
else(
l := #mults-1;
M := basis(de,Pn);
k := (numgens source M);
N := matrix{toList (k:0)};
for i from 0 to l do(
if mults_i > 0 then(
P := M;
for j from 1 to mults_i do(
N = N || sub(P,matrix{pts_i});
P = jacobian(P);
);
);
);
);
u := numgens target N -1;
N = N^(toList (1..u));
(transpose(generators kernel N))*(transpose M)
)
Input: (Pn, k) or (kk, n, k).
Returns a list of k random points in projective space Pn, or k random (n+1)-tuples of elements in a field kk.
randomPoints = arg -> (
if #arg ==2 then(
Pn:= arg_0;k:= arg_1;
cR = coefficientRing Pn;
pts := {};
n := numgens source vars Pn;
for i from 0 to k-1 do(
p := {};
for j from 0 to n-1 do(
p = p | {random(cR)};
);
pts = pts | {p};
);
return pts;
);
if #arg == 3 then(
kk := arg_0; n:= arg_1; k:= arg_2;
pts := {};
for i from 0 to k-1 do(
p := {};
for j from 0 to n do(
p = p | {random(kk)};
);
pts = pts | {p};
);
return pts;
)
)
Returns a curve of type {k,{m1,...,mk}} in a cubic surface in projective space P3;
the surface depends on the choice of 6 points pts;
requires gensLinearSystem and randomPoints.
Returns the type {k,{m1,...,m6}} of a curve of genus g and degree d on a smooth cubic surface under the assumptions $k \geq m_1 + m_2 + m_3$ and $m_1 \geq m_2 \geq\ldots\geq m_6$.
typeOnCubic = (g,d) -> (
for k from 1 to d do(
for m1 from floor((3*k- d)/6) to (3*k-d) do(
for m2 from floor((3*k- d- m1)/5) to min(3*k- d- m1, m1) do(
for m3 from floor((3*k- d- m1- m2)/4) to min(3*k- d- m1- m2, m2, k- m1- m2) do(
for m4 from floor((3*k- d- m1- m2- m3)/3) to min(3*k- d- m1- m2- m3, m3) do(
for m5 from floor((3*k- d- m1- m2- m3- m4)/2) to min(3*k- d- m1- m2- m3- m4, m4) do(
m6 := (3*k- d)- m1 - m2- m3- m4- m5;
if (m6 >= 0) and (m5 >= m6) then(
sq := k^2- m1^2- m2^2- m3^2- m4^2- m5^2- m6^2;
if (sq == 2*g-2+d) then break return {k, {m1, m2, m3, m4, m5, m6}}
);
);
);
);
);
);
);
)
Returns a random element of degree d, of a homogeneous ring or ideal I; adapted by Montserrat Vite's code.
randomElement = (d,I) -> (
rdmElem := 0;
if (toString class I == "PolynomialRing") then(
rdmElem = random(d,I);
)
else (
R := ring I;
listOfGensI := flatten entries gens I;
for gen in listOfGensI do(
k := (degree gen)_0;
rdmElem = rdmElem + gen*random(d-k,R);
);
);
return rdmElem;
)
Some examples
prm = nextPrime(1000);
kk = ZZ/prm;
pts = {{1,0,0},{0,1,0},{0,0,1},{1,1,1}} | randomPoints(kk,2,2);
typ = typeOnCubic(3,6);
P3 = kk[x_0..x_3];
C = curveOnCubic(P3, typ, pts);
(genus C, degree C, saturate ideal singularLocus C)
degrees C
--answer: (3, 6, ideal 1), {{3}, {3}, {3}, {3}} that is
--C is a smooth curve of genus and degree (3,6) cut out by 4 cubics
cubcub = map(P3,P3,gens C);
--the cubo-cubic transformation is defined by the cubics cutting out C
e = randomElement(8, saturate(C^3));
E = ideal(e);
C'=preimage(cubcub,E)
((dim C') - 1, genus C', degree C', saturate ideal singularLocus C')
--answer: (1, 3, 6, ideal 1) that is
--cubcub contracts the unique surface E of degree 8 triple along C
--E is swept out by trisecant lines to C
L = curveOnCubic(P3, {2,{1,1,1,1,1,0}}, pts);
(genus L, degree L, degree (L+C), dim(preimage(cubcub,L))-1)
--answer: (0, 1, 3, 1) i.e. L is a such a trisecant line and is indeed contracted
s1 = randomElement(4,intersect(C,L));
S1 = ideal(s1)
S2 = preimage(cubcub,S1)
--S1 is a quartic containing C and L, S2 is its image under cubcub
(saturate ideal singularLocus S1, saturate ideal singularLocus S2)
--S1 is smooth, while S2 has a double point, an A_1-singularity along the image of L