updates/Maple17/LinearSolve - Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : updates/Maple17/LinearSolve

Linear inequality solving

The LinearSolve command in the RegularChains package, whose purpose is to solve systems of linear equations and inequalities, has been enhanced in several ways:

• 

A more efficient algorithm based on Fourier-Motzkin elimination, has been implemented.

• 

Two new options, canonical and projection, for controlling the form of the output have been added.

The examples below illustrate the use of this command and the two new options for computations with polyhedra.

Change of representation for polyhedra

There are at least two ways to mathematically describe a polyhedron, either by specifying its corners, or by specifying its bounding hyperplanes. This is illustrated using a cube of side length 1 with one corner at the origin and its three adjacent edges parallel to the three coordinate axes.

 

Plot the cube:

withplots:withplottools:

displaycuboid0,0,0,1,1,1,axes=boxed,labels=x,y,z

Define this cube by bounding planes:

c1x0,x1,y0,y1,z0,z1

0x,x1,0y,y1,0z,z1

(1.1)

Alternatively, define the vertices of the same cube:

VMatrix0,0,0,0,0,1,0,1,0,0,1,1,1,0,0,1,0,1,1,1,0,1,1,1

000001010011100101110111

(1.2)

Suppose now that you are given the vertex representation and want to automatically derive the bounding planes representation. The cube is defined as the convex hull of all its vertices:

opconvertVectorrowx,y,z=~addλiVi,i=1..8,list

x=λ5+λ6+λ7+λ8,y=λ3+λ4+λ7+λ8,z=λ2+λ4+λ6+λ8

(1.3)

addλi,i=1..8=1

λ1+λ2+λ3+λ4+λ5+λ6+λ7+λ8=1

(1.4)

seqλi0,i=1..8

0λ1,0λ2,0λ3,0λ4,0λ5,0λ6,0λ7,0λ8

(1.5)

seqλi1,i=1..8

λ11,λ21,λ31,λ41,λ51,λ61,λ71,λ81

(1.6)

sys,,,:

You can now use the LinearSolve command to eliminate all λi from this system of equations and inequalities. The projection option is used to specify that elimination is required, and the canonical option to eliminate redundant equations and inequalities.

withRegularChains:withSemiAlgebraicSetTools:

varsseqλi,i=1..8,z,y,x

λ1,λ2,λ3,λ4,λ5,λ6,λ7,λ8,z,y,x

(1.7)

LinearSolvesys,PolynomialRingvars,canonical,projection=3

0x,x1,0y,y1,0z,z1

(1.8)

This agrees with the representation c1 above.

Dual polyhedra

 

For every convex 3-D polyhedron, there is a dual polyhedron with the roles of corners and faces swapped. Let us compute the dual polyhedron of the cube. Start with a representation of the cube with the origin as the center.

c2x1,x1,y1,y1,z1,z1

x1,x1,y1,y1,z1,z1

(2.1)

Now rewrite this in matrix form.

BMatrix1,0,0,1,0,0,0,1,0,0,1,0,0,0,1,0,0,1

100100010010001001

(2.2)

vVectorx,y,z

xyz

(2.3)

cVector1,1,1,1,1,1

111111

(2.4)

B.v~c

x1x1y1y1z1z1

(2.5)

In general, if a bounded convex polyhedron is given by a set of inequalities of the form B.v1, then the vertices of its dual are exactly the columns of the matrix B. The convex hull of these six vertices defines an octahedron. Using the same method as before, compute the bounding planes for this octahedron.

opconvertVectorrowx,y,z=~addλiBi,i=1..6,list

x=λ1λ2,y=λ3λ4,z=λ5λ6

(2.6)

addλi,i=1..6=1

λ1+λ2+λ3+λ4+λ5+λ6=1

(2.7)

seqλi0,i=1..6

0λ1,0λ2,0λ3,0λ4,0λ5,0λ6

(2.8)

seqλi1,i=1..6

λ11,λ21,λ31,λ41,λ51,λ61

(2.9)

sys,,,:

varsseqλi,i=1..6,z,y,x

λ1,λ2,λ3,λ4,λ5,λ6,z,y,x

(2.10)

SLinearSolvesys,PolynomialRingvars,canonical,projection=3

1x,x1,x1y,1+xy,y1+x,y1x,yx1z,y+x1z,1x+yz,1+x+yz,zy+x+1,zyx+1,z1+xy,z1xy

(2.11)

The first two inequalities represent that projection of the octahedron onto the x axis:

S1..2

1x,x1

(2.12)

Together with the following four inequalities, which involve only x and y but not z, this defines the projection of the octahedron onto the x,y-plane:

S1..2; S3..6

x1y,1+xy,y1+x,y1x

(2.13)

The following plot shows this projection (blue) together with the four boundary lines.

inequalS3..6,x=2..2,y=2..2

Finally, the last 8 inequalities, i.e., the ones containing z, define the bounding planes of the octahedron.

S8..1

yx1z,y+x1z,1x+yz,1+x+yz,zy+x+1,zyx+1,z1+xy,z1xy

(2.14)

The following 3-D plot displays the tetrahedron as well as the last of these 8 bounding planes. Rotate the plot with the mouse in order to see that the plane actually touches one of the faces.

planeStudent:-LinearAlgebra:-PlanePlotlhsrhsS1=0,x,y,z,caption=,shownormal=false,showpoint=false,planeoptions=transparency=0.3:

displayoctahedron0,0,0,plane,axes=boxed,labels=x,y,z

See Also

RegularChains[SemiAlgebraicSetTools][LinearSolve]


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam