So I’m teaching my son and three of his friends Physics. We gather one night every other week for two and a half hours and I talk Physics. Its a mix of explaining stuff, drawing pictures on our sketchboard, writing equations, working through problems and doing demos.

We’ve had three sessions so far and were doing some basic kinetics: velocity acceleration, force, kinetic energy. The last session was about rotational energy. The demo is watching things roll down a ramp: marbles of different weights and sizes, pieces of pipe, coins, washers and hot wheels cars. For the record, the hot wheels car beats the marble which beats the coin which beats the pipe, all because of the differing shape factors in the calculation of the moment of inertia. So far so good.

Anyway, I’ve resolved not to use calculus for any of the explanations. But my brain seems to be hard wired for thinking about this kind of physics in terms of the calculus approach, and I struggled with how to teach all those calculus ideas without the calculus itself, and how to let the kids have some access to calculation as a part of the physics learning.

Then I remembered about the Monte Carlo technique for calculating pi, and something deep inside my brain clicked: If I could teach the kids how to calculate pi by throwing darts, I could teach them about all the calculus ideas in kinematics without any calculus. Here’s how the story goes:

Lets say you put a square with a circle inscribed in it up on a dartboard. Or if you are good at darts, lots of little circles lined up in a square like this:

circles and square.jpg

Now, throw a dart at the dartboard. Stand far enough back so the dart lands randomly either inside one of the circles or not inside one of the circles. What’s the probability that the dart lands inside a circle? It is the same as the ratio of the area of a circle of diameter 1 to the area of a square of side length 1, or pi / 4.

OK, you aren’t impressed, because throwing one dart doesn’t tell us much about pi: Instead pi is telling us something about that one dart. However, throw enough darts so that 100 darts land inside the square, and I’ll bet somewhere between 75 and 82 of those also landed in one of the circles. Do it 10000 times, and between 7800 and 7900 darts will hit a circle. The more darts you throw, the closer the ratio will get to pi / 4.

OK, you still aren’t impressed, because no one would ever throw thousands of darts and the paper would get pretty ragged after all those darts. And some would land on the line and your friend Mike would say ‘inside the circle’ and you’d say “no, outside the circle” and then Chris would call ‘do-over’ and then someone would call for more cowbell and then where would you be?

But the point is that with computers there’s no need to actually throw darts — you can use the random number generator in JavaScript or AppleScript and get the same result. Here’s an apple script which calculates pi only with random numbers:

to getRandomDecimalBetween(min, max)
  set diff to max - min
  return (min + diff * (((random number from 1 to 50000) - 0.5) / 50000))
end getRandomDecimalBetween

set hitsInCircle to 0
set n to 10000
repeat n times
  set x to getRandomDecimalBetween(0, 1)
  set y to getRandomDecimalBetween(0, 1)
  if ((x * x + y * y) < 1) then -- point (x,y) must be inside the circle
    set hitsInCircle to hitsInCircle + 1
  end if
end repeat

set approximatePi to (4 * hitsInCircle) / n

and here’s a javascript version.

Essentially what the script does is choose a random point in a square on the xy plane with x and y both between 0 and 1. If x^2 + y^2 is less than 1, then the point counts as being inside the circle.

Now you are impressed, but are wondering how does this relate to physics? And the answer is that you can use the same technique to do “integrals” of some property of interest. So for example, if you want to calculate the moment of inertia of a body analytically, you do this integral (thanks wikipedia):


Which is ugly even for me, and I know what it means. But for a bunch of kids that don’t know calculus but can write a little script, its not hard to explain how to throw darts into a 3D space, and if you hit something, use the equations they learned the last time to calculate the kinetic energy of that little bit of the object rotating around some axis. That’s part of the homework I gave them this week. We’ll see if they come up with the right answers.