The previous post built iterated golden rectangles. We begin with a golden rectangle and envision chopping of first the blue, then the green, then the orange, and after that the red square. We might continue this process on the inner most rectangle, over and over.

Ive seen an image similar to the following lot of times, but I do not recall any source going into detail relating to how the spiral is built. This post will do simply that.

At this moment, numerous sources would say “Hey look! We can draw a spiral that goes through two corners of each square” without clearly mentioning a formula for the spiral. Well find spiral, making everything specific.

In the previous post we demonstrated how to find the limitation of the iterative procedure at the intersection of the 2 diagonal lines listed below.

We showed that the crossway is at

To summarize what we understand so far, if we shift our spiral to the origin, it has equation in polar kind.

The outcome is the image at the top of the post.

a = -x0/ (np.exp( k * theta0) * np.cos( theta0))).

We can find the criterion a by knowing that our spiral travels through the origin, the bottom left corner in the plots above. At what worth of θ does the curve go through the origin? We have an option; values of θ that differ by multiples of 2π will offer various worths of a.

for some constants a and k. Our spiral will be such a spiral moved to center at (x0, y0).

x( θ) = x0 + a exp( kθ) cos( θ).

Then we fix for a from the formula x( θ0) = 0.

A logarithmic spiral focused at the origin has the polar formula.

a exp( k( θ + π/ 2)) = φ a exp( kθ).

Imagine a spiral going from the lower delegated the top left of the blue square, then to the leading left of the green square, then to the top right of the orange square etc., going through 2 corners of every square. Whenever θ goes through a quarter turn, i.e. π/ 2 radians, our rectangular shapes get smaller by a factor of φ. We can utilize this to resolve for k since.

We can draw a spiral that goes through two corners of each square” without clearly specifying an equation for the spiral. Well discover spiral, making everything explicit.

and.

phi = (1 + 5 ** 0.5)/ 2.

y0 = 1/( 2+ phi).

x0 = (2 * phi + 1) * y0.

theta0 = np.arctan2(- y0, -x0).

Finding θ and a.

therefore.

and.

θ0 = atan2(- y0,– x0).

The angle θ is the angle made by the line linking (0, 0) to (x0, y0). We can find θ via.

Logarithmic spirals.

r( θ) = a exp( kθ).

Plots.

y0 = 1/( φ + 2).

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-“).

r( θ) = a exp( kθ).

x0 = (2φ + 1)/( φ + 2).

Now we have all the parameters we require to specify our logarithmic spiral. The following code draws our logarithmic spiral on top of the plot of the rectangles.

exp( kπ/ 2) = φ.

Envision 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 find the criterion a by knowing that our spiral passes through the origin, the bottom left corner in the plots above.

import numpy as np.

Heres Python code to find θ0:.

To get our real spiral, we have to move the origin to (x0, y0) which we have computed above. Transforming from polar to rectangular coordinates so we can do the shift, we have.

y( θ) = y0 + a exp( kθ) sin( θ).

where we now know k however dont yet know a.

k = 2log( φ)/ π.