# affinePreimage(Matrix,Polyhedron,Matrix) -- computes the affine preimage of a polyhedron

## Synopsis

• Function: affinePreimage
• Usage:
P1 = affinePreimage(A,P,v)
P1 = affinePreimage(A,P)
P1 = affinePreimage(P,v)
• Inputs:
• A, , with entries in ZZ or QQ
• v, , with entries in ZZ or QQ and only one column representing a vector
• Outputs:
• P1,

## Description

A must be a matrix from some source space to the ambient space of the polyhedron P and v must be a vector in that ambient space, i.e. the number of rows of A must equal the ambient dimension of P and the number of rows of v. affinePreimage then computes the polyhedron {q | (A*q)+v in P} where v is set to 0 if omitted and A is the identity if omitted.

For example, consider the following two dimensional polytope

 i1 : P = convexHull matrix {{-2,0,2,4},{-8,-2,2,8}} o1 = {ambient dimension => 2 } dimension of lineality space => 0 dimension of polyhedron => 2 number of facets => 4 number of rays => 0 number of vertices => 4 o1 : Polyhedron

and its affine preimage under the following map:

 i2 : A = matrix {{-5,2},{3,-1}} o2 = | -5 2 | | 3 -1 | 2 2 o2 : Matrix ZZ <--- ZZ i3 : v = matrix {{5},{-3}} o3 = | 5 | | -3 | 2 1 o3 : Matrix ZZ <--- ZZ i4 : Q = affinePreimage(A,P,v) o4 = {ambient dimension => 2 } dimension of lineality space => 0 dimension of polyhedron => 2 number of facets => 4 number of rays => 0 number of vertices => 4 o4 : Polyhedron i5 : vertices Q o5 = | -17 -3 7 21 | | -46 -10 16 52 | 2 4 o5 : Matrix QQ <--- QQ