user_guide:tutorials:transformations

# Differences

This shows you the differences between two versions of the page.

 user_guide:tutorials:transformations [2019/01/25 13:40]oroehrig ↷ Page moved from user_guide:transformations to user_guide:tutorials:transformations user_guide:tutorials:transformations [2019/02/04 22:55] (current) 2019/01/28 17:40 oroehrig ↷ Links adapted because of a move operation2019/01/25 13:40 oroehrig ↷ Page moved from user_guide:transformations to user_guide:tutorials:transformations2019/01/25 09:27 oroehrig ↷ Links adapted because of a move operation2019/01/25 09:27 oroehrig ↷ Page moved from tutorial:transformations to user_guide:transformations2017/06/01 19:36 oroehrig commented out erroneous example to enable testing2014/01/03 15:45 external edit2011/01/17 10:22 joswig [Polytopes and Linear Maps] 2010/10/14 10:29 joswig created 2019/01/28 17:40 oroehrig ↷ Links adapted because of a move operation2019/01/25 13:40 oroehrig ↷ Page moved from user_guide:transformations to user_guide:tutorials:transformations2019/01/25 09:27 oroehrig ↷ Links adapted because of a move operation2019/01/25 09:27 oroehrig ↷ Page moved from tutorial:transformations to user_guide:transformations2017/06/01 19:36 oroehrig commented out erroneous example to enable testing2014/01/03 15:45 external edit2011/01/17 10:22 joswig [Polytopes and Linear Maps] 2010/10/14 10:29 joswig created Line 1: Line 1: - ===== Polytopes and Linear Maps ===== + {{page>​.:​latest:​@FILEID@}} - polymake works with [[user_guide:​coordinates|homogeneous 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. - - ==== Transformations ==== - - We start out with a regular 3-cube ... - <​code>​ - polytope > $c=cube(3); - - polytope > print$c->​VERTICES;​ - 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: - <​code>​ - polytope > $T=new Matrix<​Rational>​([[1,​0,​0,​0],​[0,​2,​0,​0],​[0,​0,​3,​0],​[0,​0,​0,​4]]);​ - - polytope >$ct=transform($c,​$T);​ - - polytope > print $ct->​VERTICES;​ - 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. ​ 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. - - The purpose of the function transform used above is not only to work on the VERTICES but also on the FACETS (if available). - - <​code>​ - polytope > print$c->​FACETS;​ - 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->​FACETS;​ - 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. ​ An interesting case are projections,​ for instance, onto a coordinate subspace. - - <​code>​ - polytope >$A=new Matrix<​Rational>​([[1,​0,​0,​0],​[0,​1,​0,​0],​[0,​0,​1,​0],​[0,​0,​0,​0]]);​ - ​ - - Using transform would not work in this case: - <​code>​ - # polytope > transform($c,​$A);​ - polymake: ​ ERROR: matrix not invertible - ​ - 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: - - <​code>​ - polytope > $ca=new Polytope<​Rational>​(POINTS=>​$c->​VERTICES*$A);​ - - polytope > print$ca->​VERTICES;​ - 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. ​ 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. - - - ==== Special Examples of Linear Maps to Apply ==== - - [to be continued]
• user_guide/tutorials/transformations.txt