2
$\begingroup$

Here is a simple example of what I am trying to do; fill the area described by the three inequalities:

$$ y \le 11 + x \label{1} \tag{1}$$ $$ y \le 27 - x \tag{2}$$ $$ y \le \frac{1}{5}(90 - 2x) \tag{3}$$

I have so far:

Plot[{11 + x, 27 - x, 1/5 (90 - 2 x)}, {x, 0, 20}, 
    Filling -> {2 -> {{3}, {White, LightBlue}}}]

Which produces:

enter image description here

My question is how to add multiple constraints on an area in general -- so for this specific question add the constraint specified by equation $\eqref{1}$.

$\endgroup$
  • $\begingroup$ Welcome to Mathematica.SE! I suggest that: 1) You take the introductory Tour now! 2) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! 3) As you receive help, try to give it too, by answering questions in your area of expertise. $\endgroup$ – bbgodfrey Apr 1 '15 at 14:35
  • $\begingroup$ You could use your constraints to define a Region and then use RegionPlot to plot it, including a colored fill. Search this website for similar questions. $\endgroup$ – bbgodfrey Apr 1 '15 at 14:38
5
$\begingroup$
r = ImplicitRegion[
   y <= 11 + x && y <= 27 - x && y <= 1/5 (90 - 2 x) && x >= 0 && 
    y >= 0, {x, y}];
Show[Plot[{11 + x, 27 - x, 1/5 (90 - 2 x)}, {x, 0, 20}, 
  AxesOrigin -> {0, 0}], RegionPlot[r]]

enter image description here

$\endgroup$
5
$\begingroup$
Plot[{11 + x, 27 - x, 1/5 (90 - 2 x), Min[11 + x, 27 - x], 
  Min[11 + x, 27 - x, 1/5 (90 - 2 x)]}, {x, 0, 20}, 
 Filling -> {5 -> {Axis, {White, LightBlue}}, 4 -> {{3}, {None, Yellow}}}]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.