2
$\begingroup$

Suppose I want to mark the area defined by the following equation:

$$\max(\mid x_1-a \mid,\mid x_2-b \mid) \leq c$$

for any real constants $a$, $b$, and $c$.

How do I do that in Mathematica? I can draw the border for the area by using the ContourPlot and and changing the inequality sign to an equality sign, but is there a way I can mark the area?

The above equation is just an example. In general, I am looking for a solution to mark the area given by any implicit function of the form $f(x_1,x_2) \leq c$ for a real constant $c$.

$\endgroup$
2
  • $\begingroup$ Take a look at RegionPlot $\endgroup$
    – Carl Woll
    Dec 18, 2017 at 16:28
  • 2
    $\begingroup$ check RegionPlot, For example, Manipulate[ RegionPlot[ Max[Abs[x - a], Abs[y - b]] <= c, {x, -1, 1}, {y, -1, 1}], {a, -1, 1}, {b, -1, 1}, {c, 0, 1}]. $\endgroup$
    – kglr
    Dec 18, 2017 at 16:28

1 Answer 1

4
$\begingroup$
a = 5;
b = 10;
c = 7;
RegionPlot[
 Max[Abs[x - a], Abs[y - b]] <= c, 
 {x, -20, 20}, 
 {y, -20, 20}]

RegionPlot

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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