Mathematica Asked by mlegge on January 18, 2021
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:
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}$.
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]]
Correct answer by Algohi on January 18, 2021
Depend on @kglr, but only use three functions.
Plot[{11 + x, 27 - x, 1/5 (90 - 2 x)}, {x, 0, 20}, PlotPoints -> 40,
Filling -> {3 -> {Axis, {None, Blue}}, 2 -> {{3}, {White, None}},
1 -> {{3}, {White, None}}}]
Answered by cvgmt on January 18, 2021
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}}}]
Answered by kglr on January 18, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP