# How I Teach Calculus: A Comedy (Programming Loops)

Once, during a math department meeting (the only one I’ve ever actually attended) I mentioned that we should probably stop teaching 90% of what we teach and start using computers to actually do math that’s interesting.^{1}

Later that year, I walked by a classroom that was dividing polynomials by other, albeit lesser, polynomials despite being able to use a computer to be able to circumvent this process entirely by making it absolutely obsolete. The fact that my students can’t vocalize that is the tragedy. (read the section on math battles from *The Story of Sqrt(-1)* by Nahim)

Here’s someone more successful that myself saying the say thing with a cooler accent:

I took some heat in the Global Math Department a few nights ago about this, and I’ve taken some time to think about it. I suppose it comes across as unprofessional to say that certain techniques are “stupid” or “not worth teaching,” but, as was said to me at a party in 2003: “Shit, if I can numerically integrate in Mathematica, why would I ever bother to take Calc 2?” We were those people that have fights like that. Actually, I was just smoking and grilling the ribs and the smart kids were talking about integrals (I failed calculus the first time I took it, and I pretended to understand instead of asking questions; I was NOT a product of SBG)

A bit naive, because those skills obviously inform on an abstract level, but I’m not prepping mathematicians here, I’m prepping humans who need to be able to think mathematically. I literally can’t think of anything more mathematically thinky than teaching a computer how to walk around an ellipse.

A what?

YAY AN EXAMPLE

# Did you know that calculating the circumference of an ellipse is hard to do?

Like, way harder than the circumference of a circle? I didn’t.

I’m just now getting my students into the happy elf-land of angry-about-not-knowing that is pure math, and when this question popped up–from a student!–we were arguing about whether it was worth it to memorize the volumes/surface area formulas for various shapes when a kid accidentally said circumference of an ellipse. Woops!

They got a bit creative. They Googled, but it’s un-googlable! No one knows! The answers the kids found through their usual channel were noteasy.

They tried:

This makes no sense, by units, which was a fun conversation.

We began to talk about ways to circumvent the problem.

How do you measure distance? I walk? I use a map? I get out a measuring tape?

How can we train the computer to do that? And the ellipse-walk was born. Here’s the Processing code:

//estimate circumference of ellipse

float a = 36.0; //horizontal

float b = 9.0; //vertical

float y, x2, y2, d;

float answer = 0.0;for(float i=0.0; i<(a-0.01); i += 0.01){

y = b*sqrt(1-(i*i)/(a*a));x2 = i+0.01;

y2 = b*sqrt(1-(x2*x2)/(a*a));d = sqrt(0.0001+(y2-y)*(y2-y));

answer = answer + d;

}answer = 4*answer;

print(answer);

We have since written programs that do the following:

- Calculate factorials (with a fun talk about ordering nothing, 0!=1)
- Perform Newton’s method for finding zeroes (we were optimizing at the time)
- Perform the Babylonian method (Because it amazes me!)
- Finally, most importantly, DEFINITE NUMERICAL INTEGRATION.

Basically, we’ve done an exercise regimen in looping. Really, I want my students to see computers as a tool to supplement their analytic creativity.

Sometimes you have to pity Issac and Gottfried, really, you did that many iterations by hand?

1. This is crawling the webernets right now, and is awesome. Also, KA is doing some good work with code, but in the end KA still just doesn’t get it. Learning boring shit faster is still, well, you get it.