Function: galoisfixedfield
Section: number_fields_galois
C-Name: galoisfixedfield
Prototype: GGD0,L,Dn
Help: galoisfixedfield(gal,H,{flag},{v=y}): gal being a Galois group as
 output by galoisinit and H 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 H, 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{H} 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 subgroup $H$
 $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);
 ? [P,inc,F] = 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)$

 To obtain the action of $H$ on the relative extension defined by one of the
 polynomials \kbd{F[i]}  of $F$, compute the action of $H$ on the absolute
 extension (using \kbd{galoispermtopol}) and reduce it modulo \kbd{F[i]}:

 \bprog
 ? s = galoispermtopol(G,G.group[2])
 %3 = -x^3
 ? S = s % F[1]
 %4 = (-y^2+1)*x+y
 ? subst(F[1],x,Mod(S,F[1])*Mod(1,P))
 %5 = Mod(0,x^2-y*x+1)
 @eprog
