Question: Let $S$ be a smooth cubic surface defined by $f\in \mathbb Q[x,y,z,w]$. Is there an algorithm to write down the 27 lines on $S$? Or at least find a field extension of $\mathbb Q$ over which these lines are defined?

Answer: 
This work from the Mainz Algebraic Geometry Group may help:

> 
> Duco van Straten and Oliver Labs. *A Visual Introduction to Cubic Surfaces Using the Computer Software Spicy*. Springer Berlin Heidelberg, 2003.
>    
> 
>  Short (12-page) 2001 Dagstuhl article: [PDF download link](http://www.oliverlabs.net/data/dagstuhl_proceedings_2001_10_OliverLabs.pdf).
> 
> 
> 

---

![DagstuhlFig6](https://i.stack.imgur.com/g7BIZ.png)

---

Here is a little snippet from p.6 (of their Dagstuhl article).
They take as input six points $\{P\_1,\ldots,P\_6\} \subset \mathbb{P}^2$
in the plane in general position:

---

![CompAlgPart](https://i.stack.imgur.com/2LSW4.png)

---
Once you have the six points in $\mathbb{P}^2$, there is a very easy algorithm to give the cubic surface and the $27$ lines. First, the map to $\mathbb{P}^3$ corresponds to cubics through the six points. So you can choose reducible ones (union of three lines through $2$) and get generators $(f\_0:\dots:f\_3)$. Then, you find the equation by putting the $f\_i$ into a polynomial of degree $3$ and solving the linear equation on the coefficients.

Then, the $27$ lines are the strict transforms of lines through $2$ points, conic through $5$ points and the exceptional divisors. If you have the points and the $f\_i$, this is algorithmic.

To simplify your calculation, you can choose the points and choose (over an algebraically closed field) $[1:0:0]$, $[0:1:0]$, $[0:0:1]$, $[1:1:1]$, $[1:a:b]$, $[1:c:d]$.

The only non-algorithmic part is starting from the cubic to find the contraction to $\mathbb{P}^2$. This corresponds to find lines on the cubic and is then more complicated (and there is in general no solution with radicals, as explained by David Speyer).

Note that the same kind of algorithm works with del Pezzo surfaces of degree $4$, $2$, $1$. I did it often with Maple with points given.