Skip to content
scipython.com

P3.3.3The sunflower seedhead

The seedhead of a sunflower may be modelled as follows. Number the \(n\) seeds \(s=1,2,\cdots,n\) and place each seed a distance \(r = \sqrt{s}\) from the origin, rotated \(\theta = 2\pi s / \phi\) from the \(x\) axis, where \(\phi\) is some constant. The choice nature makes for \(\phi\) is the golden ratio, \(\phi = (1+\sqrt{5})/2\), which maximises the packing efficiency of the seeds as the seedhead grows.

Write a Python program to plot a model sunflower seedhead. Hint: Use polar coordinates.

Show solution

The following program is hopefully self-explanatory.

import numpy as np
import matplotlib.pyplot as plt

# Number seeds in the sunflower seedhead
n = 200
# The golden ratio, 1.61803398874989...
phi = (1 + np.sqrt(5))/2

# Calculate and plot the seed positions, (r, theta) for each seed, s
s = np.linspace(0, n-1, n)
r = np.sqrt(s)
theta = 2 * np.pi * s / phi
plt.polar(theta, r, marker='o', linestyle='', markersize=8, color='r')

plt.show()

A model for the seedhead of a sunflower