Logarithmic spiral
I've seen an image similar to the following many times, but I don't recall any source going into detail regarding how the spiral is constructed. This post will do just that.
The previous post constructed iterated golden rectangles. We start with a golden rectangle and imagine chopping of first the blue, then the green, then the orange, and then the red square. We could continue this process on the inner most rectangle, over and over.
At this point, many sources would say Hey look! We can draw a spiral that goes through two corners of each square" without explicitly stating an equation for the spiral. We'll find spiral, making everything explicit.
In the previous post we showed how to find the limit of the iterative process at the intersection of the two diagonal lines below.
We showed that the intersection is at
x0 = (2 + 1)/( + 2)
and
y0 = 1/( + 2).
Logarithmic spiralsA logarithmic spiral centered at the origin has the polar equation
r() = a exp(k)
for some constants a and k. Our spiral will be such a spiral shifted to center at (x0, y0).
Imagine a spiral going from the lower left to the top left of the blue square, then to the top left of the green square, then to the top right of the orange square etc., passing through two corners of every square. Every time goes through a quarter turn, i.e. /2 radians, our rectangles get smaller by a factor of . We can use this to solve for k because
a exp(k( + /2)) = a exp(k)
and so
exp(k/2) =
and
k = 2log() / .
To summarize what we know so far, if we shift our spiral to the origin, it has equation in polar form
r() = a exp(k)
where we now know k but don't yet know a.
Finding and aTo get our actual spiral, we have to shift the origin to (x0, y0) which we have calculated above. Converting from polar to rectangular coordinates so we can do the shift, we have
x() = x0 + a exp(k) cos()
y() = y0 + a exp(k) sin()
We can find the parameter a by knowing that our spiral passes through the origin, the bottom left corner in the plots above. At what value of does the curve go through the origin? We have a choice; values of that differ by multiples of 2 will give different values of a.
The angle is the angle made by the line connecting (0, 0) to (x0, y0). We can find via
0 = atan2(-y0, -x0).
Here's Python code to find 0:
import numpy as np phi = (1 + 5**0.5)/2 y0 = 1/(2+phi) x0 = (2*phi + 1)*y0 theta0 = np.arctan2(-y0, -x0)
Then we solve for a from the equation x(0) = 0.
k = 2*np.log(phi)/np.pi a = -x0 / (np.exp(k*theta0)*np.cos(theta0)))Plots
Now we have all the parameters we need to define our logarithmic spiral. The following code draws our logarithmic spiral on top of the plot of the rectangles.
t = np.linspace(-20, theta0, 1000) def x(t): return x0 + a*np.exp(k*t)*np.cos(t) def y(t): return y0 + a*np.exp(k*t)*np.sin(t) plt.plot(x(t), y(t), "k-")
The result is the image at the top of the post.
The post Logarithmic spiral first appeared on John D. Cook.