Understanding a plot of a complex plane

algorithmsanalytic geometrycomplex numberscomplex-analysiselliptic-curves

I am sorry if this sounds a bit convoluted but here goes.

I have written a program that traces a symmetric approximation of a square, my function does not use sine, cosine,or any trigonometric functions, angles or pi… At least not explicitly. It takes two arguments – i,j which are indexes of the center point of the circle, and a variable r denoting the radius. What it does is use complex vector spaces to enable parallelization of the process of tracing the curve directly into the relevant cells that indicate the curve around the i,j center point.

The program works very well, tracing a perfect circle(the circle is not centered properly because my matrix had an even number of rows and columns- but the circle itself is perfectly symmetric):

enter image description here

But there was something that made me curious and I failed to figure it out, I inserted into the program a part which saves the real distance of every cell on the circumference from the radius(I am approximating a circle with squares here), just out of curiousity to see how the plot looks. when I plotted it, here is what I got ( this is a 1D plot):

enter image description here

My questions:

  1. Why are there various elliptic curves inside this 1D plot of real valued distances? I calculated the mean of the distances from each point on the curve to the radius, It seemed oddly close to 0.676211…. which is very close to e/4. When I tried plotting with a larger radius, it never got over the value of e/4, and it seemed to be converging on it. why?

  2. The point with the maximum distance between it and the radius, was 1.55… which is converging on pi/2 but from above – meaning the value is usually above pi/2, but again – as r grows it also seems to converge on it – although not asymptotically.I guess that makes sense somehow because the radius marks the circumference, but still. why pi/2?

  3. Not a question but just a note, the program terminates after exactly 8r points have been traced. the area of the circle seems to follow the following polynomial equation 2(r – 1)^2 +2(r – 1) + 1.

Just to finish – plots of distances from the radius when the length of the circle radius = 459, and length of the circle radius = 4799 (just random values) if anyone knows any method of understanding what the hell is going here I will be very intrested:
enter image description here
enter image description here

Best Answer

I think the following is adequate evidence that your plots are actually showing hyperbolas that arise when several cells happen to fall in a straight line. Lacking exact details of your algorithm, I wrote a program to find all the $1\times 1$ open square lattice cells in the plane that overlap a circle of given radius. (This number appears to be asymptotic to $8r$ as $r\to\infty,$ consistent with what you found.) For each cell with corner-coordinates $(i,j),(i,j+1),(i+1,j),(i+1,j+1)$, I then computed the distance between the circle and the point $(i,j).$

As an example with $r=459$, the following plot on the left shows distance vs cell index for the first $2000$ cells (there being exactly $3660$ cells overlapping the circle), the cells being indexed in counter-clockwise sequence around the circle from angle $0$ back to $2\pi:$

plots of distance vs cell index

The plot on the right is the result of re-ordering the cells in the manner you have done (as you explained in comments), so that the first four cells are the ones at angles $0,\pi/2,\pi,3\pi/2$, the next four are the next ones counter-clockwise after those respective locations, and so on around the circle. This "interleaving" is what causes various hyperbolas to get matched up with inverted hyperbolas, giving the appearance of closed curves.

Why hyperbolas? It's a consequence of the alignment of several cells that overlap the circle. For example, letting $d_n$ be the distance between the circle and the corner of the $n$th such cell (in counter-clockwise order), I find $d_n = r - \sqrt{(r-1)^2 + n^2}$, or $(d_n-r)^2 - n^2 = (r-1)^2,$ which is the equation of a hyperbola.