Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

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

563629 views
1
This chapter contains a few very basic functions which are needed for space
2
group calculations and were missing in standard ⪆.
3
4
<Section><Heading>Matrices and Vectors</Heading>
5
6
<ManSection>
7
<Meth Name="SignRat" Arg="x" />
8
<Returns> sign of the rational number <Arg>x</Arg> (Standard &GAP;
9
currently only has <C>SignInt</C>).
10
</Returns>
11
</ManSection>
12
13
<ManSection>
14
<Meth Name="VectorModOne" Arg="v"/>
15
<Returns>Rational vector of the same length with enties in <M>[0,1)</M></Returns>
16
<Description>
17
For a rational vector <Arg>v</Arg>, this returns the vector with all entries
18
taken "mod 1".
19
</Description>
20
</ManSection>
21
22
<Example>
23
gap> SignRat((-4)/(-2));
24
1
25
gap> SignRat(9/(-2));
26
-1
27
gap> VectorModOne([1/10,100/9,5/6,6/5]);
28
[ 1/10, 1/9, 5/6, 1/5 ]
29
</Example>
30
31
<ManSection>
32
<Meth Name="IsSquareMat" Arg="matrix"/>
33
<Returns>
34
<K>true</K> if <Arg>matrix</Arg> is a square matrix and <K>false</K> otherwise.
35
</Returns>
36
</ManSection>
37
38
39
<ManSection>
40
<Meth Name="DimensionSquareMat" Arg="matrix"/>
41
<Returns>Number of lines in the matrix <Arg>matrix</Arg> if it is square and
42
<K>fail</K> otherwise
43
</Returns>
44
</ManSection>
45
46
<Example>
47
gap> m:=[[1,2,3],[4,5,6],[9,6,12]];
48
[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 9, 6, 12 ] ]
49
gap> IsSquareMat(m);
50
true
51
gap> DimensionSquareMat(m);
52
3
53
gap> DimensionSquareMat([[1,2],[1,2,3]]);
54
Error, Matrix is not square called from
55
</Example>
56
57
Affine mappings of <M>n</M> dimensional space are often written as a
58
pair <M>(A,v)</M> where <M>A</M> is a linear mapping and <M>v</M> is a
59
vector. &GAP; represents affine mappings by <M>n+1</M> times
60
<M>n+1</M> matrices <M>M</M> which satisfy <M>M_{{n+1,n+1}}=1</M> and
61
<M>M_{{i,n+1}}=0</M> for all <M>1\leq i \leq n</M>.<P></P>
62
63
An affine matrix acts on an <M>n</M> dimensional space which is
64
written as a space of <M>n+1</M> tuples with <M>n+1</M>st entry
65
<M>1</M>. Here we give two functions to handle these affine matrices.
66
67
</Section>
68
69
<Section><Heading>Affine Matrices OnRight</Heading>
70
71
<ManSection>
72
<Meth Name="LinearPartOfAffineMatOnRight" Arg="mat"/>
73
<Returns>the linear part of the affine matrix <Arg>mat</Arg>. That
74
is, everything except for the last row and column.</Returns>
75
</ManSection>
76
77
<ManSection>
78
<Meth Name="BasisChangeAffineMatOnRight" Arg="transform, mat"/>
79
<Returns>affine matrix with same dimensions as <Arg>mat</Arg></Returns>
80
<Description>
81
A basis change <Arg>transform</Arg> of an <M>n</M> dimensional
82
space induces a transformation on affine mappings on this space.
83
If <Arg>mat</Arg> is a affine matrix (in particular, it is
84
<M>(n+1)\times (n+1)</M>), this method returns the image of
85
<Arg>mat</Arg> under the basis transformation induced by
86
<Arg>transform</Arg>.
87
</Description>
88
</ManSection>
89
90
<Example>
91
gap> c:=[[0,1],[1,0]];
92
[ [ 0, 1 ], [ 1, 0 ] ]
93
gap> m:=[[1/2,0,0],[0,2/3,0],[1,0,1]];
94
[ [ 1/2, 0, 0 ], [ 0, 2/3, 0 ], [ 1, 0, 1 ] ]
95
gap> BasisChangeAffineMatOnRight(c,m);
96
[ [ 2/3, 0, 0 ], [ 0, 1/2, 0 ], [ 0, 1, 1 ] ]
97
</Example>
98
99
100
<ManSection>
101
<Meth Name="TranslationOnRightFromVector" Arg="v"/>
102
<Returns>Affine matrix </Returns>
103
<Description>
104
Given a vector <Arg>v</Arg> with <M>n</M> entries, this method returns a
105
<M>(n+1)\times (n+1)</M> matrix which corresponds to the affine translation
106
defined by <Arg>v</Arg>.
107
</Description>
108
</ManSection>
109
110
<Example>
111
gap> m:=TranslationOnRightFromVector([1,2,3]);;
112
gap> Display(m);
113
[ [ 1, 0, 0, 0 ],
114
[ 0, 1, 0, 0 ],
115
[ 0, 0, 1, 0 ],
116
[ 1, 2, 3, 1 ] ]
117
gap> LinearPartOfAffineMatOnRight(m);
118
[ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ]
119
gap> BasisChangeAffineMatOnRight([[3,2,1],[0,1,0],[0,0,1]],m);
120
[ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ 3, 4, 4, 1 ] ]
121
</Example>
122
123
</Section>
124
125
<Section><Heading>Geometry</Heading>
126
127
128
<ManSection>
129
<Meth Name="GramianOfAverageScalarProductFromFiniteMatrixGroup" Arg="G"/>
130
<Returns>Symmetric positive definite matrix</Returns>
131
<Description>
132
For a finite matrix group <A>G</A>, the gramian matrix of the average scalar
133
product is returned. This is the sum over all <M>gg^t</M> with <M>g\in G</M>
134
(actually it is enough to take a generating set).
135
The group <A>G</A> is orthogonal with respect to the scalar product induced
136
by the returned matrix.
137
</Description>
138
</ManSection>
139
140
<Subsection><Heading>Inequalities</Heading>
141
Inequalities are represented in the same way they are represented in
142
<Package>polymaking</Package>. The vector <M>(v_0,\ldots,v_n)</M>
143
represents the inequality <M>0\leq v_0+v_1 x_1+\ldots + v_n x_n</M>.
144
145
</Subsection>
146
147
148
<ManSection>
149
<Meth Name="BisectorInequalityFromPointPair" Arg="v1, v2 [,gram]"/>
150
<Returns>vector of length <C>Length(v1)+1</C></Returns>
151
<Description>
152
Calculates the inequality defining the half-space containing <A>v1</A> such
153
that <C><A>v1</A>-<A>v2</A></C> is perpendicular on the bounding
154
hyperplane. And <C>(<A>v1</A>-<A>v2</A>)/2</C> is contained in the bounding
155
hyperplane.<Br/>
156
If the matrix <A>gram</A> is given, it is used as the gramian
157
matrix. Otherwiese, the standard scalar product is used. It is not checked
158
if <A>gram</A> is positive definite or symmetric.
159
</Description>
160
</ManSection>
161
162
163
<ManSection>
164
<Meth Name="WhichSideOfHyperplane" Arg="v, ineq"/>
165
<Meth Name="WhichSideOfHyperplaneNC" Arg="v, ineq"/>
166
<Returns>-1 (below) 0 (in) or 1 (above).</Returns>
167
<Description>
168
Let <A>v</A> be a vector of length <M>n</M> and <A>ineq</A> an inequality
169
represented by a vector of length <M>n+1</M>.
170
Then <C>WhichSideOfHyperplane(<A>v, ineq</A>)</C> returns 1 if <A>v</A> is
171
a solution of the inequality but not the equation given by <A>ineq</A>, it
172
returns 0 if <A>v</A> is a solution to the equation and -1 if it is not a
173
solution of the inequality <A>ineq</A>.
174
<P/>
175
The NC version does not test the input for correctness.
176
</Description>
177
</ManSection>
178
179
<Example>
180
gap> BisectorInequalityFromPointPair([0,0],[1,0]);
181
[ 1, -2, 0 ]
182
gap> ineq:=BisectorInequalityFromPointPair([0,0],[1,0],[[5,4],[4,5]]);
183
[ 5, -10, -8 ]
184
gap> ineq{[2,3]}*[1/2,0];
185
-5
186
gap> WhichSideOfHyperplane([0,0],ineq);
187
1
188
gap> WhichSideOfHyperplane([1/2,0],ineq);
189
0
190
</Example>
191
192
<ManSection><Meth Name="RelativePositionPointAndPolygon" Arg="point, poly"/>
193
<Returns>one of <C>"VERTEX", "FACET", "OUTSIDE", "INSIDE"</C></Returns>
194
<Description>
195
Let <A>poly</A> be a <K>PolymakeObject</K> and <A>point</A> a vector. If
196
<A>point</A> is a vertex of <A>poly</A>, the string <C>"VERTEX"</C> is
197
returned. If <A>point</A> lies inside <A>poly</A>, <C>"INSIDE"</C> is
198
returned and if it lies in a facet, <C>"FACET"</C> is returned and if
199
<A>point</A> does not lie inside <A>poly</A>, the function returns
200
<C>"OUTSIDE"</C>.
201
</Description>
202
</ManSection>
203
204
</Section>
205
206
207
<Section><Heading>Space Groups</Heading>
208
209
<ManSection><Attr Name="PointGroupRepresentatives" Arg="group"/>
210
<Meth Name="PointGroupRepresentatives" Arg="group"/>
211
<Returns>list of matrices</Returns>
212
<Description>
213
Given an <K>AffineCrystGroupOnLeftOrRight</K> <A>group</A>, this returns a
214
list of representatives of the point group of <A>group</A>. That is, a
215
system of representatives for the factor group modulo translations. This is
216
an attribute of <K>AffineCrystGroupOnLeftOrRight</K>
217
</Description>
218
</ManSection>
219
220
</Section>
221