Felix
Felix

Reputation: 3134

Plotting 3 inequations with 3 variables in maple

I need to plot this in maple

3x1+y+z<=180
x<=12
x+y+4z<=190

How can I do a plot in Maple? I'm using Maple 13

Upvotes: 0

Views: 2359

Answers (2)

Since you mentioned these three inequalities are constraints for an optimization problem, therefore I assume you are interested in the intersection of them and not each separately. Here is how I do it. I use piecewise command to define a binary values function that is equal to 1 when the point satisfies all three inequalities and then I use implicitplot3d command from plots package and an inequality f > 1/2 or you can go for the equality f = 1, then this command will plot the boundary of your region as a surface. Of course sometimes you may not get a suitable plot, for example one case happens when your region is tiny compared with the plotting box.

f := piecewise( And( 3*x + y + z <= 180, x <= 12, x + y + 4*z <= 190 ), 1, 0 );
plots:-implicitplot3d( f >= 1/2, x = -500..500, y=-300..700, z=-500..500, style = surface, grid = [50, 50, 50], color = blue, view = [-500..500, -300..700, -500..500 ] );

Here is the output. enter image description here

Upvotes: 0

Michael Mrozek
Michael Mrozek

Reputation: 175325

You plot inequalities with the inequal command from the plots library, and you can plot multiple equations by putting them in brackets:

plots[inequal]([3x1+y+z<=180, x<=12, x+y+4z<=190])

If a given plot command doesn't support multiple plots, you can always do the plots separately and combine them with display:

with(plots):
plot1 := inequal(3x1+y+z<=180):
plot2 := inequal(x<=12):
plot3 := inequal(x+y+4z<=190):
display([plot1, plot2, plot3])

Upvotes: 3

Related Questions