Code generating examples of space filling curve

This page includes the Macaulay2 code generating examples of smooth space filling curves in \mathbb{P}^3.

The paper On algebraic space filling curves (with A. Campbell, F. Dedvukaj, D. McCormick III, and J. Morales) describes the background and details of the construction. 

On \mathbb{P}^3 over a finite field \mathbb{F}_q or order q, we construct a space filling curve by taking a complete intersection C = V(f, g) = V(f) \cap V(g) where V(f) and V(g) are two space filling surfaces. Since the ideal of space filling surfaces is

 J = (x^q y - x y^q, x^q z - x z^q, x^q w - x w^q, y^q z - yz^q, y^q w - yw^q, z^q w - zw^q),

we need to find two polynomials f, g \in J such that V(f, g) is a smooth curve. We choose the smallest degree polynomial g = x^q y - xy^q + z^q w - zw^q such that V(g) is a smooth space filling surface. For the second polynomial f, we know that the smallest possible degree is q+2. So we construct a random degree q+2 polynomial in J and check:

  1. If V(f, g) is smooth;
  2. If \dim V(f, g) is two. Here the dimension of V(f, g) is the affine dimension, so if it is two, V(f, g) is a projective curve in \mathbb{P}^3.

Here is the Macaulay2 code doing this job.

needsPackage(“SpaceCurves”);
p = 3; — Fix the characteristic of the base field.
r = 1;
q = p^r; — Fix the order of the field.
K = GF(q, Variable => a); — K is the finite field of order q.
d = 1;
S = K[x, y, z, w]; — Define the polynomial ring with four variables.
g = x^q*y-x*y^q+z^q*w-z*w^q; — Set the polynomial g defining a smooth space filling surface of minimal degree.
J = ideal(x^q*y-x*y^q, x^q*z-x*z^q, x^q*w-x*w^q, y^q*z-y*z^q, y^q*w-y*w^q, z^q*w-z*w^q); — The ideal of space filling surfaces.
found = false;
counter = 0;
while not found do — Run the routine until it finds an example.
    {
    f = random(q+1+d, J); — Construct a random space filling surface of degree q+2, by choosing a polynomial in J.
    I = ideal(f, g); — Construct an ideal I generated by f and g.
    if isSmooth(I) and dim I == 2 then — If V(I) is a smooth space filling curve:
    {
        print f; — Print the polynomial f.
        print counter; — Print the number of tries.
        found = true; — End the routine.
    }
    else counter = counter + 1;
    }

Output:
1. q=2
2. q=3
3. q=4
4. q=5

This page will be updated with more computational outputs.