Welcome to another Mathologer video. As a
gentle intro to what I'll do today. Here's a bit of a warm-up exercise. Here
two circles the smaller one half the radius of the larger one. The red dot
marks a point on the circumference of the smaller circle. Now imagine that the
smaller circle rolls around inside the larger one. What curve will be traced by
the red dot? Think about it for a second. You think you've got it? Well let's see.
As you can see the dot traces a straight line. Pretty cool, huh?
So you can draw a line using circles. Who would have thought. This little miracle
is called the Tusi couple and is named after the 13th century Persian
astronomer and mathematician Nasir al-din al-Tusi. I probably mucked that one
up, right. Okay, so today's video is all about the mathematics of combining circular
motions and it's rich history, from early models of the universe to the modern
theory of Fourier analysis. A special highlight will be the reconstruction of
the mysterious Homer Simpsons orbit discovered in 2008. Just wait. Okay let's
really get going by considering the orbit of our Moon around the Sun. Well we
all know that the Earth travels around the Sun on a roughly circular orbit, that
the Moon travels around the Earth also on a roughly circular orbit, and that
there are 12 and a bit lunar months in a year. Based on these three facts try to
picture the orbit of the Moon around the Sun. You've got it? Well let's see. In this
picture the Moon is between the Sun and Earth and so we're dealing with a new
moon. Fast forward one lunar months and we have a new moon again. There are 11 more
lunar months left in the year until Earth completes its trip around the Sun.
So in total we get this very pretty picture of the orbit of the moon, with 12
distinctive loops corresponding to the twelve months of the year. Right? Wrong!
The moon's orbit looks nothing like this. Yes, yes we should be using ellipses not
circles, the year's not exactly 12 lunar months long, the two orbits are
not exactly in the same plane, and so on. But none of that
gets to why our picture is really misleading. What has really mucked up our
picture is that relatively the earth-moon distance is much much, much
smaller than we've indicated. Okay so let's be honest, stop cheating and
shrink our moon's orbit. Shrink, shrink shrink and there the loops are gone
and have turned into sharp cusps. So is that what our orbit looks like? Nope, we
have to keep shrinking. As you can see the orbit now has shallow waves but
we're still not there. Let's keep on shrinking. So what we've got finally is a
convex curve with no indentations that looks like a regular 12-gon with rounded
off corners and that really is what the orbit of the moon around the Sun looks
like, just even more rounded and circle like than the curve in our picture.
Pretty surprising isn't it. Well it gets even more surprising. It turns out that
our moon is the only moon in the solar system with a convex orbit. The orbits of
all the other moons are of the wavy and loopy types. In fact because of this
planet like orbit some experts consider the Earth and the Moon as a double
planet and not as a planet moon system. Okay, let's now have a closer look at our
simplified Sun-Earth-Moon setup. In our system the Earth and the Moon circle
around at constant speeds but what if we vary those speeds (and the radii of the
orbits)? What other orbit shapes are possible? For a really extreme example, the orbit can be a
line segment. Yes that coin rolling business that I showed you earlier can
also occur in this setting. Here the moon is the red point on the rim of the
rolling circle and the planet is the center of this little circle. But this
rolling coin setup also may remind you of some very famous toy. Starts with an S
rhymes with a why-rograph. Well, yes it's a spirograph. Wow, that was bad :) All spirograph curves are possible moon
orbits and you're all probably aware of the amazing variety of such curves.
Here are some particularly remarkable ones. You get perfect ellipses when you keep
the size of the little circle the same but move the moon to the inside of the
circle. In fact, any shape ellipse can be obtained in this way. Now change the
rolling circle to be one-third the size of the big circle and we get a pretty
good approximation of an equilateral triangle. Then with the rolling circle
one fourth the size of the big circle we get a pretty squarish orbit. So,
conceivably, there's a moon somewhere in the universe that moves around its Sun
on an essentially square orbit. That's pretty amazing, isn't it? Now what if the
moon itself has a mini moon? Astronomers seem pretty certain that at least in our
solar system there's no such thing. But, of course, mathematicians don't have
to worry about reality. If we want a mini moon of a moon we just create a
virtual one. What then is possible in terms of orbits of mini moons of moons
or mini mini moons of mini moons of moons? Well let's have a look at this.
Here's a chain of 1,000 nested mini moons at work, each one moving at some
constant speed around its maxi moon and the minniest of the moons follows an
orbit in the shape of Homer Simpson. This classic animation is the work of
Santiago Ginnobili. Now that is really, really, really amazing, don't you agree?
You'd figure if we get a mini moon to travel on a Homer path, then we can get
it to do pretty much anything, right? And that's true, any reasonably nice
closed curve can be traced by an orbit of a mini moon.
Actually, we can do even more. Any such loopy curve can be travelled along in
infinitely many ways, slow in some parts and fast in others, going back and forth
over the same part of the curve, and so on. And every one of these travel
variations can be replicated by one of our moon systems. Usually
to get things mathematically spot-on you'll need infinitely many moons. But
even with finitely many moons you can get as close to spot-on as you want. The
orbits of moons and mini moons are usually called epicycles and epicycle
mathematics has been used for millennia to describe complicated motions. It dates
back to Ptolemy and the other ancient Greek astronomers who used epicycles
and other tricks to describe the apparently crazy motions of the planets as observed
from Earth. Most of us picture these old geocentric models of the solar system as
being very simple like this. So Earth in the center with the moon, the planets and
the Sun moving around it on concentric circles. However every one of the planet
circles really stands for a much more complicated orbit. For example, Mars's
orbit in the Ptolemaic system looks something like this.
Essentially this is an epicycle orbit with a little extra tinkering thrown in
to actually make this into a reasonably predictive model. Copernicus's
revolutionary system supposedly swept away much of the complication of the
geocentric models by placing the Sun at the center of the solar system. This part
of the story is also usually illustrated with a simple picture of concentric
circles. However, just like Ptolemy and his greek mates, Copernicus also resorted to epicycle acrobatics to fine-tune orbits of the
planets. In fact Copernicus's model of planetary motion wound up being at least
as complicated as the Greeks' geocentric systems, and no more accurate. Just to
give you an idea, here's a drawing that illustrates the motion of Mars
according to Copernicus. Without going into details, doesn't it look even more complicated than the model for Mars in the Ptolemaic
system that we looked at before. Well does to me :)
Of course what was really needed was replacing all the circles within circles
by fundamentally different geometry: the elliptical orbits introduced by Johannes
Kepler 60-odd years after Copernicus. Anyway epicycle mathematics is ages old,
even if it's not the simplest approach to studying the heavens. However it was
only at the beginning of the 19th century that the great French
mathematician Joseph Fourier published a paper that led to a proper understanding
of the possibilities of epicycle mathematics and it's incredible
usefulness outside astronomy. Today this branch of mathematics is called Fourier
analysis. For the more technically inclined among you I will now show you
how you can make your own epicycle drawings of whatever takes your fancy
and I'll show you how the epicycle systems underlying these drawings can be
reconstructed using complex Fourier series. It gets a little detailed later,
so feel free to bail out at any point. Okay so down to work on our very
important question: how to draw Homer Simpson just using epicycles? And how
would you naturally go about finding the answer to this question? We all know,
right? Google Homer and epicycle. If you do, you won't be disappointed. It
turns out that this exact question was recently posted on the Mathematica
stackexchange by someone writing under the pseudonym Anderstood. Then Anderstood
followed up with an answer including the Mathematica code and
explanations. Really brilliant stuff. Let's have a look. As a warm-up
Anderstood describes how to use epicycles to draw the outline of an
elephant. Starting with just a jpeg of a silhouette to pin down the curve
Anderstood first generates a set of roughly equally spaced points along the
perimeter of the silhouette. Then he interprets the coordinates of these
points as complex numbers and uses the so called discrete Fourier transform to
calculate epicycle approximations of the silhouettes in terms of complex Fourier
series. Very fancy and very scary words but it's all pretty standard stuff.
Nothing to panic about yet, promise. The blob at the top was drawn using 20
epicycles. Maybe not so impressive though if you squint a little it has a vague
elephantine feel to it. But the bottom picture drawn using 100 epicycles is
most definitely an elephant. It all works really
well and I've gone on to use Anderstood's code to generate epicycle approximations
to various silhouettes. So have a guess what's being drawn here. (music playing) Back to Anderstood. After elephanting he
tackles Bart Simpson. So he starts with the drawing over there and his final
output looks like ... wait for it ... this :) So really pretty good.
Unfortunately the bits of code Anderstood provides for also capturing
strokes inside the outline don't work straight off the page. There's also a bit
of a systemic problem with the centers of the epicycles in the animations being
wrongly placed. Having said that all the ingredients are basically there and it
wasn't too difficult to adapt Anderstood's code and ideas to also reverse-engineer
the Homer animation. Just really quick here's what I did. So what I did it was I
grabbed the screenshot of the original video and cleaned it up in Photoshop and
Illustrator. Then, again in Photoshop, I made a low-res version of this drawing
in which the outline is drawn as strings of pixels. This is where Mathematica
enters the picture for me and you can have a close look at what exactly I do
by inspecting my Mathematica notebook linked in from the description. So using
Mathematica I generate a list of the coordinates of all the pixels in this
picture, all the black ones. Now we have to order the list of coordinates
such that the corresponding points appear in the order in which we want to
trace them. Here Anderstood uses a very neat trick. He unleashes the command
FindShortestTour on the list. What this does is it attempts to solve the Traveling
Salesman problem for our set of points, that is, it tries to create the shortest
round trip that comprises all our points and puts them into the corresponding
order. Here's what this round trip looks like. So this is one continuous loop
which visits every pixel in our outline exactly once.
It's a somewhat quick and dirty solution which includes some undesirable
artefacts but it gets us there in finite time which is great. Now from here we can
just use exactly the same code as for the elephant to generate the animation.
Not bad, huh, and if you're keen on something smoother,
it's just a matter of more accurately generating a string of points that
indicates more exactly how you want the original picture traced. Then you feed in
the corresponding coordinates and the program does its epicycle magic. Okay
here's a challenge for you. Get creative and come up with some
epicycle animations of your own and link them in via a comments below. The
contribution I like best wins a copy of Marty and my latest book, that one there.
Okay, in the rest of the video I'd like to really show you how these systems of
epicycles are constructed and for that let me just give you a crash course in
Fourier series. Should be easy, right? Well it's actually not bad and it's beautiful
stuff. So to begin I have to remind you of Euler's formula which has already
appeared in about about a thousand Mathologer videos. So e to the i t is
equal to cos t plus i sine T. Euler's formula amounts to a very compact way of
tracing or in maths lingo parametrising the unit circle in the complex plane. to
see what I mean have a look at this picture there so the red point on the
unit circle is the complex number cost t plus i sine t. That's the right side of
Euler's formula, right? As we let the angle t go from 0 to 2pi, the red point
traces out the unit circle but now Euler's formula tells us that the red
point is also e to the i t. So, for example, setting t equal to pi, that is,
making a half turn, the red point moves to ... -1, of course. So e^i pi =-1,
most mathematicians favourite identity. And,
setting t equal to 0 we get e^0 is equal to 1 which of course
is no surprise. Just to say it again, as we let t go from
0 to 2 pi the red point travels around the unit circle once in the
counterclockwise direction. Now let's write -t instead
of t. So e^-it. This corresponds to traversing the circle
once in the opposite, the clockwise direction. And if we write 2t instead
of t this corresponds to traversing the circle twice in the counterclockwise
direction as t goes from 0 to 2 pi. And if you write 3, three times, and
so on. Here's another important observation.
Let's multiply our circle exponential by 4. What does this correspond to? Think
about for a moment.... Easy, right? Here we are traversing a circle of radius 4.
Another way of expressing this is to say that we traverse a circle through the
complex number we multiply by, in this case the number 4, starting and ending
at this number. That sounds complicated but what's nice about this way of
looking at things is that this stays true for all complex numbers, not just
real numbers, like 4. So, for example, if we multiply by the complex number 1+i
we're now traversing the circle starting and ending at 1+i. Okay,
as we will see in a moment, it's expressions of this form: complex
number times e^i times some integer times t that stand for the
different epicycles produced by the magical Fourier machine. And what is the
source of the magic of the magical Fourier machine? It's a very simple property of
these exponential expressions. It turns out that the integrals of these
exponential's from 0 to 2 pi are always equal to 0. Whoa, where did that one come
from? And how can I possibly claim that this is very simple? Well, it is actually easy
if you know a little calculus. Basically it's a straightforward symmetry argument:
any complex number we come across as t goes from 0 to 2 pi is canceled out by
its negative which we'll also come across. Maybe one of you can fill in the details
in the comments. Otherwise, just take my word for it for
the moment. Okay, so now we are ready to reveal the inner workings of the magical
Fourier machine. Let's say what we want is to trace this outline of the letter pi
at a constant speed as shown. So feeding this to the magical Fourier
machine will create a chain of infinitely many epicycles whose limit
moon will do exactly the tracing we're after. Here we go. If we only use the
first few epicycles, then the last moon in this finite chain will trace an
approximation of our pi outline and the more epicycles we use the better our
approximation will be. For example, just using the first four epicycles gives this
orbit here. Using six epicycles will give this. Here's the output from eight
epicycles, and so on. Let's now have a close look at the tracing produced by
the first four epicycles, this one here. Here we go in slow motion. Mathematically
what you see here is represented by this sum here. There's one term for each of
the four circles which I've colour-coded, plus the term at the top. So what we have
here is a straightforward sum of the four individual circular motions. The
extra term on top is the complex number that represents the black anchor point. Now let's have a closer look at the
exponent of e in these terms. For the blue circle, the exponent is 1 times i t
Then -1 i t for the purple circle, 2 i t for the
orange circle and, finally, -2 i t for the red circle. The
pattern's obvious next in the infinite sum would be 3, -3, 4, -4, and so on,
every integer appearing exactly once. Except, ... well there is no
0, right? Well, actually, the 0 is there, just in disguise. Here it is. e to
the power of 0 is 1. So the infinite sum that exactly captures the motion
we're after is of this form here. So we're producing a doubly infinite
sum. Nifty if also a little scary, hmm. Just to reiterate, the t in everything
we're doing ranges from 0 to 2 pi and because we're tracing closed curves
starting and ending at the same complex number the value of the sum is the same
at 0 and 2 pi. This means our sums are periodic functions from the interval 0
to 2pi to the complex numbers and so here's another way of expressing what
Fourier's magical machine does. The Fourier machine rewrites any sufficiently nice
periodic function f(t) from the interval 0 to 2pi to the complex numbers
as this sort of two-tailed infinite sum. That's great but how do we find those
infinitely many complex coefficients that precisely pin down our epicycles.
Well that's where the real magic is hidden. Let me show you how you can find
one of these coefficients, let's say c_2, the coefficient in front of e^2it. Let's zoom in on the three terms around this coefficient. To get rid
of the e^2it next to the c_2 we multiply our equation by e^ -2it.
Now let's switch to algebra autopilot. (music playing) Okay, at this stage every single term of our infinite sum except for the one we are
focusing on features an exponential factor. Now we can use the key
integration factor that I mentioned earlier to obliterate all the terms except for
c_2. Ready for the integral magic? Here we go. There it is. Remember I told you
earlier that all these integrals are equal to 0 and so what's left on the
right is this. But the green integral is just equal to a 2 pi. Dividing through we
find an expression that allows us to calculate c_2. And, of course, the exact
same trick works for all the other coefficients as well. And so, on input of
a tracing f(t) Fourier's magical machine calculates these coefficients, each one
exactly specifying one of our epicycles. And here I take a bow to professor Fourier.
Absolutely amazing stuff. Of course I've glossed over a heap of
details here, but really only details. Maybe some of you in the know can
supplement a bit of a discussion of when exactly this works and what can go wrong.
There's also still the question of how you actually use this magic machine in
practice. How you use it depends very much on how you're tracing, the function
f(t) is given to you. If it comes in a nice form, you may be able to evaluate
all those integrals. On the other hand, if, as in the case of our Homer drawing, we
are given an approximation of our tracing by a sequence of points in this
case there are specialised tools that take these sequences of points as input
and produce very good approximations of these integrals. In particular, Anderstood
in his Mathematica program uses the so called discrete Fourier transform. A
different approach is illustrated in a very nice video by GoldPlatedGoof. Also
very much worth checking out. Okay so all under control in terms of epicycle
mathematics. But what has all is to do with all those real-life applications of
Fourier series that you may have heard of. Everything :) Just as a bit of a teaser,
the animation below illustrates that the famous representation of a square wave
as a sum of sine functions is really nothing but the imaginary part of a very
pretty system of epicycles. Hopefully I'll eventually get around to dedicating
a few more videos to this incredibly beautiful circle of ideas. Anyway I hope
you enjoyed this video as much as I enjoyed making it. And that's it for
today.
This was just amazing. Best math channel as far as ingenious and really usable explanations go.
Trump with epicycles lol.
That's my old lecturer. He had such an obvious passion for maths, it was really hard not to be excited by it. He would always play maths references from movies in place of doing worked examples though.
For which functions [0,2pi] βC does this work? Is continuous enough?