### 14.4 Functions and Variables for algebraic extensions

Function: algfac (f, p)

  Returns the factorization of f in the field K[a]. Does the same as `factor(f, p)` which in fact calls `algfac`. One can also specify the variable a as in `algfac(f, p, a)`.

  Examples:

      (%i1) algfac(x^4 + 1, a^2 - 2);
                                 2              2
      (%o1)                    (x  - a x + 1) (x  + a x + 1)
      (%i2) algfac(x^4 - t*x^2 + 1, a^2 - t - 2, a);
                                 2              2
      (%o2)                    (x  - a x + 1) (x  + a x + 1)

  In the second example note that a = sqrt(2 + t).

Function: algnorm (f, p, a)

  Returns the norm of the polynomial f(a) in the extension obtained by a root a of polynomial p. The coefficients of f may depend on other variables.

  Examples:

      (%i1) algnorm(x*a^2 + y*a + z,a^2 - 2, a);
                                  2              2      2
      (%o1)/R/                   z  + 4 x z - 2 y  + 4 x

  The norm is also the resultant of polynomials f and p, and the product of the differences of the roots of f and p.

Function: algtrace (f, p, a)

  Returns the trace of the polynomial f(a) in the extension obtained by a root a of polynomial p. The coefficients of f may depend on other variables which remain “inert”.

  Example:

      (%i1) algtrace(x*a^5 + y*a^3 + z + 1, a^2 + a + 1, a);
      (%o1)/R/                       2 z + 2 y - x + 2

Function: bdiscr (args)

  Computes the discriminant of a basis x_i in K[a] as the determinant of the matrix of elements trace(x_i*x_j). The args are the elements of the basis followed by the minimal polynomial.

  Example:

      (%i1) bdiscr(1, x, x^2, x^3 - 2);
      (%o1)/R/                             - 108
      (%i2) poly_discriminant(x^3 - 2, x);
      (%o2)                                - 108

  A standard base in an extension of degree n is 1, x, ..., x^{n - 1}. In this case it is known that the discriminant of this base is the discriminant of the minimal polynomial. This is checked in (%o2) above.

Function: primelmt (f_b, p_a, c)

  Computes a prime element for the extension of K[a] by a root b of a polynomial f_b(b) whose coefficients may depend on a. One assumes that f_b is square free. The function returns an irreducible polynomial, a root of which generates K[a, b], and the expression of this primitive element in terms of a and b.

  Examples:

      (%i1) primelmt(b^2 - a*b - 1, a^2 - 2, c);
                                    4       2
      (%o1)                       [c  - 12 c  + 9, b + a]
      (%i2) solve(b^2 - sqrt(2)*b - 1)[1];
                                        sqrt(6) - sqrt(2)
      (%o2)                       b = - -----------------
                                                2
      (%i3) primelmt(b^2 - 3, a^2 - 2, c);
                                    4       2
      (%o3)                       [c  - 10 c  + 1, b + a]
      (%i4) factor(c^4 - 12*c^2 + 9, a^4 - 10*a^2 + 1);
                       3    2                       3    2
      (%o4) ((4 c - 3 a  - a  + 27 a + 5) (4 c - 3 a  + a  + 27 a - 5)
                                 3    2                       3    2
                       (4 c + 3 a  - a  - 27 a + 5) (4 c + 3 a  + a  - 27 a - 5))/256
      (%i5) primelmt(b^3 - 3, a^2 - 2, c);
                         6      4      3       2
      (%o5)            [c  - 6 c  - 6 c  + 12 c  - 36 c + 1, b + a]
      (%i6) factor(b^3 - 3, %[1]);
                  5       4        3        2
      (%o6) ((48 c  + 27 c  - 320 c  - 468 c  + 124 c + 755 b - 1092)
                 5        5         4       4          3        3          2        2
       ((- 48 b c ) - 54 c  - 27 b c  + 64 c  + 320 b c  + 360 c  + 468 b c  + 149 c
                                 2
       - 124 b c - 1272 c + 755 b  + 1092 b + 1606))/570025

  In (%o1), f_b depends on `a`. Using `solve`, the solution depends on sqrt(2) and sqrt(3). In (%o3), K[sqrt(2), sqrt(3)] is computed, and we see that the the primitive polynomial in (%o1) factorizes completely here. In (%i5), we compute K[sqrt(2), 3^{1/3}], and we see that `b^3 - 3` gets one factor in this extension. If we assume this extension is real, the two other factors are complex.

Function: splitfield (p, x)

  Computes the splitting field of the polynomial p(x). In the generic case it is of degree n! in terms of the degree n of p, but may be of lower order if the Galois group of p is a strict subgroup of the group of permutations of n elements. The function returns a primitive polynomial for this extension and the expressions of the roots of p as polynomials of a root of this primitive polynomial. The polynomial f may be irreducible or factorizable.

  Examples:

      (%i1) splitfield(x^3 + x + 1, x);
                                                    4         2
                    6         4         2       alg1  + 5 alg1  - 9 alg1 + 4
      (%o1)/R/ [alg1  + 6 alg1  + 9 alg1  + 31, ----------------------------,
                                                             18
                                       4         2          4         2
                                   alg1  + 5 alg1  + 4  alg1  + 5 alg1  + 9 alg1 + 4
                                 - -------------------, ----------------------------]
                                            9                        18
      (%i2) splitfield(x^4 + 10*x^2 - 96*x - 71, x)[1];
                   8           6           5            4             3
      (%o2)/R/ alg2  + 148 alg2  - 576 alg2  + 9814 alg2  - 42624 alg2
                                                          2
                                             + 502260 alg2  + 1109952 alg2 + 18860337

  In the first case we have the primitive polynomial of degree 6 and the 3 roots of the third degree equations in terms of a variable `alg1` produced by the system. In the second case the primitive polynomial is of degree 8 instead of 24, because the Galois group of the equation is reduced to D8 since there are relations between the roots.