Skip to content

BaseMax/GAPBeginner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 

Repository files navigation

GAP Beginner

A repository to introduce GAP system for beginners.

Variable

universe := 6*7;
m:=[[1,2,3],[4,5,6],[7,8,9]];

ColorPrompt()

ColorPrompt(true);

LogTo()

LogTo("gap-intro.log");

Display()

Display(m);

Factorial()

> Factorial(100);
93326215443944152681699238856266700490715968264381621468\
59296389521759999322991560894146397615651828625369792082\
7223758251185210916864000000000000000000000000

Determinant()

> Determinant(m);
0

Factors()

> Factors(2^64-1);
[ 3, 5, 17, 257, 641, 65537, 6700417 ]

Filtered()

> Filtered( [2,9,6,3,4,5], IsEvenInt);
[ 2, 6, 4 ]

Fibonacci()

> Fibonacci(100);
354224848179261915075

Group()

> a:=(1,2,3);;b:=(2,3,4);;
> # Next, let G be a group generated by a and b:
> G:=Group(a,b);
Group([ (1,2,3), (2,3,4) ])

Size()

> a:=(1,2,3);;b:=(2,3,4);;
> G:=Group(a,b);
> Size(G);
12

IsAbelian()

> a:=(1,2,3);;b:=(2,3,4);;
> G:=Group(a,b);
> IsAbelian(G);
false

StructureDescription()

> a:=(1,2,3);;b:=(2,3,4);;
> G:=Group(a,b);
> StructureDescription(G);
"A4"

Order()

> a:=(1,2,3);;b:=(2,3,4);;
> Order(a);
3

AsList()

> a:=(1,2,3);;b:=(2,3,4);;
> G:=Group(a,b);
> AsList(G);
[ (), (2,3,4), (2,4,3), (1,2)(3,4), (1,2,3), (1,2,4), (1,3,2), (1,3,4),
  (1,3)(2,4), (1,4,2), (1,4,3), (1,4)(2,3) ]

last

> a:=(1,2,3);;b:=(2,3,4);;
> G:=Group(a,b);
> AsList(G);
> elts:=last;
[ (), (2,3,4), (2,4,3), (1,2)(3,4), (1,2,3), (1,2,4), (1,3,2), (1,3,4),
  (1,3)(2,4), (1,4,2), (1,4,3), (1,4)(2,3) ]

Length()

> a:=(1,2,3);;b:=(2,3,4);;
> G:=Group(a,b);
> AsList(G);
> elts:=last;
[ (), (2,3,4), (2,4,3), (1,2)(3,4), (1,2,3), (1,2,4), (1,3,2), (1,3,4),
  (1,3)(2,4), (1,4,2), (1,4,3), (1,4)(2,3) ]
> Length(elts);
12

Array Index

> a:=(1,2,3);;b:=(2,3,4);;
> G:=Group(a,b);
> AsList(G);
> elts:=last;
> elts[1];
()
> elts[3];
(2,4,3)

IsSet()

> IsSet([1,3,5]);
> IsSet([1,5,3]);
> IsSet([1,3,3]);
true
false
false

Order()

> a:=(1,2,3);;b:=(2,3,4);;
> G:=Group(a,b);
> Order(g);

for

> a:=(1,2,3);;b:=(2,3,4);;
> G:=Group(a,b);
> s:=0;;
> for g in elts do
>   s := s + Order(g);
> od;
> s/Length(elts);
31/12
> s:=0;;
> for g in G do
>   s := s + Order(g);
> od;
> s/Size(G);
31/12
> s:=0;;
> for i in [ 1 .. Length(elts) ] do
>   s := s + Order( elts[i] );
> od;
> s/Length(elts);
31/12

Sum()

> Sum( List( elts, Order ) ) / Length( elts );
31/12

Filtered()

> Filtered( elts, g -> NrMovedPoints(g) = 4 );
[ (1,2)(3,4), (1,3)(2,4), (1,4)(2,3) ]

First()

> First( elts, g -> (1,2)^g = (2,3) );
(1,2,3)

= operator

> (1,2,3)^-1*(1,2)*(1,2,3)=(2,3);
true

ForAll

> ForAll( elts, g -> 1^g <> 2 );
false

ForAny()

> ForAny( elts, g -> NrMovedPoints(g) = 2 );
false

Float()

> 1.15;
> Float(1232/3456567);
1.15
0.000356423

E()

> E(4); E(4)^2; E(6);
> E(4)
> -1
> -E(3)^2

AsList()

> AsList(GF(2)); Z(5); Z(5)^4;
[ 0*Z(2), Z(2)^0 ]
Z(5)
Z(5)^0

Length()

> w:="supercalifragilisticexpialidocious";
"supercalifragilisticexpialidocious"
> Length(w);
34

SortedList()

> w:="supercalifragilisticexpialidocious";
> Length(w);
34
> SortedList(w);
"aaacccdeefgiiiiiiillloopprrssstuux"
> w;
"supercalifragilisticexpialidocious"

Max Base

My nickname is Max, Programming language developer, Full-stack programmer. I love computer scientists, researchers, and compilers. (Max Base)

Asrez Team

A team includes some programmer, developer, designer, researcher(s) especially Max Base.

Asrez Team

About

A repository to introduce GAP system for beginners.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published