CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

Views: 418346
1
2
2 Examples and Tests
3
4
5
2.1 Basic Commands
6
7
 Example 
8
gap> Q := HomalgFieldOfRationals();;
9
gap> a := VectorSpaceObject( 3, Q );
10
<A vector space object over Q of dimension 3>
11
gap> b := VectorSpaceObject( 4, Q );
12
<A vector space object over Q of dimension 4>
13
gap> homalg_matrix := HomalgMatrix( [ [ 1, 0, 0, 0 ],
14
>  [ 0, 1, 0, -1 ],
15
>  [ -1, 0, 2, 1 ] ], 3, 4, Q );
16
<A 3 x 4 matrix over an internal ring>
17
gap> alpha := VectorSpaceMorphism( a, homalg_matrix, b );
18
<A morphism in Category of matrices over Q>
19
gap> Display( alpha );
20
[ [ 1, 0, 0, 0 ],
21
 [ 0, 1, 0, -1 ],
22
 [ -1, 0, 2, 1 ] ]
23

24
A morphism in Category of matrices over Q
25
gap> homalg_matrix := HomalgMatrix( [ [ 1, 1, 0, 0 ],
26
>  [ 0, 1, 0, -1 ],
27
>  [ -1, 0, 2, 1 ] ], 3, 4, Q );
28
<A 3 x 4 matrix over an internal ring>
29
gap> beta := VectorSpaceMorphism( a, homalg_matrix, b );
30
<A morphism in Category of matrices over Q>
31
gap> CokernelObject( alpha );
32
<A vector space object over Q of dimension 1>
33
gap> c := CokernelProjection( alpha );;
34
gap> Display( c );
35
[ [ 0 ],
36
 [ 1 ],
37
 [ -1/2 ],
38
 [ 1 ] ]
39

40
A split epimorphism in Category of matrices over Q
41
gap> gamma := UniversalMorphismIntoDirectSum( [ c, c ] );;
42
gap> Display( gamma );
43
[ [ 0, 0 ],
44
 [ 1, 1 ],
45
 [ -1/2, -1/2 ],
46
 [ 1, 1 ] ]
47

48
A morphism in Category of matrices over Q
49
gap> colift := CokernelColift( alpha, gamma );;
50
gap> IsEqualForMorphisms( PreCompose( c, colift ), gamma );
51
true
52
gap> FiberProduct( alpha, beta );
53
<A vector space object over Q of dimension 2>
54
gap> F := FiberProduct( alpha, beta );
55
<A vector space object over Q of dimension 2>
56
gap> p1 := ProjectionInFactorOfFiberProduct( [ alpha, beta ], 1 );
57
<A morphism in Category of matrices over Q>
58
gap> Display( PreCompose( p1, alpha ) );
59
[ [ 0, 1, 0, -1 ],
60
 [ -1, 0, 2, 1 ] ]
61

62
A morphism in Category of matrices over Q
63
gap> Pushout( alpha, beta );
64
<A vector space object over Q of dimension 5>
65
gap> i1 := InjectionOfCofactorOfPushout( [ alpha, beta ], 1 );
66
<A morphism in Category of matrices over Q>
67
gap> i2 := InjectionOfCofactorOfPushout( [ alpha, beta ], 2 );
68
<A morphism in Category of matrices over Q>
69
gap> u := UniversalMorphismFromDirectSum( [ b, b ], [ i1, i2 ] );
70
<A morphism in Category of matrices over Q>
71
gap> Display( u );
72
[ [ 0, 1, 1, 0, 0 ],
73
 [ 1, 0, 1, 0, -1 ],
74
 [ -1/2, 0, 1/2, 1, 1/2 ],
75
 [ 1, 0, 0, 0, 0 ],
76
 [ 0, 1, 0, 0, 0 ],
77
 [ 0, 0, 1, 0, 0 ],
78
 [ 0, 0, 0, 1, 0 ],
79
 [ 0, 0, 0, 0, 1 ] ]
80

81
A morphism in Category of matrices over Q
82
gap> KernelObjectFunctorial( u, IdentityMorphism( Source( u ) ), u ) = IdentityMorphism( VectorSpaceObject( 3, Q ) );
83
true
84
gap> IsZero( CokernelObjectFunctorial( u, IdentityMorphism( Range( u ) ), u ) );
85
true
86
gap> DirectProductFunctorial( [ u, u ] ) = DirectSumFunctorial( [ u, u ] );
87
true
88
gap> CoproductFunctorial( [ u, u ] ) = DirectSumFunctorial( [ u, u ] );
89
true
90
gap> IsOne( FiberProductFunctorial( [ [ u, IdentityMorphism( Source( u ) ), u ], [ u, IdentityMorphism( Source( u ) ) , u ] ] ) );
91
true
92
gap> IsOne( PushoutFunctorial( [ [ u, IdentityMorphism( Range( u ) ), u ], [ u, IdentityMorphism( Range( u ) ) , u ] ] ) );
93
true
94

95
96
97