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

$\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

1 Answer

$\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" () 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

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like