5
$\begingroup$

I was graphing a simple equation - $x^2 + y^2 = r^2$ (where $r$ represents the radius of the circle) on the native OSX Grapher application, and viewed a rather bizarre result - a collection of random and seemingly infinitely zoomable graph of 'squiggles' for lack of better term.

I have included images below.

Odd behavior 1

Odd behavior 2

My question: What is going on here? Are there any mathematical underpinnings or is this simply a 'bug' in the Grapher application?


I'm guessing there is nothing significant about this result, although I figured I would ask anyway to make sure.

thanks!

$\endgroup$
3
  • $\begingroup$ Is $r$ supposed to denote some quantity? I would think it would be the distance from the origin as in polar coordinates but that would be just the entire $\mathbb R^2$ $\endgroup$ Apr 22, 2017 at 10:31
  • $\begingroup$ Hi @ZiadFakhoury, r is supposed to represent the radius of the circle $\endgroup$
    – js-anon
    Apr 22, 2017 at 10:32
  • 1
    $\begingroup$ Yes well there is no parameter or slider for $r$, so clearly it some variable. Whereas its the radius of the circle if it was a constant value. $\endgroup$ Apr 22, 2017 at 10:34

1 Answer 1

6
$\begingroup$

We are faced here with algorithmic issues at a very low discrepancy level, this discrepancy being rendered by a "contour plot".

On the LHS, $x^2+y^2$ is computed in a certain way, hopefully as $x*x+y*y$ (but that's not sure), and, on the RHS, in a different way, for example $r^2$=norm of vector $(x,y)$ obtained by another algorithm, or the same algorithm with a different rounding level. The contour plot is a graphical representation of their difference, a noisy plane surface $z=\varepsilon(x,y)$ (at a very very low level of noise).

I have written a Matlab program that reproduces the upsaid type of discrepancy and gives a result that if very similar to the type of graphics given in the question (see the central instruction "T(K,L)=norm($[x,y])^2-(x^2+y^2)$;").

enter image description here

pas=0.01;
for K=1:100;
   x=-0.5+K*pas;
   for L=1:100;
      y=-0.5+L*pas;
      T(K,L)=norm([x,y])^2-(x^2+y^2);
   end;
end;
contour(T)

Remarks:

a) The maximum discrepancy value $|T(K,L)|$ is $1.7 \times 10^{-16}.$ Take note that we are under the Matlab's "machine epsilon" (https://en.wikipedia.org/wiki/Machine_epsilon) which is $2.2 \times 10^{-16}.$

b) One can notice as well a certain symmetry in the vicinity of axes, looking a little like a Rorschach test.

c) A specificity of Matlab is that there is still another function equivalent to function norm : it is $hypot$ with hypot(x,y), closer to $x^2+y^2$ in the mean.

$\endgroup$
2
  • 1
    $\begingroup$ (+1) As partial confirmation, plotting "$r^{2} = 4$" or $"x^{2} + y^{2} = 4$" in the OSX Grapher gives the expected circle of radius $2$; it appears the Grapher program implicitly interprets $x$, $y$, and $r$ as functions on the plane. $\endgroup$ Apr 22, 2017 at 11:38
  • 1
    $\begingroup$ Forgot tot say thanks for answering this! An interesting result. Cheers $\endgroup$
    – js-anon
    Dec 18, 2020 at 14:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .