# With this code, we construct a computer model of a hyperbolic quadric in the
# projective space PG(3,q), and determine all external lines, secant lines, inner
# tangents and outer tangents with respect to this quadric. Subsequently, the set
# of truncated tangents (= outer tangents minus their tangency points) is written
# to a file. This file must subsequently be imported by SAGE (GeneralB.sage) to
# perform certain computations.
# Select a prime power power:
q:=11;
# With the following code, we construct a computer model of the
# projective space PG(3,q) with point set [1..q^3+q^2+q+1] and
# line set lines. The construction is based on the fact that the
# automorphism group of PG(3,q) acts primitively on PG(3,q).
if q=2 then N:=4; fi;
if q=3 then N:=6; fi;
if q=4 then N:=4; fi;
if q=5 then N:=7; fi;
if q=7 then N:=6; fi;
if q=8 then N:=4; fi;
if q=9 then N:=19; fi;
if q=11 then N:=6; fi;
if q=13 then N:=9; fi;
v:=q^3+q^2+q+1;
g:=AllPrimitiveGroups(DegreeOperation,v)[N];
h:=Stabilizer(g,[1,2],OnSets);
Orbs:=Orbits(h,[1..v]);
Orbs2:=Filtered(Orbs,x->Size(x) in [2,q-1]);
line:=Union(Orbs2);
lines:=Orbit(g,line,OnSets);
# With the following code, we construct a hyperbolic quadric in PG(3,q). The
# construction is based on the fact that there is a unique such quadric through
# every three mutually disjoint lines.
line1:=line;
help:=Filtered(lines,x->Intersection(x,line)=[]);
line2:=help[1];
help:=Filtered(lines,x->Intersection(x,Union(line1,line2))=[]);
line3:=help[1];
help:=Filtered(lines,x->Intersection(x,line1)<>[] and Intersection(x,line2)<>[] and Intersection(x,line3)<>[]);
hyp:=Union(help);
# We now construct the external lines, the secant lines, the inner tangents and
# the outer tangents.
External:=Filtered(lines,x->Size(Intersection(x,hyp))=0);
Secant:=Filtered(lines,x->Size(Intersection(x,hyp))=2);
Outer:=Filtered(lines,x->Size(Intersection(x,hyp))=1);
Inner:=Filtered(lines,x->Size(Intersection(x,hyp))=q+1);
# We construct the set of truncated tangents.
Truncated:=List(Outer,x->Difference(x,hyp));
# With the following code, we can write a list L to the file ``name’’.
WriteListToFile := function(L, name)
local f, l, p;
f := OutputTextFile(name, false);
for l in L do
for p in l do
AppendTo(f, p , " ");
od;
AppendTo(f, "\n");
od;
CloseStream(f);
end;
# The truncated tangents are written to a file.
WriteListToFile(Truncated, "Desktop/lines");