How to plot bivariate function involving modulus and floor functions?

72 Views Asked by At

I need to plot:

  • $\displaystyle\large|||x|-2|-1|+|||y|-2|-1|=1$
  • $\displaystyle\large\left\lfloor\frac{|3x+4y|}{5}\right\rfloor+\left\lfloor\frac{|4x-3y|}{5}\right\rfloor=3$

either for finding area of some region or the length of the wire, if used to make the graph(maybe the line integral.) Only consider the plotting of these graphs:

enter image description here and enter image description here

1

There are 1 best solutions below

5
On BEST ANSWER

For the first :

The graph is symmetry both about $x$-axis and $y$-axis. So, we only need to consider the case when $x\ge 0$ and $y\ge 0$. Then, note that $$|||a|-2|-1|=\begin{cases}-a+1&\text{if $0\le a\lt 1$}\\a-1&\text{if $1\le a\lt 2$}\\-a+3&\text{if $2\le a\lt 3$}\\a-3&\text{if $a\ge 3$}\end{cases}$$

For the second :

Since $$\frac{|3x+4y|}{5}\ge 0\ \ \text{and}\ \ \frac{|4x-3y|}{5}\ge 0,$$ each term of the left-hand-side is a non-negative integer.

Hence, we have only four cases as the followings :

(1) $$\left\lfloor\frac{|3x+4y|}{5}\right\rfloor=0\ \ \text{and}\ \ \left\lfloor\frac{|4x-3y|}{5}\right\rfloor=3.$$

(2) $$\left\lfloor\frac{|3x+4y|}{5}\right\rfloor=1\ \ \text{and}\ \ \left\lfloor\frac{|4x-3y|}{5}\right\rfloor=2.$$

(3) $$\left\lfloor\frac{|3x+4y|}{5}\right\rfloor=2\ \ \text{and}\ \ \left\lfloor\frac{|4x-3y|}{5}\right\rfloor=1.$$

(4) $$\left\lfloor\frac{|3x+4y|}{5}\right\rfloor=3\ \ \text{and}\ \ \left\lfloor\frac{|4x-3y|}{5}\right\rfloor=0.$$