Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
| user_guide:tutorials:transformations [2019/01/28 17:40] – ↷ Links adapted because of a move operation oroehrig | user_guide:tutorials:transformations [2019/02/04 22:55] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ===== Polytopes and Linear Maps ===== | + | {{page> |
| - | polymake works with [[user_guide: | ||
| - | |||
| - | ==== Transformations ==== | ||
| - | |||
| - | We start out with a regular 3-cube ... | ||
| - | < | ||
| - | polytope > $c=cube(3); | ||
| - | |||
| - | polytope > print $c-> | ||
| - | 1 -1 -1 -1 | ||
| - | 1 1 -1 -1 | ||
| - | 1 -1 1 -1 | ||
| - | 1 1 1 -1 | ||
| - | 1 -1 -1 1 | ||
| - | 1 1 -1 1 | ||
| - | 1 -1 1 1 | ||
| - | 1 1 1 1 | ||
| - | </ | ||
| - | ... and a homethetic image: | ||
| - | < | ||
| - | polytope > $T=new Matrix< | ||
| - | |||
| - | polytope > $ct=transform($c, | ||
| - | |||
| - | polytope > print $ct-> | ||
| - | 1 -2 -3 -4 | ||
| - | 1 2 -3 -4 | ||
| - | 1 -2 3 -4 | ||
| - | 1 2 3 -4 | ||
| - | 1 -2 -3 4 | ||
| - | 1 2 -3 4 | ||
| - | 1 -2 3 4 | ||
| - | 1 2 3 4 | ||
| - | </ | ||
| - | |||
| - | Our points are row vectors, so (projective) linear transformations are applied by multiplying the corresponding matrix from the right. | ||
| - | |||
| - | The purpose of the function transform used above is not only to work on the VERTICES but also on the FACETS (if available). | ||
| - | |||
| - | < | ||
| - | polytope > print $c-> | ||
| - | 1 1 0 0 | ||
| - | 1 -1 0 0 | ||
| - | 1 0 1 0 | ||
| - | 1 0 -1 0 | ||
| - | 1 0 0 1 | ||
| - | 1 0 0 -1 | ||
| - | |||
| - | polytope > print $ct-> | ||
| - | 1 1/2 0 0 | ||
| - | 1 -1/2 0 0 | ||
| - | 1 0 1/3 0 | ||
| - | 1 0 -1/3 0 | ||
| - | 1 0 0 1/4 | ||
| - | 1 0 0 -1/4 | ||
| - | </ | ||
| - | |||
| - | If we also read the FACETS as row vectors then the corresponding action is given by the transpose of the inverse of T. | ||
| - | |||
| - | |||
| - | ==== Non-Bijective Linear Maps ==== | ||
| - | |||
| - | Sometimes we are interested in images of polytopes under a linear map which is not bijective. | ||
| - | |||
| - | < | ||
| - | polytope > $A=new Matrix< | ||
| - | </ | ||
| - | |||
| - | Using transform would not work in this case: | ||
| - | < | ||
| - | # polytope > transform($c, | ||
| - | polymake: | ||
| - | </ | ||
| - | 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. | ||
| - | |||
| - | To produce the image the following command works: | ||
| - | |||
| - | < | ||
| - | polytope > $ca=new Polytope< | ||
| - | |||
| - | polytope > print $ca-> | ||
| - | 1 -1 -1 0 | ||
| - | 1 1 -1 0 | ||
| - | 1 -1 1 0 | ||
| - | 1 1 1 0 | ||
| - | </ | ||
| - | |||
| - | Since we are applying a non-bijective map, the images of VERTICES do not have to be VERTICES. | ||
| - | |||
| - | |||
| - | ==== Special Examples of Linear Maps to Apply ==== | ||
| - | |||
| - | [to be continued] | ||