Using Lawrence's formula to calculate the volume polynomial for the diamond with vertices (1,0), (2,1), (1,2), (0,1).

The facet inequalities are -x1-x2<=-1, x1-x2<=1, x1+x2<=3, -x1+x2<=1.

The tableaux P1, P2, P3, P4 below, are associated with vertices 1, 2, 3, 4, respectively.

Note that we chose to keep x1 and x2 basic in each tableau.

> with(linalg):

Warning, the protected names norm and trace have been redefined and unprotected

> T:=array([[-1,-1,1,0,0,0,b1], [1,-1,0,1,0,0,b2], [1,1,0,0,1,0,b3], [-1,1,0,0,0,1,b4], [-c1,-c2,-c3,0,0,0,0]]);

T := matrix([[-1, -1, 1, 0, 0, 0, b1], [1, -1, 0, 1...

> mypivot:=(M,i,j)->pivot(mulrow(M,i,1/M[i,j]),i,j);

mypivot := proc (M, i, j) options operator, arrow; ...

> T2:=mypivot(T,1,1);

T2 := matrix([[1, 1, -1, 0, 0, 0, -b1], [0, -2, 1, ...

> P1:=mypivot(T2,2,2);

P1 := matrix([[1, 0, -1/2, 1/2, 0, 0, -1/2*b1+1/2*b...

> n1:=(1/2)*(1/2)*(P1[5,7]^2/(P1[5,3]*P1[5,4]));

n1 := 1/4*(-1/2*c1*b1+1/2*c1*b2-1/2*c2*b1-1/2*c2*b2...

> P2:=mypivot(P1,3,3);

P2 := matrix([[1, 0, 0, 1/2, 1/2, 0, 1/2*b3+1/2*b2]...

> n2:=(1/2)*(1/2)*(P2[5,7]^2/(P2[5,4]*P2[5,5]));

n2 := 1/4*(1/2*c1*b3+1/2*c2*b3+c3*b1+c3*b3+1/2*c1*b...

> P3:=mypivot(P2,4,4);

P3 := matrix([[1, 0, 0, 0, 1/2, -1/2, -1/2*b4+1/2*b...

> n3:=(1/2)*(1/2)*(P3[5,7]^2/(P3[5,5]*P3[5,6]));

n3 := 1/4*(-1/2*c1*b4+1/2*c2*b4+1/2*c1*b3+1/2*c2*b3...

> P4:=mypivot(P3,3,5);

P4 := matrix([[1, 0, -1/2, 0, 0, -1/2, -1/2*b1-1/2*...

> n4:=(1/2)*(1/2)*(P4[5,7]^2/(P4[5,3]*P4[5,6]));

n4 := 1/4*(-1/2*c1*b1-1/2*c2*b1-1/2*c1*b4+1/2*c2*b4...

> v:=simplify(n1+n2+n3+n4);

v := 1/2*b4*b3+1/2*b3*b2+1/2*b1*b2+1/2*b1*b4

> v1:=factor(v);

v1 := 1/2*(b2+b4)*(b1+b3)

>