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