Message Boards Message Boards

how to draw inequality function?

GROUPS:

Hi all,

I am a still beginner to Mathematica, and try to learn how to draw inequality function, such as x<1/3, y<= 1+x / 2, the range of x and y values should be between 0 and 1. Also, is it possible to fill the space between?

Thanks for your helps in advance.

POSTED BY: genie kim
Answer
2 years ago
RegionPlot[x < 1/3 && y <= 1 + x/2, {x, 0, 0.5}, {y, 0, 1.5}]
POSTED BY: Eric Smith
Answer
2 years ago

Thanks, Eirc.

Can I use {} instead of &&, such as "RegionPlot [{x<1/3,y<=1+x/2},{x,0.5},{y,o,1.5}]" But, I have a slightly different graph?

Also, let's say if there are five inequality functions, then, can I still use the same command: RegionPlot, and fill the space within all the functions?

Thanks!

POSTED BY: genie kim
Answer
2 years ago

{} signifies a list... as in multiple items to plot. Using && is a logical meaning that both conditions need to be met. You definitely can use a list if you want. Here's what your suggestion (with typos removed) produces:

RegionPlot[{x < 1/3, y <= 1 + x/2}, {x, 0.0, 0.5}, {y, 0, 1.5}]

POSTED BY: Eric Smith
Answer
2 years ago

Oh, Okay, I really appreciate your reply. :)

POSTED BY: genie kim
Answer
2 years ago

Oh, Okay, I really appreciate your reply. :)

Then, if I have 5 inequality functions, then, I can use && between the function for all, such as RegionPlot [function 1 && function 2 && function 3 && function 4 && function 5, {range of function 1} etc. ]

POSTED BY: genie kim
Answer
2 years ago

Group Abstract Group Abstract