User Rating 0.0 โ˜…โ˜…โ˜…โ˜…โ˜…
Total Usage 0 times
0 = full bar, 10 = 1024 segments
Fraction of each segment removed from center
Presets:
Is this tool helpful?

Your feedback helps us improve.

โ˜… โ˜… โ˜… โ˜… โ˜…

About

The Cantor Set, introduced by Georg Cantor in 1883, is constructed by iteratively removing the open middle third of every line segment. Starting from the unit interval [0, 1], the first iteration yields [0, 1/3] โˆช [2/3, 1]. After n iterations, 2n segments remain, each of length (1รท3)n. The resulting set is uncountably infinite yet has Lebesgue measure zero. Its Hausdorff dimension equals log2 รท log3 0.6309. Miscounting iterations or misunderstanding the recursive removal can lead to incorrect fractal dimensions in academic work.

This tool computes the Cantor Comb (the two-dimensional visualization where each iteration level is drawn as a horizontal row of bars) up to 10 iterations (1024 segments). The rendering is exact. Bar widths at depth n are computed as W ร— (1รท3)n where W is the total canvas width. Note: at iterations above 8, individual segments become sub-pixel on standard displays. Export at high resolution for print use.

cantor set fractal generator cantor comb math visualization fractal art set theory recursion

Formulas

The Cantor Set is defined by recursive interval removal. At each step, the open middle third of every remaining segment is deleted.

C0 = [0, 1]

Cn+1 = Cn3 โˆช (2 + Cn3)

The total measure remaining after n iterations:

Ln = (23)n

Hausdorff dimension:

dH = log 2log 3 0.6309

Where Cn is the Cantor set at iteration n, Ln is the total Lebesgue measure (length) of remaining segments, and dH is the Hausdorff (fractal) dimension quantifying the self-similar scaling.

Reference Data

Iteration nSegments 2nSegment Length (1/3)nTotal Length RemainingRemoved FractionGaps Created
011.0000001.0000000.0%0
120.3333330.66666733.3%1
240.1111110.44444455.6%3
380.0370370.29629670.4%7
4160.0123460.19753180.2%15
5320.0041150.13168786.8%31
6640.0013720.08779191.2%63
71280.0004570.05852894.1%127
82560.0001520.03901896.1%255
95120.0000510.02601297.4%511
1010240.0000170.01734298.3%1023
โˆžUncountable00 (measure)100%Dense

Frequently Asked Questions

At iteration n, total length is (2รท3)n, which converges to 0 as n โ†’ โˆž. However, the set's cardinality matches the real numbers. Every point in the Cantor Set can be expressed in base-3 using only digits 0 and 2, establishing a bijection with binary sequences on [0, 1]. Zero measure does not imply countability.
Segment pixel width equals W ร— (1รท3)n. For W = 1920px, segments drop below 1px at n = 7 (width โ‰ˆ 0.88px). For visual clarity, iterations 0 - 6 are optimal. Beyond that, use the high-resolution export option.
The Hausdorff dimension dH = log2 รท log3 quantifies self-similarity. A value between 0 (point) and 1 (line) means the Cantor Set is "more than a collection of points but less than a line segment." Visually, it appears as a dust that thins but never fully vanishes.
Yes. This generator uses the classical middle-third removal. A generalized Cantor Set removes a fraction r from each segment's center. The Hausdorff dimension becomes log2 รท log(2 รท (1 โˆ’ r)). For the Smith-Volterra-Cantor set (r varying per level), the measure is positive. This tool supports custom removal ratios via the ratio slider.
The Cantor Comb is a 2D visualization: each iteration level is drawn as a horizontal row of bars stacked vertically, resembling comb teeth. Cantor Dust is the Cartesian product of two Cantor Sets, producing a 2D point cloud with Hausdorff dimension 2 ร— log2 รท log3 โ‰ˆ 1.2619. They are fundamentally different objects.
At iteration n โ‰ฅ 8, segment widths fall below 1px at standard canvas resolution. The browser's sub-pixel rendering interpolates colors, producing gray anti-aliased lines instead of crisp bars. Use the resolution multiplier (2ร— or 4ร—) to increase the canvas backing store, ensuring each segment spans multiple device pixels.