As algebraic extensions are fields, all set theoretic functions are applicable to algebraic elements. The following two routines are treated specially:
in
tests, whether a given object is contained in an algebraic extension. The base field is embedded in the natural way into the extension. Two extensions are considered to be distinct, even if the minimal polynomial of one has a root in the other one.
gap> r in e;5 in e; true true gap> p1:=Polynomial(Rationals,MinPol(r^2)); x^2 + 3*x + 1 gap> r2:=RootOf(p1); RootOf(x^2 + 3*x + 1) gap> r2 in e; false
Random
A random algebraic element is computed by taking a linear combination of the powers of the primitive element with random coefficients from the ground field.
gap> ran:=Random(e); -1*alpha^3-4*alpha^2
GAP 3.4.4