🌿 IFS Fractals — Iterated Function Systems

An Iterated Function System is a finite set of contractive affine maps. The chaos game algorithm — start anywhere, repeatedly apply a randomly chosen map with its given probability — reveals the IFS attractor: a fractal whose self-similar structure emerges from pure iteration. The Barnsley fern uses just 4 maps with carefully chosen probabilities to produce a photorealistic leaf.

🇺🇦 Українська

Preset IFS

Rendering

Stats

Total points0
Active IFSBarnsley
Maps N4
Hausdorff dim.
Chaos game:
x₀ arbitrary
xₙ₊₁ = Wᵢ(xₙ)
where i ~ p(Wᵢ)

Affine map:
W(x,y) = [a b; c d][x;y] + [e;f]

About Iterated Function Systems

The Collage Theorem (Barnsley & Demko, 1986) guarantees that any IFS with contractive maps has a unique compact attractor A satisfying A = ∪ Wᵢ(A). The Hausdorff dimension of the attractor can be estimated from the contraction ratios. IFS are the foundation of fractal image compression: any image can be approximated as an IFS attractor. The chaos game converges to the attractor regardless of the starting point — a consequence of the Banach fixed-point theorem.

About IFS Fractals

This simulation draws the attractor of an Iterated Function System: a finite set of contractive affine maps W(x,y) = [a b; c d][x;y] + [e;f]. It uses the chaos game algorithm — pick a start point, then repeatedly apply a randomly selected map chosen according to each map's probability p, plotting every resulting point. The dense cloud of points converges onto a self-similar fractal regardless of where you begin.

The preset buttons swap the active map set: the four-map Barnsley fern, the three-map Sierpiński triangle, the two-map Dragon and Lévy C curves, a binary tree and a coral form. The Points-per-frame slider sets iteration speed, while the Fade-speed slider controls how quickly old points dim. Clear restarts plotting and Pause halts it. IFS underpin fractal image compression and procedural modelling of plants and natural textures.

Frequently Asked Questions

What is an Iterated Function System?

An IFS is a finite collection of contractive affine transformations of the plane. Each map shrinks and repositions space, and the union of all maps applied repeatedly defines a unique fractal set called the attractor. The Barnsley fern, Sierpiński triangle and Dragon curve are all attractors of different IFS.

How does the chaos game work?

You start from an arbitrary point, then on each step randomly choose one of the maps, weighted by its probability p, and apply it to the current point. Plotting each new point gradually fills in the attractor. The first few points are skipped as warm-up so transient positions off the attractor are not drawn.

What do the controls do?

The preset buttons select which IFS map set is active. Points-per-frame (500 to 30,000) sets how many iterations are plotted each frame, controlling drawing speed. Fade speed (0 to 0.05) dims older points so the canvas can refresh. Clear resets the point count and canvas, and Pause stops or resumes iteration.

Why does the result not depend on the starting point?

Because all the maps are contractive, repeated application pulls any starting point ever closer to the attractor. This is a consequence of the Banach fixed-point theorem applied to the IFS operator on compact sets, so different start points converge to the same fractal.

What is the affine map equation used?

Each map has the form W(x,y) = (a·x + b·y + e, c·x + d·y + f). The coefficients a, b, c, d perform rotation, scaling and shearing, while e and f translate the point. The Barnsley fern, for example, uses four such maps with probabilities of 0.01, 0.85, 0.07 and 0.07.

Why does the Barnsley fern stem map have such low probability?

The first map (probability 0.01) collapses points onto the vertical stem and contributes little area, so it rarely needs to be applied. The dominant 0.85-probability map builds the main frond. Probabilities are tuned to match how much of the attractor each map covers, giving an even, photorealistic fill.

What is the Hausdorff dimension shown in the stats?

It is the fractal dimension of the attractor, a non-integer measure of how the detail scales. The Sierpiński triangle has dimension log3/log2 ≈ 1.585, while the Dragon curve fills area and approaches 2. The displayed values are characteristic estimates for each preset.

Are the displayed fractals mathematically accurate?

The map coefficients and probabilities are the standard published values for each system, and the affine arithmetic is exact in floating point. The visual is a finite sampling, so very fine structure only emerges as more points accumulate, but the converged image faithfully represents the true attractor.

What is the Collage Theorem?

Proved by Barnsley and Demko in 1986, it guarantees that any IFS of contractive maps has a unique compact attractor A satisfying A equal to the union of all Wᵢ(A). It also tells you how to find an IFS whose attractor approximates a target shape, which is the basis of fractal image compression.

Where are Iterated Function Systems used in practice?

They are used in fractal image compression, where pictures are encoded as the maps of an IFS rather than as pixels, and in procedural generation of plants, clouds, terrain and natural textures for graphics and games. Their compactness makes them efficient for representing richly detailed self-similar forms.