How to Dance with a Tree: Visualizing Fractals With Dance

Here’s a fun project that my friend Upasana and I put together some weekends ago. It’s a visual exploration of fractals through dance, a piece of generative art that’s part performance and part mathematical exploration.

The two ingredients that went into creating this were the Microsoft Kinect sensor, which lets your computer track how your body moves, and Processing, a programming language that lets you create interactive visuals with code. Put the two together, and you can use your body to control virtual shapes and objects.

The idea for this project came about while I was walking home from work late October, idly watching the recently bare tree branches swaying in the wind. And for some reason that made me wonder, what would it be like to be a tree for an evening? Imagine lifting your arms, and a tree waves its branches.

And then I remembered reading about fractals in Daniel Shiffman’s book Nature of Code. Fractals are those wonderfully intricate structures that look the same as you keep zooming in to them. Benoit B. Mandelbrot was one of the earliest explorers of the fractal world. He coined the word fractal to mean a kind of geometric shape whose parts resemble “a reduced-size copy of the whole.”  (Some fractal humor: What does the B in Benoit B. Mandelbrot stand for? Benoit B. Mandelbrot.)

At the heart of being a fractal is self-similarity, the idea that each piece appears similar to the whole. Think of how a coastline on a map appears similarly wrinkly across different levels of zoom. The same could be said of the jagged terrain of a mountain.

Or picture the ever branching paths that lightning follows as it travels down to the Earth.

When high voltage electricity passes through an insulator, it branches out in fractal like patterns.  Bert Hickman / Wikimedia

Or the nested arrangement of leaves within a fern.

Sanjay ach / Wikimedia

Or the buds in a head of Romanesco broccoli. Each bud contains smaller buds upon it, arranged in the same spiraling pattern.

Fractal Brocolli Jon Sullivan / Wikimedia

From coastlines to broccoli, and lightning to trees, many of nature’s patterns are better described by fractals than by the usual cast of shapes like lines, circles, and triangles. (In the real world, objects can only be roughly fractal, at some level of zoom the repetition will end. But in mathematics, the self-similarity of fractals continues forever.) Continue reading How to Dance with a Tree: Visualizing Fractals With Dance

How a 19th Century Math Genius Taught Us the Best Way to Hold a Pizza Slice

Why does bending a pizza slice help you eat it?  Let Gauss be your guide to the math of the 'fold hold'.
Why does bending a pizza slice help you eat it? Dig in to the math of the ‘fold hold’. Aatish Bhatia

We’ve all been there. You pick up a slice of pizza and you’re about to take a bite, but it flops over and dangles limply from your fingers instead. The crust isn’t stiff enough to support the weight of the slice. Maybe you should have gone for fewer toppings. But there’s no need to despair, for years of pizza eating experience have taught you how to deal with this situation. Just fold the pizza slice into a U shape (aka the fold hold). This keeps the slice from flopping over, and you can proceed to enjoy your meal. (If you don’t have a slice of pizza handy, you can try this out with a sheet of paper.)

Dangle a sheet of paper and it flops over, but give it a fold and it becomes stiff. Why? Aatish Bhatia

Behind this pizza trick lies a powerful mathematical result about curved surfaces, one that’s so startling that its discoverer, the mathematical genius Carl Friedrich Gauss, named it Theorema Egregium, Latin for excellent or remarkable theorem.

Take a sheet of paper and roll it into a cylinder. It might seem obvious that the paper is flat, while the cylinder is curved. But Gauss thought about this differently. He wanted to define the curvature of a surface in a way that doesn’t change when you bend the surface.

paper cylinder
Aatish Bhatia

If you zoom in on an ant that lives on the cylinder, there are many possible paths the ant could take. It could decide to walk down the curved path, tracing out a circle, or it could walk along the flat path, tracing out a straight line. Or it might do something in between, tracing out a helix.

Gauss’s brilliant insight was to define the curvature of a surface in a way that takes all these choices into account. Here’s how it works. Starting at any point, find the two most extreme paths that an ant can choose (i.e. the most concave path and the most convex path). Then multiply the curvature of those paths together (curvature is positive for concave paths, zero for flat paths, and negative for convex paths). And, voila, the number you get is Gauss’s definition of the curvature at that point.

Ants on a (rolled up) plane
Ants on a (rolled up) plane Aatish Bhatia

Let’s try some examples. For the ant on the cylinder, the two extreme paths available to it are the curved, circle-shaped path, and the flat, straight-line path. But since the flat path has zero curvature, when you multiply the two curvatures together you get zero. As mathematicians would say, a cylinder is flat — it has zero Gaussian curvature. Which reflects the fact that you can roll one out of a sheet of paper.

If, instead, the ant lived on a ball, there would be no flat paths available to it. Now every path curves by the same amount, and so the Gaussian curvature is some positive number. So spheres are curved while cylinders are flat. You can bend a sheet of paper into a tube, but you can never bend it into a ball.

ant on a ball
Aatish Bhatia

Gauss’s remarkable theorem, the one which I like to imagine made him giggle with joy, is that an ant living on a surface can work out its curvature without ever having to step outside the surface, just by measuring distances and doing some math. This, by the way, is what allows us to determine whether our universe is curved without ever having to step outside of the universe (as far as we can tell, it’s flat).

A surprising consequence of this result is that you can take a surface and bend it any way you like, so long as you don’t stretch, shrink or tear it, and the Gaussian curvature stays the same. That’s because bending doesn’t change any distances on the surface, and so the ant living on the surface would still calculate the same Gaussian curvature as before.

This might sound a little abstract, but it has real-life consequences. Cut an orange in half, eat the insides (yum), then place the dome-shaped peel on the ground and stomp on it. The peel will never flatten out into a circle. Instead, it’ll tear itself apart. That’s because a sphere and a flat surface have different Gaussian curvatures, so there’s no way to flatten a sphere without distorting or tearing it. Ever tried gift wrapping a basketball? Same problem. No matter how you bend a sheet of paper, it’ll always retain a trace of its original flatness, so you end up with a crinkled mess.

You can't flatten an orange without tearing it, because a sphere and a flat surface have different Gaussian curvatures.
You can’t flatten half an orange without tearing the peel, because a sphere and a flat surface have different Gaussian curvatures. Aatish Bhatia

Another consequence of Gauss’s theorem is that it’s impossible to accurately depict a map on paper. The map of the world that you’re used to seeing depicts angles correctly, but it grossly distorts areas. The Museum of Math points out that clothing designers have a similar challenge — they design patterns on a flat surface that have to fit our curved bodies.

globe to map
Equal sized circles drawn on a globe become distorted on an atlas.  Stefan Kühn (left), Eric Gaba (right) / Wikimedia

What does any of this have to do with pizza? Well, the pizza slice was flat before you picked it up (in math speak, it has zero Gaussian curvature). Gauss’s remarkable theorem assures us that one direction of the slice must always remain flat — no matter how you bend it, the pizza must retain a trace of its original flatness. When the slice flops over, the flat direction (shown in red below) is pointed sideways, which isn’t helpful for eating it. But by folding the pizza slice sideways, you’re forcing it to become flat in the other direction – the one that points towards your mouth. Theorema egregium, indeed.

Who knew differential geometry could be so delicious?
Who knew that geometry could be so delicious? Aatish Bhatia

Continue reading How a 19th Century Math Genius Taught Us the Best Way to Hold a Pizza Slice