# Defining a 'nice' Compositum

I'm having two difficulties which I assume are simple to resolve. I have a set field, say $K= \mathbb{Q}(x^2+1)$, and a set of polynomials I want to check if they are irreducible over $K$. If they are irreducible, I would like to form the compositum of $K$ and this field generated by $f$ and then find a 'nice' generator. For example,

```
K.<root> = NumberField(x^2+1);
R = K['x'];
poly = [x^2 + 1, x^2 + 2, x^2 + x + 1];
f = R(poly[0]);
if f.is_irreducible:
L = NumberField([x^2+1, f]);
```

There are two issues:

Even when f.is_irreducible() gives True, the polynomial is not always irreducible, as in the case above, so that the construction of L gives an error.

Even if L can be formed, how do I find a 'nice' generator for L, i.e. a single polynomial $g$ which generates L so that I can form a 'better' (in terms of computation speed) field $M= \mathbb{Q}(g)$?