Sunday, January 30, 2011

I Finally Used Discrete Math!

Twenty-odd years after enduring my Discrete Math course in college, I finally needed to use the modulus concept.

I was trying to get my Logo turtles to make stars by just selecting a number of prongs on a slider button. After a lot of experimenting with the number of degrees the turtles turned I found the formula for how much to turn at the end of each prong in the odd-numbered stars:

180 - 360 / (2 * number of prongs)

It didn't work for the even numbered stars, though. It would leave a half-finished star, as shown below:

But that meant the 12-prong formula was perfect for a 24-prong star. If the number of prongs is even, the formula is:

180 - 360 / number of prongs

So I just had to put in an if-statement: if the number of prongs selected is even, use the second formula, otherwise, use the first. Like this:
ifelse numberofprongs = even
[fd 400 rt 180 - 360 / numberofprongs]
[fd 400 rt 180 - 360 / (2 * numberofprongs)]
But NetLogo doesn't have an "even" condition or value, so how could I get the turtle to do the right thing to even or odd numbered stars?

The answer (for once!) came from the modulus concept in discrete math. It's like dividing by a number and getting a remainder. Every even number is divisible by 2 with no remainder, so that was my way of getting the computer to recognize an even number. This code says, "If the number of prongs is divisible by 2 with a remainder of 0, do the first command. Otherwise, do the second command."
ifelse numberofprongs mod 2 = 0
[fd 400 rt 180 - 360 / numberofprongs]
[fd 400 rt 180 - 360 / (2 * numberofprongs)]
It worked!


Friday, January 28, 2011

Math Through Computer Programming

I remember liking Geometric constructions and proofs in high school, but even for those of us who picked it up quick, a little was enough. Supposedly, geometric proofs teach you how to think logically; there's a story that young Abe Lincoln bought a copy of Euclid and practiced proofs to hone his sharp logical mind. For those students who don't understand proofs, they're unnecessary torture devised by math teachers. And anyway, that was then.

Now there's these things called computers that will do amazing things if you tell them exactly how to do them. The operative word there is "exactly." Computers have been described as "stupid" because they have no common sense; they can't understand what you want them to do unless you tell them every little step and spell everything correctly. To me this is a description of the ultimate logic-learning opportunity.

Years ago I was introduced to the power of computers to teach logical thinking by Seymour Papert's incredible book Mindstorms. Papert and his team developed the LOGO programming language in 1967 and a few years later it was used to instruct robot turtles to draw figures by walking around the floor holding retractable pens. I even bought a robot turtle with the intention of getting it to draw stuff, but never got it to work correctly. The current version of StarLOGO still retains the turtle analogy, but the turtles are virtual and can move lightning fast onscreen.

I've used StarLOGO in classrooms to teach kids how to do simple programming, and at the very least, they're impressed at how cool it is to make the multicolored turtle army zip around leaving trails. As discussed in Mindstorms, just about every idea in math can be approached using the turtles for illustration, and the elementary ideas in computer programming can, too.

One of my favorite things in the book is the idea of the procedure or subroutine. Once you teach a turtle how to make a square, for example, you can save those lines of code as the instructions for how to "square" and instead of typing it all out again you can just tell the turtle, "square." In any program after that, when you need to make a square, one word will bring up the entire "square" subroutine. It might be a lot of work at first, but once you have it, you never have to do all that work again.

The loop is one of the most useful and elegant concepts in all of computing. Teach a turtle to square, then use a loop ("repeat" a number of times) to have it make a square, then turn a little to the right and make another square, and so on. These few lines of code:
to neato
repeat 50 [square rt 5]
end
will produce an unexpectedly complex figure:

