1 | initial version |
The most natural way is probably as follows.
sage: K = QQ[sqrt(2), sqrt(3)]
sage: K.inject_variables()
Defining sqrt2, sqrt3
sage: (sqrt2 + sqrt3)^2
2*sqrt3*sqrt2 + 5
The case of adjoining two algebraic numbers with the same minimal polynomial is more involved, see: