GAP (Utils) - Chapter 11: Various other functions

Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 12 13 Bib Ind
[Top of Book] [Contents] [Previous Chapter] [Next Chapter]

[MathJax off]

11 Various other functions
11.1 File operations
11.1-1 Log2HTML
11.2 LaTeX strings
11.2-1 IntOrInfinityToLaTeX
11.2-2 LaTeXStringFactorsInt
11.3 Conversion to \({\sf Magma}\) strings
11.3-1 ConvertToMagmaInputString

### 11 Various other functions

#### 11.1 File operations

##### 11.1-1 Log2HTML

`‣ Log2HTML`( filename ) | ( function )

This function has been transferred from package RCWA.

This function converts the GAP logfile `filename` to HTML. It appears that the logfile should be in your current directory. The extension of the input file must be `*.log`. The name of the output file is the same as the one of the input file except that the extension `*.log` is replaced by `*.html`. There is a sample CSS file in `utils/doc/gaplog.css`, which you can adjust to your taste.

    gap> LogTo( "triv.log" );
    gap> a := 33^5;
    39135393
    gap> LogTo();
    gap> Log2HTML( "triv.log" );

#### 11.2 LaTeX strings

##### 11.2-1 IntOrInfinityToLaTeX

`‣ IntOrInfinityToLaTeX`( n ) | ( function )

This function has been transferred from package ResClasses.

`IntOrInfinityToLaTeX` returns the LaTeX string for n.

    gap> IntOrInfinityToLaTeX( 10^3 );
    "1000"
    gap> IntOrInfinityToLaTeX( infinity );
    "\\infty"

##### 11.2-2 LaTeXStringFactorsInt

`‣ LaTeXStringFactorsInt`( n ) | ( function )

This function has been transferred from package RCWA.

It returns the prime factorization of the integer \(n\) as a string in LaTeX format.

    gap> LaTeXStringFactorsInt( Factorial(12) );
    "2^{10} \\cdot 3^5 \\cdot 5^2 \\cdot 7 \\cdot 11"

#### 11.3 Conversion to \({\sf Magma}\) strings

##### 11.3-1 ConvertToMagmaInputString

`‣ ConvertToMagmaInputString`( arg ) | ( function )

The function `ConvertToMagmaInputString( obj [, str] )` attempts to output a string `s` which can be read into \({\sf Magma}\) [BCP97] so as to produce the same group in that computer algebra system. In the second form the user specifies the name of the resulting object, so that the output string has the form `"str := ..."`.

When `obj` is a permutation group, the operation `PermGroupToMagmaFormat(obj)` is called. This function has been taken from `other.gi` in the main library where it was called `MagmaInputString`.

When `obj` is a pc-group, the operation `PcGroupToMagmaFormat(obj)` is called. This function was private code of Max Horn.

When `obj` is a matrix group over a finite field, the operation `MatrixGroupToMagmaFormat(obj)` is called. This function is a modification of private code of Frank Lübeck.

Hopefully code for other types of group will be added in due course.

These functions should be considered experimental, and more testing is desirable.

    gap> ## permutation groups
    gap> ConvertToMagmaInputString( Group( (1,2,3,4,5), (3,4,5) ) );
    "PermutationGroup<5|(1,2,3,4,5),\n(3,4,5)>;\n"
    gap> ConvertToMagmaInputString( Group( (1,2,3,4,5) ), "c5" );
    "c5 := PermutationGroup<5|(1,2,3,4,5)>;\n"
    gap> ## pc-group
    gap> ConvertToMagmaInputString( DihedralGroup( IsPcGroup, 10 ) );
    "PolycyclicGroup< f1,f2 |\nf1^2,\nf2^5,\nf2^f1 = f2^4\n>;\n"
    gap> ## fp-group
    gap> F2 := FreeGroup( 2 );;
    gap> f := F2.1;;  g := F2.2;;
    gap> relq8 := [ f^4, g^4, f*g*f*g^-1, f^2*g^2 ];;
    gap> q8 := F2/relq8;;
    gap> ConvertToMagmaInputString( q8 );
    no conversion function yet available for fp-groups
    fail
    gap> ## matrix group
    gap> M := GL(2,5);;  Size(M);
    480
    gap> s1 := ConvertToMagmaInputString( M );
    "F := GF(5);\nP := GL(2,F);\ngens := [\nP![2,0,0,1],\nP![4,1,4,0]\n];\nsub<P |\
     gens>;\n"
    gap> Print( s1 );
    F := GF(5);
    P := GL(2,F);
    gens := [
    P![2,0,0,1],
    P![4,1,4,0]
    ];
    sub<P | gens>;
    gap> n1 := [ [ Z(9)^0, Z(9)^0 ], [ Z(9)^0, Z(9) ] ];;
    gap> n2 := [ [ Z(9)^0, Z(9)^3 ], [ Z(9)^4, Z(9)^2 ] ];;
    gap> N := Group( n1, n2 );;  Size( N );
    5760
    gap> s2 := ConvertToMagmaInputString( N, "gpN" );;
    gap> Print( s2 );
    F := GF(3^2);
    P := GL(2,F);
    w := PrimitiveElement(F);
    gens := [
    P![ 1, 1, 1,w^1],
    P![ 1,w^3, 2,w^2]
    ];
    gpN := sub<P | gens>;

[Top of Book] [Contents] [Previous Chapter] [Next Chapter]
Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 12 13 Bib Ind

generated by GAPDoc2HTML