10 November 2007

The Menger sponge

Zooming in and out on the Menger sponge, from Microsiervos.

You always hear that fractal objects are "self-similar" (that's what makes them fractal) but it's hard to get your head around that if you're looking at an ordinary drawing, since intuitively you think that the "small" parts are somehow qualitatively different than the "big" parts. But that's not really true. And this video illustrates that quite vividly -- as you zoom into the Menger sponge it very clearly looks the same on smaller and smaller scales.


Pseudonym said...

Unfortunately, there's one problem with this visualisation: The Menger sponge has zero volume. And as you produce visualisations with higher and higher orders, it starts to really show. Very high-order visualisations look like essentially nothing!

Anonymous said...

Pseudonym, do you mean that you should be able to see through the sponge? Because I'm pretty sure that's not the case.

KlinikBahasa said...

Nice blog
please visit
thank you

Pseudonym said...

John: If light travelled in straight rays, you'd see right through it, yes. Many people have done this by computer, and that's pretty much what you see. (If you don't believe me, consider that the sponge has zero volume.)

In the real world, it's a bit more complicated. One of the first things that you'd notice as you made higher and higher-order Menger sponges is that there's a point beyond which the whole thing would look black regardless of what it's made of. (That's the point where the width of each piece is smaller than the wavelength of visible light.)

Also, because it has a regular structure, I suspect it'd start acting like an optical waveguide.

It'd be cool to find out, actually.

Anonymous said...

Many people have done this by computer

That's enough to make me suspicious right there. Here's my thought, sans proof.

We obtain the sponge as follows: start with the unit cube, with each coordinate written as its infinite trinary expansion (no infinite train of 0s at the end). Then at step n we remove all the points with two coordinates having a 1 at the nth trit. What's left is all triples of infinite sequences of trits with at most one 1 at any given position.

Now take a generic vantage point and draw all straight lines through the cube. Your assertion is that the collection of lines which hit any of the above points is of measure zero. I'm not so sure that this is the case, but I don't have a proof offhand. However, now that I've put the statement in a rigorous form, maybe some enterprising reader can supply a proof one way or the other.

Pseudonym said...

John: That's fair. I didn't mean to make a claim in a rigorous form like that.

All I claim is that the sponge starts to disappear at high orders when you try to visualise it using standard computer graphics techniques.

Michael Lugo said...


the claim might be that the set of such lines is of measure zero, or it might be that there are no such lines. I haven't actually tried to think about this.

Michael Lugo said...


the claim might be that the set of such lines is of measure zero, or it might be that there are no such lines. I haven't actually tried to think about this.

Anonymous said...

Isabel, clearly there are some such lines. Just pick a point you know is left over and draw a line to it. Really, there are a lot of such lines. The question is whether they tend to all overlap when we project them generically onto the observer's sphere.

Michael Lugo said...


like I said, I hadn't thought too hard about it...

anyway, the projection of the Menger sponge onto any of the coordinate planes is the Sierpinski carpet, which has measure zero in the plane. But what does the projection of the Menger sponge onto other planes look like? In particular, do they have positive measure (meaning that you can't "see through" the cube from directions normal to those planes)?

My guess is that for most planes P, the projection of the sponge onto P has positive measure, but I have no justification for this; the zero-measure thing seems to arise from the fact that points in the sponge have the same projection. It seems like it would be easier to arrange this if the (unit) normal vector to P has rational components, but most vectors don't have rational components.

Of course, in order for the projection of the sponge onto P to have positive measure, it would have to have (Hausdorff?) dimension 2. The Hausdorff dimension of the Menger sponge is (log 20)/(log 3) = 2.72..., and my instinct is that projections lower dimension by one; but the Sierpinski carpet, which is a projection of the Menger sponge, has Hausdorff dimension (log 8)/(log 3) = 1.89... so this isn't true. (Conjecture: projection lowers the Hausdorff dimension by at most one.)

(In case it's not obvious, I'm assuming your hypothetical viewer is at infinity.)

David Makin said...

Thanks for featuring my video !
Apologies for the poor quality but I can't control what YouTube do once uploaded.

As to whether the Menger Sponge is invisible at infinite resolution or not I'm not sure but the problem of visualising it on computer is common to just about any fractal - all are limited views of an infinite form, all you can do is work to a given display resolution.

My formula for Ultrafractal that produced the zoom was set to automatically increase the detail level as the magnification increased.

Anyone interested in the formula can find it in mmf4.ufm in the Ultrafractal Formula Database here:


It can render general affine IFS or RIFS and the file also includes a 2D RIFS formula and a formula for Strange Attractors.

You don't need UF just to look at the program/algorithm as the .ufm file is just a text file but obviously the easiest way to try the formulas out is to download Ultrafractal:


Ian Mallett said...

As a simple thought experiment, you can see that for some rays, you will not be able to see through the cube. However, it will also not hit anything either. If we're zooming in to a place such as in the video, the normal of the surface flips as n increases. I.e., at infinite n (true fractal), the face a given ray hits is undefined.

David Makin said...

Further apologies for the quality of the video - YouTube have made it even worse since they added the HD options, I don't know what they've done exactly but this link will give you a better quality animation:

Unknown said...

Clearly the only object that one can see 'right through' (i.e. no infinitesimal light ray hits the object) is the empty set.

The problem of whether the 'space of light rays that pass right through' has full measure in the 'space of light rays' is an entirely different one..

Take for example the real line floating in space, but with all irrational numbers removed. The 'set of light rays that don't pass through this rational line' has measure 0, however I'm not sure we could could see through as such!

Besides, could any light ray pass through an infinitesimal gap? This is a nonsensical question, but i'd guess the answer to the finite version of the question would be negative once the size of the gap gets too much smaller than the wavelength of that light ray?