This file is indexed.

/usr/share/polymake/demo/transformations.ipynb is in polymake-common 3.2r2-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
{
 "cells": [
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Polytopes and Linear Maps\n",
    "\n",
    "polymake works with [homogeneous coordinates](tutorial/coordinates), which is why *projective* linear transformations are natural to apply to polytopes. Affine transformations are a special case.  By the way, a *transformation* is always bijective, by definition.\n",
    "\n",
    "### Transformations\n",
    "\n",
    "We start out with a regular 3-cube ...\n",
    "\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "$c=cube(3);"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1 -1 -1 -1\n",
       "1 1 -1 -1\n",
       "1 -1 1 -1\n",
       "1 1 1 -1\n",
       "1 -1 -1 1\n",
       "1 1 -1 1\n",
       "1 -1 1 1\n",
       "1 1 1 1\n",
       "\n"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print $c->VERTICES;"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "... and a homethetic image:\n",
    "\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "$T=new Matrix<Rational>([[1,0,0,0],[0,2,0,0],[0,0,3,0],[0,0,0,4]]);"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "$ct=transform($c,$T);"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1 -2 -3 -4\n",
       "1 2 -3 -4\n",
       "1 -2 3 -4\n",
       "1 2 3 -4\n",
       "1 -2 -3 4\n",
       "1 2 -3 4\n",
       "1 -2 3 4\n",
       "1 2 3 4\n",
       "\n"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print $ct->VERTICES;"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "Our points are row vectors, so (projective) linear transformations are applied by multiplying the corresponding matrix from the right.  In the above example the first column of the matrix T is the vector [1,0,0,0] which means that T acts as an affine map on *R³*.  Also the first row reads [1,0,0,0], and this says that T fixes the origin.  This is to say, T acts linearly.\n",
    "\n",
    "The purpose of the function transform used above is not only to work on the VERTICES but also on the FACETS (if available).\n",
    "\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1 1 0 0\n",
       "1 -1 0 0\n",
       "1 0 1 0\n",
       "1 0 -1 0\n",
       "1 0 0 1\n",
       "1 0 0 -1\n",
       "    \n"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print $c->FACETS;"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1 1/2 0 0\n",
       "1 -1/2 0 0\n",
       "1 0 1/3 0\n",
       "1 0 -1/3 0\n",
       "1 0 0 1/4\n",
       "1 0 0 -1/4\n",
       "\n"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print $ct->FACETS;"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "If we also read the FACETS as row vectors then the corresponding action is given by the transpose of the inverse of T.\n",
    "\n",
    "\n",
    "### Non-Bijective Linear Maps\n",
    "\n",
    "Sometimes we are interested in images of polytopes under a linear map which is not bijective.  An interesting case are projections, for instance, onto a coordinate subspace.\n",
    "\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "$A=new Matrix<Rational>([[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,0]]);"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "\n",
    "Using transform would not work in this case:\n",
    "\n",
    "    \n",
    "    # polytope > transform($c,$A);\n",
    "    polymake:  ERROR: matrix not invertible\n",
    "\n",
    "The above error says that transform is not the proper function to deal with this situation as the linear map given by A is not invertible.  \n",
    "\n",
    "To produce the image the following command works:\n",
    "\n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "$ca=new Polytope<Rational>(POINTS=>$c->VERTICES*$A);"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1 -1 -1 0\n",
       "1 1 -1 0\n",
       "1 -1 1 0\n",
       "1 1 1 0\n",
       "\n"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "print $ca->VERTICES;"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "Since we are applying a non-bijective map, the images of VERTICES do not have to be VERTICES.  Moreover, even if this is the case, multiple VERTICES may be mapped to the same (like two onto one as in the example above).  If a polytope already has a double description, that is, both VERTICES and FACETS are known, then the VERTICES and FACETS of the image under a transformation (that is, a bijective map) cane be read off right away.  However, in the non-bijective case a convex hull computation is required to compute the FACETS of the image.\n",
    "\n",
    "\n",
    "### Special Examples of Linear Maps to Apply\n",
    "\n",
    "[to be continued]\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "polymake",
   "language": "polymake",
   "name": "polymake"
  },
  "language_info": {
   "codemirror_mode": "perl",
   "file_extension": ".pm",
   "mimetype": "text/x-polymake",
   "name": "polymake"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}