Of course, the discovery every student makes about the real process of writing programs is that it never works right the first time! (My figure above didn't, either: it was too big for the window, so I had to go back and shorten the side of the square.) Debugging is an unavoidable task for the novice programmer and expert alike, but some students and adults who are used to getting what they want through interpersonal means interpret these inevitable glitches to mean "the computer hates me."

I was recently reminded of the power of computer programming to teach math ideas by Danny Kodicek's book Mathematics and Physics for Programmers. Cambridge University graduate Kodicek presents math ideas from integers and arithmetic through matrices, calculus and differential equations in ways computer programmers might encounter them in the course of programming video games, for example.

The code in the book is actually pseudocode, since it's a "verbose" style of the "Lingo" language used primarily in Macromedia Director. For a novice programmer like me that doesn't detract from the author's ability to show the logic behind the code for a certain task and also the logic of the "shorthand" that has evolved into actual computer languages.

Just like stepping back and asking myself how I would teach a turtle to draw a square, Kodicek's book made me think about how to rotate the square, and more.

Friday, January 21, 2011

Integration: Undoing All The Work We've Done

This week's topic in The Fun Calculus Program is Integration, which is the same pattern as differentiation, but backwards. It's similar to the way division is doing multiplication backwards: to find 18 divided by 3, you'd think, "What number do I have to multiply by 3 to get 18?" In the Galileo presentation we learned the derivative of x2 is 2x, so the antiderivative (or "integral") of 2x is x2.

The Fun Calculus Program is the only calculus course I'm aware of where students are taught the Fundamental Theorem of Calculus in a way they'll actually remember. Everywhere else you're taught an algebraic proof, which might convince you not to question it. This snapshot from my college calc textbook suggests just how confusing the typical "proof" is, but aren't proofs supposed to clarify the situation?
Using graphing software, my students will actually experience the link between the area under the curve of a function and the antiderivative of the function. I start off graphing a horizontal line (in this case y = 3) and quickly find there's a pattern to the area under the line between 0 and x. It's always three times the ending x-value or y = 3x, so we graph that. That red line is the area function for the purple line y = 3.

The Area Function is very handy for quickly and easily calculating the area under the purple line. The picture shows how to find the area between x = 1 and x = 3. Simply look at the red Area Function: read off the y-value at x = 3 and subtract the y-value when x = 1.

9 minus 3 is 6, which is the area we're looking for.

It just so happens the red Area Function is the antiderivative of the purple line. Coincidence? We then go on to investigate whether it works for diagonal lines and then parabolas, at which point the power of this "geometric proof" becomes evident.

I guarantee the participants in my Program remember the link between the area and the antiderivative at least as well as the average student in a calculus class who have to slog through the n, i, asterisk proof mentioned earlier.

Maybe better!

Tuesday, January 11, 2011

Into The Matrices

I remember working to keep my eyes open during a class in Business Math at Merrimack College; the awkward young professor was teaching us to solve 3x3 matrices using Gaussian Elimination. To this day I have no idea why matrices were included in the curriculum, but nobody ever lost their job making students do something called Gaussian Elimination.

Now I realize without that class I never would have appreciated the power and speed with which handheld calculators can solve even the nastiest matrix equation. A $50 TI or Casio calculator can handle matrices, but I wonder if any high school student can tell me why.

There certainly was one a few years ago, when I tutored a very nice high schooler named Carol whose teacher was making her class solve systems of equations in 3 variables. It's just like finding where two lines cross, but there are x's, y's and z's, like in this system:

10x + 5y + 2z =13

-13x – 4y + z = 3

17x + 3y – 2z = 1

It looks a lot like the graphic on the left. The intersection of all 3 planes might be a line or a point. As you can imagine, using an algebraic method of solving this system would be very complicated, but it is assigned to the average high school algebra class.

Carol's class was one of those; she had more than one system to solve, so after we found out how laborious the solution would be I broke out the calculator.

If you make the coefficients of the unknowns into a 3x3 matrix A, and the constants on the right side of the equal sign a 3x1 matrix B, it makes an equation AX = B. "X" is the unknown 3x1 matrix containing the intersection of the system. Just like solving the equation 2x = 6 by dividing 6 by 2, to solve for the X matrix you have to multiply the B matrix by the inverse of the A matrix. In a calculator you would type in "A-1 x B" but in Octave they have a special operator "\" you can use.

Today I put the above system into Octave. I'm not a computer expert, but I've learned just enough to get the answers I need. Here's what I did:


You can see the 3x3 matrix first, then the 3x1 matrix, then I "divided" to get the answers. The most laborious part of this solution was typing all the coefficients into the matrix in the right way. Computers are notoriously unforgiving to anyone using common sense instead of the manual to input stuff. You can see the solution where it says "ans = 2, -5, 9". Those are the values that work for x, y and z respectively in all the original equations.

I love technology. Using the same method I could solve a system of 10 equations with 10 variables with little more effort than it takes to type in the coefficients. Why can't they invent a scanner to do it?

Sunday, January 9, 2011

Physical Mathematics or Mathematical Physics?

Earlier today I finished tutoring a precalc student in Barnes & Noble here in San Mateo and wandered over to check out the math books. One caught my eye: The Mathematical Mechanic: Using Physical Reasoning to Solve Problems by Penn State professor Mark Levi. What a brilliant idea: from the Pythagorean Theorem to the Cauchy Integral Formula, Dr. Levi uses strings, water, and mechanical devices to model mathematical formulas. Force, velocity and potential energy, among other ideas from physics class, are introduced to prove shortest distances, minimum areas and lines of best fit (linear regression) from math class. In this way the reader gets to "feel" what's going on and to sense when equilibrium has been reached, proving the mathematical theorem geometrically, visually and mechanically (and somatically?).

As a math teacher and tutor I don't hide my impatience with rigor. I think mathematical rigor can be traced to European youngsters (culturally speaking) pretending to Euclid's cred and medieval scientists challenging 1600 years of religious authority. Professional mathematicians may need or want rigor but math students in the 21st century need to understand topics and know how to use formulas, not how to prove the heck out of them.

Dr. Levi's book is a refreshing way to learn a lot of math and physics, and while it seems like an original way to link the two fields, Dr. Levi's scheme is grander:
Physical ideas can be real eye-openers and can suggest a strikingly simplified solution to a mathematical problem. The two subjects are so intimately intertwined that both suffer if separated. An occasional role reversal [physics serving math for a change] can be very fruitful, as this book illustrates. It may be argued that the separation of the two subjects is artificial.
With this book a reader can learn how to link math and physics intuitively and the experiments are free!

Wednesday, January 5, 2011

I'm Just A Math Man, He's THE Mathman

When I was a teacher I found a lot of interesting information on how to better teach math to children. I was trying to teach geometry to high schoolers when I came across the brilliant book Calculus By and For Young People by Don Cohen, whose philosophy is to give even elementary school-aged children "real math" problems and teach them how to think like mathematicians and scientists as early as possible.

Cohen left his job teaching school and has spent the last 34 years as the Mathman, working with small groups of children in his home. As can be seen in his book and website, he teaches young kids very high-level mathematical topics before they learn to hate or fear them. It's all about looking for patterns and since it's a fun game, giving up isn't an option.

However, his works are not what we commonly think of as children's books. Adults can also approach infinite series and matrices using the same materials. In my experience, this achievement is unique in the entire field of educational publishing. The tone of his books is that of a student exploring the topics in a playful, patient but determined way. Who else could "discover" his way to a dozen methods of solving quadratic equations?

I recently emailed him for feedback on a differential equations exploration I worked up, and he wrote back with questions as if he were an eager student and I were the teacher!

By adopting Don's perspective of being a lifelong student of math, I learn every time I teach a topic or sit down with a tutoring client. Read his page "On Thinking About and Doing Mathematics" for more wisdom.

Tuesday, January 4, 2011

Fun Calculus Comes To Town

Last night the Fun Calculus Program started in downtown San Mateo, and it went over better than I ever could have hoped!

There were 6 participants: 3 from San Mateo, 2 from Castro Valley and 1 all the way from Sunnyvale. They all have had some exposure to Algebra and Geometry, but they were easily following along and discovering patterns in the exploration about finding the slopes of curves. They all took home a workbook with applied problems should they feel like practicing their newfound skills.

Calculus is a field of math combining Algebra and Geometry, so anybody familiar with graphing lines can learn "The Derivative Pattern" linking distance, velocity and acceleration. Armed with this tool, you can easily find the position, the instantaneous velocity and acceleration of projectiles anywhere (or anytime) on their trajectory.

Run "The Pattern" backwards and you can calculate the exact area between two curves or under some pretty strange shapes. That's Session 3, in two weeks!

I'm confident a "top-down" math class like this, given once a week, is sufficient to impart some serious skills in school-age kids and adults alike!

Stay tuned for more...

Sunday, January 2, 2011

How To Do It

My entire educational philosophy can be traced to a short instructional video I first saw in the 1970s:



Around :50 "Alan" explains how to play the flute. For 20 years or so I laughed at the obvious joke about how simplistic morning shows or Expert Village can be on complicated subjects, but recently, when I started to think about how to present a quick Calculus course, another level of interpretation opened up.

Now, just as often, I have to admit Alan's genius: that really is how to play the flute. There's nothing untrue about his statement, and as advanced as you get playing the flute, you're still going to be blowing there and moving your fingers up and down here.

My attitude towards math is equally simplistic, and hopefully equally applicable as far as a student advances in Calculus. You look for patterns in numbers, and extend them. Just as Mozart and others wrote music down to help people play the flute, mathematicians and scientists have come up with ingenious tools to help us solve number puzzles.

The video never did tell us how to split an atom. :-(

Saturday, January 1, 2011

Calculus - Coming Soon To Your Computer

I was googling "teaching calculus with technology" and came across this story about a Calculus teacher in North Carolina who broke her kneecap but was able to teach from her home using Skype and Smart boards. I tutored a student recently using a screen-sharing application that let her see what I was graphing as I was graphing it. When I was solving equations, I typed the steps into a word processing document so there were no worries about handwriting or issues like that. I'm fascinated by the opportunities computers and the 'net create for teaching and learning anywhere. Similar to the students in the story (who were not intimidated by new technology), the teachers of the future will consider technology as natural a component of their classroom as a chalkboard.

In fact, I consider a graphing application like Geogebra (no, I'm not paid to mention it, but I should be!) a natural extension of the chalkboard. If my old teachers could have drawn a straight line or perfect parabola with a click of a mouse, I like to think they would have.

But I see the calculus class videos MIT has posted on Youtube and they're writing and drawing on a chalkboard! MIT! At least the Stanford folks use whiteboards in their vids. I guess when you're an A-list professor nobody questions your reliance on stone age technology. When you teach math-crazed MIT students you probably don't need to innovate much. In fact, I received a reply from a professor I'd emailed about The Fun Calculus Program who politely suggested "building math systematically" is a better approach than "jumping ahead and using discovery."

I politely disagree.