Function: galoisfixedfield
Section: number_fields
C-Name: galoisfixedfield
Prototype: GGD0,L,Dn
Help: galoisfixedfield(gal,perm,{flag},{v=y}): gal being a Galois group as
 output by galoisinit and perm a subgroup, an element of gal.group or a vector
 of such elements, return [P,x] such that P is a polynomial defining the fixed
 field of gal[1] by the subgroup generated by perm, and x is a root of P in gal
 expressed as a polmod in gal.pol. If flag is 1 return only P. If flag is 2
 return [P,x,F] where F is the factorization of gal.pol over the field
 defined by P, where the variable v stands for a root of P.
Description:
 (gen, gen, ?small, ?var):vec        galoisfixedfield($1, $2, $3, $4)
Doc: \var{gal} being be a Galois group as output by \tet{galoisinit} and
 \var{perm} an element of $\var{gal}.group$, a vector of such elements
 or a subgroup of \var{gal} as returned by galoissubgroups,
 computes the fixed field of \var{gal} by the automorphism defined by the
 permutations \var{perm} of the roots $\var{gal}.roots$. $P$ is guaranteed to
 be squarefree modulo $\var{gal}.p$.

 If no flags or $\fl=0$, output format is the same as for \tet{nfsubfield},
 returning $[P,x]$ such that $P$ is a polynomial defining the fixed field, and
 $x$ is a root of $P$ expressed as a polmod in $\var{gal}.pol$.

 If $\fl=1$ return only the polynomial $P$.

 If $\fl=2$ return $[P,x,F]$ where $P$ and $x$ are as above and $F$ is the
 factorization of $\var{gal}.pol$ over the field defined by $P$, where
 variable $v$ ($y$ by default) stands for a root of $P$. The priority of $v$
 must be less than the priority of the variable of $\var{gal}.pol$ (see
 \secref{se:priority}).
 In this case, $P$ is also expressed in the variable $v$ for compatibility
 with $F$. Example:

 \bprog
 ? G = galoisinit(x^4+1);
 ? galoisfixedfield(G,G.group[2],2)
 %2 = [y^2 - 2, Mod(- x^3 + x, x^4 + 1), [x^2 - y*x + 1, x^2 + y*x + 1]]
 @eprog\noindent
 computes the factorization  $x^4+1=(x^2-\sqrt{2}x+1)(x^2+\sqrt{2}x+1)$
