The idea: one polar formula for circles, stars and flowers
In 2003 the plant biologist Johan Gielis published a single formula that draws a circle, a square, a triangle, a star, a flower or a starfish, depending on four numbers. It gives the distance r from the centre for every angle φ, so it is a curve in polar coordinates:
r(φ) = ( |cos(mφ/4) / a|^n₂ + |sin(mφ/4) / b|^n₃ )^(−1/n₁) here a = b = 1
This is the superformula. The page keeps a = b = 1 and lets you pick m, n₁, n₂ and n₃, or a shape from the menu. Play morphs to the next shape by sliding all four numbers at once.
Reading the formula
Write θ = mφ/4. Inside the brackets is a sum |cos θ|^n₂ + |sin θ|^n₃, which is always positive. The outer power −1/n₁ turns that sum into a radius: where the sum is small, r is big (a tip), and where the sum is big, r is small (a dent), as long as n₁ > 0.
At φ = 0, cos 0 = 1 and sin 0 = 0, so the sum is 1 and r = 1 for every choice of the parameters. That is the blue dot on the canvas: every shape passes through the point (1, 0). The plot rescales itself so the whole curve fits; the outer ring's value is written at the top left of the plot.
| number | what it does |
|---|---|
| m | how many copies of one piece go around: the rotational symmetry |
| n₁ | the outer power: small n₁ makes spikes, large n₁ makes it round, negative n₁ turns dents into bulges |
| n₂, n₃ | the powers on |cos| and |sin|: they bend the sides in (below 2) or out (above 2) |
| a, b | stretch the cos and sin terms; the page keeps them at 1 |
m: how many copies go around
|cos θ| and |sin θ| both repeat every π, and when n₂ = n₃ the sum even repeats every π/2 (swap cos and sin and nothing changes). With θ = mφ/4, a step of π/2 in θ is a step of 2π/m in φ. So the shape is made of m equal copies, one every 360°/m: it has m-fold symmetry. The teal spokes on the canvas mark where each copy starts. m = 5 gives a five-pointed star, m = 6 a six-petalled flower, and m = 0 makes θ = 0 for every φ, so r = 1: a circle. (Demo: m sets the symmetry, m = 1 … 8.)
When n₂ ≠ n₃ the sum only repeats every π in θ, so a copy is 720°/m wide and you get m/2 copies. Compare a rose curve r = cos(kθ), whose number of petals also comes from one whole number.
n₁: spiky or bloated
r = sum^(−1/n₁). Take m = 5 and n₂ = n₃ = 1: the sum is 1 on the axes of θ and √2 ≈ 1.41 halfway between. With n₁ = 0.2 the power is −5, so between the tips r drops from 1 to 1.41^(−5) ≈ 0.18: a thin, spiky star. With n₁ = 10 the power is −0.1, and r only drops to 1.41^(−0.1) ≈ 0.97: an almost round, bloated shape. Small n₁ pinches, large n₁ inflates. (Demo: n₁ from spiky to bloated, 0.2 → 10.) With n₂ = n₃ above 2 the dips and tips swap places: the star (n₂ = n₃ = 7) has its sum fall to 0.177 halfway between the axes, so n₁ = 0.2 would shoot those tips out to 0.177^(−5) ≈ 5700.
A negative n₁ flips the power's sign. Where the sum was big, r is now big, so the old dents become rounded bulges and the old spikes become sharp notches: a flower. Morphing from n₁ = 0.5 to n₁ = −0.5 passes through −1/n₁ = 0, where r = 1 everywhere, so the shape goes through a circle on the way. (Demo: a negative n₁ turns spikes into petals.) The n₁ track on the canvas is laid out by −1/n₁ for that reason: ±∞ sits in the middle.
n₂ and n₃: the sides, and the Lamé curve
For n₂ = n₃ = n, the sum |cos θ|ⁿ + |sin θ|ⁿ is 1 on the axes of θ. Halfway between them (θ = 45°) it is 2·(1/√2)ⁿ: bigger than 1 for n < 2 and smaller for n > 2. So below 2 the sides pinch in towards the centre and above 2 they push out into corners; at exactly 2, cos² + sin² = 1 and the shape is a circle. (Demo: n₂ = n₃ shape the sides.)
Now take m = 4, so θ = φ, and n₁ = n₂ = n₃ = n. With x = r cos φ and y = r sin φ:
|x|ⁿ + |y|ⁿ = rⁿ ( |cos φ|ⁿ + |sin φ|ⁿ ) = rⁿ · r^(−n) = 1
That is the Lamé curve (the superellipse) |x|ⁿ + |y|ⁿ = 1: n = 1 is a diamond, n = 2 the unit circle, n = 4 a rounded square and n = 100 almost a square with corners at (±1, ±1), r = √2 ≈ 1.41. The superformula is Gielis' generalisation of it. With different a and b it would stretch into a superellipse, just as an ellipse is a stretched circle. (Demo: circle → diamond → square, the Lamé curve.)
When one turn is not enough
A copy is 2π/m wide. If m is whole, m copies fill exactly one turn and the curve closes at φ = 2π. If m = p/q is a fraction in lowest terms, the curve closes only after q turns, at φ = 2πq. m = 2.5 = 5/2 needs φ up to 4π: 5 copies spread over two turns, crossing each other. (Demo: m = 2.5 needs 4π to close traces φ from 0 to 4π with a moving point.)
| m | n₂ = n₃ | n₂ ≠ n₃ |
|---|---|---|
| whole, even (4, 6) | 2π | 2π |
| whole, odd (3, 5) | 2π | 4π |
| p/2, p odd (2.5, 3.5) | 4π | 8π |
| not a fraction | never closes | |
During a morph m passes through values like 2.37 that are not simple fractions. The page draws those frames over a fixed range, and the orange dot shows where the open end is. Curves that close only after many turns are also how a spirograph and a Maurer rose get their patterns.
For another curve built from a few simple pieces, see the heart curve.
What the page leaves out
The a and b parameters (kept at 1), so no stretched superellipses; n₁ = 0 (the power −1/n₁ is undefined); m above 20; the 3D superformula, which multiplies two of these curves to make a surface (shells, flowers, leaves); fitting the formula to real leaves and cells, which is what Gielis used it for; and the curve's area, length and curvature. The parameters are picked from lists, so there is no typing.