GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
1\Chapter{An example application}23In this section we outline two example computations with the functions4of the previous chapter. The first example uses number fields defined5by matrices and the second example considers number fields defined by6a polynomial.78%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%9\Section{Number fields defined by matrices}1011\beginexample12gap> m1 := [ [ 1, 0, 0, -7 ],13[ 7, 1, 0, -7 ],14[ 0, 7, 1, -7 ],15[ 0, 0, 7, -6 ] ];;1617gap> m2 := [ [ 0, 0, -13, 14 ],18[ -1, 0, -13, 1 ],19[ 13, -1, -13, 1 ],20[ 0, 13, -14, 1 ] ];;2122gap> F := FieldByMatricesNC( [m1, m2] );23<rational matrix field of unknown degree>2425gap> DegreeOverPrimeField(F);26427gap> PrimitiveElement(F);28[ [ -1, 1, 1, 0 ], [ -2, 0, 2, 1 ], [ -2, -1, 1, 2 ], [ -1, -1, 0, 1 ] ]2930gap> Basis(F);31Basis( <rational matrix field of degree 4>,32[ [ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] ],33[ [ 0, 1, 0, 0 ], [ -1, 1, 1, 0 ], [ -1, 0, 1, 1 ], [ -1, 0, 0, 1 ] ],34[ [ 0, 0, 1, 0 ], [ -1, 0, 1, 1 ], [ -1, -1, 1, 1 ], [ 0, -1, 0, 1 ] ],35[ [ 0, 0, 0, 1 ], [ -1, 0, 0, 1 ], [ 0, -1, 0, 1 ], [ 0, 0, -1, 1 ] ] ] )3637gap> MaximalOrderBasis(F);38Basis( <rational matrix field of degree 4>,39[ [ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 1 ] ],40[ [ -1, 1, 1, 0 ], [ -2, 0, 2, 1 ], [ -2, -1, 1, 2 ], [ -1, -1, 0, 1 ] ],41[ [ -3, -2, 2, 3 ], [ -3, -5, 0, 5 ], [ 0, -5, -3, 3 ], [ 2, -2, -3, 0 ] ],42[ [ -1, -1, 0, 1 ], [ 0, -2, -1, 1 ], [ 1, -1, -2, 0 ], [ 1, 0, -1, -1 ] ]43] )4445gap> U := UnitGroup(F);46<matrix group with 2 generators>4748gap> u := GeneratorsOfGroup( U );;4950gap> nat := IsomorphismPcpGroup(U);;51gap> H := Image(nat);52Pcp-group with orders [ 10, 0 ]53gap> ImageElm( nat, u[1] );54g155gap> ImageElm( nat, u[2] );56g257gap> ImageElm( nat, u[1]*u[2] );58g1*g259gap> u[1] = PreImagesRepresentative(nat, GeneratorsOfGroup(H)[1] );60true61\endexample6263%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%64\Section{Number fields defined by a polynomial}6566\beginexample67gap> g := UnivariatePolynomial( Rationals, [ 16, 64, -28, -4, 1 ] );68x_1^4-4*x_1^3-28*x_1^2+64*x_1+166970gap> F := FieldByPolynomialNC(g);71<algebraic extension over the Rationals of degree 4>72gap> PrimitiveElement(F);73a74gap> MaximalOrderBasis(F);75Basis( <algebraic extension over the Rationals of degree 4>,76[ !1, 1/2*a, 1/4*a^2, 1/56*a^3+1/14*a^2+1/14*a-2/7 ] )7778gap> U := UnitGroup(F);79<group with 4 generators>8081gap> natU := IsomorphismPcpGroup(U);;82gap> elms := List( [1..10], x-> Random(F) );;8384gap> PcpPresentationOfMultiplicativeSubgroup( F, elms );85Pcp-group with orders [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]8687gap> isom := IsomorphismPcpGroup( F, elms );;88gap> y := RandomGroupElement( elms );;89gap> z := ImageElm( isom, y );;90gap> y = PreImagesRepresentative( isom, z );91true9293gap> FactorsPolynomialAlgExt( F, g );94[ x_1+(-a), x_1+(a-2), x_1+(-1/7*a^3+3/7*a^2+31/7*a-40/7),95x_1+(1/7*a^3-3/7*a^2-31/7*a+26/7) ]96\endexample979899100101102103104105106107108109110111112113114115116117118119120121122123124125126