# Singular

#### D.13.1.2 newtonPolytopeP

Procedure from library `polymake.lib` (see polymake_lib).

Usage:
newtonPolytopeP(f); f poly

Return:
list, L with four entries
L[1] : an integer matrix whose rows are the coordinates of vertices of the Newton polytope of f
L[2] : the dimension of the Newton polytope of f
L[3] : a list whose ith entry explains to which vertices the ith vertex of the Newton polytope is connected
-- i.e. L[3][i] is an integer vector and an entry k in there means that the vertex L[1][i] is
connected to the vertex L[1][k]
L[4] : an matrix of type bigintmat whose rows mulitplied by (1,var(1),...,var(nvar)) give a linear system of equations describing the affine hull of the Newton polytope, i.e. the smallest affine space containing the Newton polytope

Note:
- if we replace the first column of L[4] by zeros, i.e. if we move the affine hull to the origin, then we get the equations for the orthogonal complement of the linearity space of the normal fan dual to the Newton polytope, i.e. we get the EQUATIONS that
we need as input for polymake when computing the normal fan
- the procedure calls for its computation polymake by Ewgenij Gawrilow, TU Berlin and Michael Joswig, so it only works if polymake is installed; see http://www.math.tu-berlin.de/polymake/

Example:
 ```LIB "polymake.lib"; ring r=0,(x,y,z),dp; matrix M[4][1]=1,x,y,z; poly f=y3+x2+xy+2xz+yz+z2+1; // the Newton polytope of f is list np=newtonPolytopeP(f); // the vertices of the Newton polytope are: np[1]; // its dimension is np[2]; // np[3] contains information how the vertices are connected to each other, // e.g. the first vertex (number 0) is connected to the second, third and // fourth vertex np[3][1]; ////////////////////////// f=x2-y3; // the Newton polytope of f is np=newtonPolytopeP(f); // the vertices of the Newton polytope are: np[1]; // its dimension is np[2]; // the Newton polytope is contained in the affine space given // by the equations intmat(np[4])*M; ```