wolfram alpha doesn't plot implicit function with range

1k Views Asked by At

Recently I read an article in a magazine describing how an inverse graphing calculator on this page adds domains and ranges to implicit functions. Unfortunately the page is down and I can't see it for myself, so I tried to plot one of the formulas in wolfram alpha,

(y-x)^2 + (y^2 - 6*y + 8 + sqrt(y^4 - 12*y^3 + 52*y^2 - 96*y + 64))^2=0

but it doesn't plot it, it just shows an empty graph. It does however show the correct solution:

for 2 <= x <= 4, y=x

I also tried plotting it in geogebra and some online things that can handle implicit functions but they also just give empty graphs. Is it too complicated? Is the formula correct? And if so why doesn't it plot the equation?

Thanks in advance.

3

There are 3 best solutions below

4
On BEST ANSWER

Most numerical implicit function plotters actually depend on recognizing changes of sign. Basically, if you want to plot $f(x,y) = 0$, you start by sampling a bunch of points $f(x_i,y_j)$, and you know that if this has opposite signs at two neighbouring points, there should be a piece of the curve somewhere between them. But if you have a function such that $f(x,y) \ge 0$ for all $x,y$, unless you are lucky enough to hit exactly on a point where $f(x,y) = 0$ you will only see positive values, and you will never detect the presence of a curve. That's the case here, since your function is the sum of two squares.

4
On

Since $a^2 + b^2 \geq 0 \ \forall\ a,b \in \mathbb{R} $, $a^2 + b^2 =0$ when $a = b = 0$. You get this when $x = y$ and $y^2 - 6y+8 + |y^2 - 6y+8|=0.$

Update: I think it's mainly because they don't simplify square root of a square. If you change your sqrt to $|y^2 - 6y+8|$, you get this new plot in WolframAlpha

1
On

In Mathematica, the command

ContourPlot[Log[(y - x)^2 + (y^2 - 6 y + 8 + 
   Sqrt[y^4 - 12 y^3 + 52 y^2 - 96 y + 64])^2],
   {x, 1, 5}, {y, 1, 5}, PlotPoints -> 50, MaxRecursion -> 5]

produces this output:

enter image description here

Changing ContourPlot to Plot3D gives

enter image description here

ContourPlot on the original relation will not work well even if we don't explicitly try to obtain the level set at $f(x,y) = 0$:

ContourPlot[(y - x)^2 + (y^2 - 6 y + 8 + 
    Sqrt[y^4 - 12 y^3 + 52 y^2 - 96 y + 64])^2, 
    {x, 1, 5}, {y, 1, 5}, PlotPoints -> 50, MaxRecursion -> 5, Contours -> 20]

gives

enter image description here

This suggests there is something going on, but a more sensitive step size in the level sets is needed. Clearly, a major part of the problem is not just the fact that $f(x,y) \ge 0$, but also that in the region outside $[2,4]^2$, the function increases quite rapidly. Together, these properties of the function conspire to prevent the detection of the level set.

However, a simple command

Reduce[(y - x)^2 + (y^2 - 6 y + 8 + 
  Sqrt[y^4 - 12 y^3 + 52 y^2 - 96 y + 64])^2 == 0, {x, y}, Reals]

gives the output

2 <= x <= 4 && y == x

which still fails to plot in ContourPlot, but is easily plotted with RegionPlot:

RegionPlot[2 <= x <= 4 && y == x, {x, 1, 5}, {y, 1, 5}]

gives

enter image description here

This is because RegionPlot uses different algorithms.