######### A cubic surface defined over a field k has exactly 27 lines over the algebraic closure of k. The goal of this code is given the defining equation of a cubic surface as input, to output equations for the 27 lines on the surface. In almost all cases, the defining field for the lines is too large to be practical to compute. Some functions that we will use here are find_27_lines, get_polynomial_to_split, Test_Full_Galois.

from sage.schemes.affine.affine_rational_point import enum_affine_number_field

def find_27_lines(f, bound=1):

# Finds polynomial to split (the lines will be defined over its splitting field) #

def get_polynomial_to_split(F):

# Examples finding the 27 Lines on a cubic surface and its field of definition #

# This is an example showing that get_polynomial_to_split(f) works correctly. # This example is maximal ()in the sense of Algorithm 10 described below) and # appears on page 13 of Eisenhans--Jahnel. P.<x,y,z,w> = PolynomialRing(QQ) f = x3+2*x*y2+11*y3+3*x*z2+5*y2*w+7*z*w2 print get_polynomial_to_split(f)

# For this example, the output is: #r=T27 + 99/5*T26 + 3299/25*T25 + 36289/125*T24 + 264/49*T23 + 10296/245*T22 + 7725912/60025*T21 + 10026984/42875*T20 + 51920262/117649*T19 + 605313522/588245*T18 + 4659518538/2941225*T17 + 11953541358/2941225*T16 + 69318152838/5764801*T15 + 626176481634/28824005*T14 + 156330541343898/7061881225*T13 + 70137153565182/7061881225*T12 + 6440174126145/13841287201*T11 + 44233686867843/69206436005*T10 + 33749245501389/49433168575*T9 + 250779458513133/346032180025*T8 + 10050474124746/13841287201*T7 + 4683175938738/9886633715*T6 + 990986421546/49433168575*T5 - 6392766446550/13841287201*T4 - 11720071818675/13841287201*T3 - 1718943866739/1977326743*T2 - 170175442807161/346032180025*T - 207992207875419/1730160900125

# Find the 27 lines on the diagonal cubic surface x3 + y3 + z3 + w3 P.<x,y,z,w> = PolynomialRing(QQ) f = x3 + y3 + z3 + w3 find_27_lines(f) # Output The 27 lines on the surface x3 + y3 + z3 + w3 are: [[y + w, x + z],

#Algorithm 10 of Elsenhans--Jahnel

def Test_Full_Galois(f,bound = 200):