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
<?xml version="1.0" encoding="UTF-8"?>
2
3
<!-- This is an automatically generated file. -->
4
<Chapter Label="Chapter_Examples_and_Tests">
5
<Heading>Examples and Tests</Heading>
6
7
<Section Label="Chapter_Examples_and_Tests_Section_Basic_Commands">
8
<Heading>Basic Commands</Heading>
9
10
<Example><![CDATA[
11
gap> Q := HomalgFieldOfRationals();;
12
gap> a := VectorSpaceObject( 3, Q );
13
<A vector space object over Q of dimension 3>
14
gap> b := VectorSpaceObject( 4, Q );
15
<A vector space object over Q of dimension 4>
16
gap> homalg_matrix := HomalgMatrix( [ [ 1, 0, 0, 0 ],
17
> [ 0, 1, 0, -1 ],
18
> [ -1, 0, 2, 1 ] ], 3, 4, Q );
19
<A 3 x 4 matrix over an internal ring>
20
gap> alpha := VectorSpaceMorphism( a, homalg_matrix, b );
21
<A morphism in Category of matrices over Q>
22
gap> Display( alpha );
23
[ [ 1, 0, 0, 0 ],
24
[ 0, 1, 0, -1 ],
25
[ -1, 0, 2, 1 ] ]
26
27
A morphism in Category of matrices over Q
28
gap> homalg_matrix := HomalgMatrix( [ [ 1, 1, 0, 0 ],
29
> [ 0, 1, 0, -1 ],
30
> [ -1, 0, 2, 1 ] ], 3, 4, Q );
31
<A 3 x 4 matrix over an internal ring>
32
gap> beta := VectorSpaceMorphism( a, homalg_matrix, b );
33
<A morphism in Category of matrices over Q>
34
gap> CokernelObject( alpha );
35
<A vector space object over Q of dimension 1>
36
gap> c := CokernelProjection( alpha );;
37
gap> Display( c );
38
[ [ 0 ],
39
[ 1 ],
40
[ -1/2 ],
41
[ 1 ] ]
42
43
A split epimorphism in Category of matrices over Q
44
gap> gamma := UniversalMorphismIntoDirectSum( [ c, c ] );;
45
gap> Display( gamma );
46
[ [ 0, 0 ],
47
[ 1, 1 ],
48
[ -1/2, -1/2 ],
49
[ 1, 1 ] ]
50
51
A morphism in Category of matrices over Q
52
gap> colift := CokernelColift( alpha, gamma );;
53
gap> IsEqualForMorphisms( PreCompose( c, colift ), gamma );
54
true
55
gap> FiberProduct( alpha, beta );
56
<A vector space object over Q of dimension 2>
57
gap> F := FiberProduct( alpha, beta );
58
<A vector space object over Q of dimension 2>
59
gap> p1 := ProjectionInFactorOfFiberProduct( [ alpha, beta ], 1 );
60
<A morphism in Category of matrices over Q>
61
gap> Display( PreCompose( p1, alpha ) );
62
[ [ 0, 1, 0, -1 ],
63
[ -1, 0, 2, 1 ] ]
64
65
A morphism in Category of matrices over Q
66
gap> Pushout( alpha, beta );
67
<A vector space object over Q of dimension 5>
68
gap> i1 := InjectionOfCofactorOfPushout( [ alpha, beta ], 1 );
69
<A morphism in Category of matrices over Q>
70
gap> i2 := InjectionOfCofactorOfPushout( [ alpha, beta ], 2 );
71
<A morphism in Category of matrices over Q>
72
gap> u := UniversalMorphismFromDirectSum( [ b, b ], [ i1, i2 ] );
73
<A morphism in Category of matrices over Q>
74
gap> Display( u );
75
[ [ 0, 1, 1, 0, 0 ],
76
[ 1, 0, 1, 0, -1 ],
77
[ -1/2, 0, 1/2, 1, 1/2 ],
78
[ 1, 0, 0, 0, 0 ],
79
[ 0, 1, 0, 0, 0 ],
80
[ 0, 0, 1, 0, 0 ],
81
[ 0, 0, 0, 1, 0 ],
82
[ 0, 0, 0, 0, 1 ] ]
83
84
A morphism in Category of matrices over Q
85
gap> KernelObjectFunctorial( u, IdentityMorphism( Source( u ) ), u ) = IdentityMorphism( VectorSpaceObject( 3, Q ) );
86
true
87
gap> IsZero( CokernelObjectFunctorial( u, IdentityMorphism( Range( u ) ), u ) );
88
true
89
gap> DirectProductFunctorial( [ u, u ] ) = DirectSumFunctorial( [ u, u ] );
90
true
91
gap> CoproductFunctorial( [ u, u ] ) = DirectSumFunctorial( [ u, u ] );
92
true
93
gap> IsOne( FiberProductFunctorial( [ [ u, IdentityMorphism( Source( u ) ), u ], [ u, IdentityMorphism( Source( u ) ) , u ] ] ) );
94
true
95
gap> IsOne( PushoutFunctorial( [ [ u, IdentityMorphism( Range( u ) ), u ], [ u, IdentityMorphism( Range( u ) ) , u ] ] ) );
96
true
97
]]></Example>
98
99
100
</Section>
101
102
103
</Chapter>
104
105
106