Sunflower head
The seeds form two families of spirals turning in opposite directions, and the spiral counts are two neighbouring Fibonacci numbers. Pick which family to color.
The golden ratio also shows up in nature (sunflower seeds, pine cones) - this demo has two views: the sunflower pattern places each seed by rotating it by the golden angle, while the golden spiral is built from quarter-circle arcs inscribed in squares with Fibonacci side lengths. Both grow live in your browser, while the high-resolution version is drawn on the server with PHP GD and available for download.
The sunflower grows seed by seed on the canvas: every new seed is placed rotated by exactly the golden angle (≈137.508°) from the previous one, at a distance proportional to √n from the center. The drawing uses the same formula and gradient as the server, only here the browser paints it, live.
Every term in the Fibonacci sequence is the sum of the two before it: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55... The sequence was introduced to Europe by the 13th-century Italian mathematician Leonardo Fibonacci, though Indian mathematicians (Pingala, Virahanka) had described it centuries earlier.
As you move further along the sequence, the ratio of two consecutive terms gets closer and closer to the golden ratio (φ ≈ 1.618). It has been considered pleasing since antiquity, but claims that famous buildings and artworks were deliberately built on it are mostly read into them after the fact (see the Myth card below).
The golden spiral view above draws exactly this proportion: each new square's side is the sum of the two previous squares' sides, and the inscribed quarter-circle arcs trace out a continuous spiral.
The sunflower view illustrates a real botanical phenomenon called phyllotaxis: a sunflower's seeds (and the leaves or scales of many other plants) grow rotated relative to each other by the golden angle (≈137.5°) - the angle that produces the tightest, least wasteful packing, exactly as the pattern above shows.
The golden ratio and Fibonacci numbers really do show up in nature and mathematics, but not everywhere popular articles claim. Every drawing on these cards is generated in your browser, there are no photos. The card with the "Myth" badge shows what measurements do not support.
The seeds form two families of spirals turning in opposite directions, and the spiral counts are two neighbouring Fibonacci numbers. Pick which family to color.
The scales of a pine cone typically form 8 and 13 spirals. On the hexagonal fields of a pineapple, spirals show in three directions: 8, 13 and 21. A strong tendency, not an exceptionless law.
Many flowers have a Fibonacci number of petals: lily 3, buttercup 5, delphinium 8, ragwort 13, aster 21. This is a strong tendency, not a law: it can differ between varieties and individual flowers.
Two consecutive leaves around the stem are turned by a fraction of the circle: 1/2, 1/3, 2/5, 3/8, 5/13 ... These are ratios of Fibonacci numbers and tend to 1/φ² ≈ 0.382 of a turn, the golden angle (137.5°).
The pointed towers of the head line up in spirals, and each tower is itself made of smaller towers of the same shape: self-similarity. The spiral counts are typically Fibonacci numbers here too. The drawing is a simplified computed model.
Drones develop from unfertilized eggs, so they have one parent (the mother), while females have two. Going back, the number of ancestors per generation is a Fibonacci number. (The drawing ignores inbreeding.)
Liber Abaci (1202): a newborn pair of rabbits matures in a month, then bears a new pair every month, and none ever dies. The number of pairs by month: 1, 1, 2, 3, 5, 8 ... An idealized puzzle, not real animal breeding.
The numbers on the "shallow" diagonals of the triangle (where row plus column is constant) add up to the Fibonacci numbers. Pick a diagonal.
In a regular pentagon the ratio of the diagonal to the side is exactly φ = (1 + √5) / 2. The crossing points also divide the pentagram lines in the golden ratio.
The ratio of two neighbouring Fibonacci numbers approaches the golden ratio alternately from below and above: φ = 1.6180339887... The values are exact, computed from integers.
A nautilus shell is a logarithmic spiral, but not the golden spiral: it widens about threefold per turn, while the golden spiral widens by φ⁴ ≈ 6.85 per turn. The golden ratio in the Parthenon, the Mona Lisa or the "ideal face" is not established either: the measurements can be fitted selectively.
All 4 PHP functions below ACTUALLY run on the server, freshly on every click - the time is not simulated, it is measured with PHP's own nanosecond-precision clock (hrtime).
The textbook solution: fib(n) = fib(n-1) + fib(n-2), with no speedup at all. It recomputes the same subresults over and over, so it slows down exponentially as n grows.
function naiveRecursive(int $n): int
{
if ($n < 2) {
return $n;
}
return naiveRecursive($n - 1) + naiveRecursive($n - 2);
}Every call starts two more and recomputes the same subresults again and again. The colors mark the value of k: many nodes of the same color are wasted, repeated work.
This site uses Google Analytics to measure visits. This requires your consent - see the privacy policy for details. Privacy Policy