# Bizarre and Mysterious Result from $x^2 + y^2 = r^2$

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?

thanks!

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

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)$;"). 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.

• (+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. – Andrew D. Hwang Apr 22 '17 at 11:38