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$
  • $\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$ – Ziad Fakhoury Apr 22 '17 at 10:31
  • $\begingroup$ Hi @ZiadFakhoury, r is supposed to represent the radius of the circle $\endgroup$ – JSMorgan Apr 22 '17 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$ – Ziad Fakhoury Apr 22 '17 at 10:34
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.

| cite | improve this answer | |
$\endgroup$
  • 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$ – Andrew D. Hwang Apr 22 '17 at 11:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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