Monday, May 9, 2016

The Golden Rule

LabKitty DnD Logo
I write LabKitty for myself as much as anyone (and if you've seen my analytics you know how true that is. High five!). A kind of public record of self-discovery in the spirit of Augustine's Confessions or Marcus Aurelius' Meditations, albeit unlike the latter only occasionally written while drunk (the Emperor has no prose). A tale of a small town cat coming of age in the cruel world of academics.

Mostly, however, LabKitty is about trying to undo what the hateful math faculty did to me at Circle Pines U. My Alma Mater. Not its real name of course, as if I need point that out. The only thing university administrators love more than indirects is a good libel suit. The DOJ might not have been able to force Apple to hack an iPhone, but I shudder to think of the doxxing efforts my ISP would suffer should I actionably malign a stolid academic institution of the hard-scrabble midwest. Then again, I suppose the Circle Pines chamber of commerce could have something to say about my abuse of their moniker, or will if the Internet ever makes it north of Lino Lakes.

But I kid the Lutherans.



These repairs usually take the form of revisiting a topic from my decidedly unhalcyon undergraduate calculus days and explaining it properly. Taking it apart, cleaning and oiling the pieces, and putting it back together in a way comprehensible. You will have to decide for yourself if my efforts are successful. I can only say my intentions are good, even if my abilities fail you. This a polar opposite of the Circle Pines U mathematics department faculty, who I do not doubt were able in the extreme but simply had zero interest in passing along anything resembling comprehension.

There they stood in front of the class (or sat, as one of our profs did, for the entire semester, and read from the textbook), their abstruse mouth noise giving the impression of instruction to a casual observer. Yet, there was none. They may have well been lecturing in EBCDIC or using semaphore flags. After several weeks of this, the audience began to wonder if we had truly gone insane. The classroom filled with nervous side glances I imagine not dissimilar to the passengers back in coach after the #2 engine exploded mid-flight on UA232, before the captain confirmed that, yes, the flight was going to be making an unscheduled stop in a cornfield.

I should add this was before the Internet was a thing, or at least a major thing, so we were entirely at the mercy of the course professor and textbook, the latter not infrequently written by the former. There was no Khan Academy, no iTunesU. Heck, there wasn't even an Amazon to browse instead of the campus bookstore where, believe me, our math faculty were no more penetrable in print than in the flesh.

The only alternative was the library, which was no alternative at all. Any helpful book had been stolen as part of a fraternity prank. Calls for the library to expand its collection fell on deaf ears, or -- more to the point -- empty purses, for the library budget had been spent constructing a multimillion dollar weightlifting facility for the football team (go Warrior Owls!), never explaining why the extant multimillion dollar campus weightlifting facility would not suffice. Apparently gravity worked differently in the new place.

Still, I like to think of myself as a mouse-half-not-eaten kind of cat, and I have found the experience of psyche repair to have paid an unexpected dividend. I'm told people who served in the Vietnam war found the place indescribably beautiful when mortar rounds weren't landing inside the wire. Some have even returned to that torn country decades later as tourists and found inner peace. So, too, my experience revisiting the landscape of my intellectual war now that some rat bastard isn't attempting to kibosh my future with a final exam which for all intensive porpoises may as well been from a different course. As if we had spent the entire semester learning Hegelian dialectic and the final was an essay question on how to ride a unicycle written in Klingon.

This dividend takes the from of the Golden Rule. The very embodiment of all things intellectual, or at least mathematical, and all for the low low price of $40,000 in student loans. For you a bargain at twice the price, or no price at all, as browsing LabKitty is free, unless you would care to purchase a fine LabKitty merchandise product which might help dissuade the Sallie Mae goons from breaking my kneecaps.

What is the Golden Rule? Read on.

The Golden Rule

In Every Picture Tells a Story, Rod Stewart proffers the one thing he believes will help us on our way. His guiding light in all things. Make the best out of the bad; just laugh it off, Rod advises, which I suppose works for bedding a slit-eyed* lady, but is of limited use in more mundane applications such as vector integration and Taylor series.

* Rod's sobriquet, not mine. A lyric that no longer flies in the culturally-sensitive airwaves of the 21st century, which is why classic rock K105 (Rocking the Pines!) won't play EPTaS anymore. :-(

And so, if I were to condense my millions of pointless words into a single lesson like Rod, what would I pass along? A code, a shibboleth. The Golden Rule. Something brief enough to fit on a t-shirt or mug, or be tattooed someplace intimate. I think it would be this:
If you can't solve a problem, recast it as a simpler problem you can solve, even if the simpler problem is just an approximation.
I dare say all of calculus -- perhaps even all of life -- is contained in those few words. (There is an implied coda: ...then make the approximation better, which leads you to the answer. But just the first step of recasting is often all you need to get the solution rolling.)

I suppose I should show an application of the Golden Rule, for an ounce of application is worth a ton of theorem, or so I am told (we never once in four semesters saw one example in our calculus courses, and, no, something that begins ...consider a diffeomorphism of the n-dimensional manifold M does not count as an "example").

The quintessential calculus problem is computing an area -- this combined with the quintessential problem of computing the tangent to a curve forms the yin and yang of all of calculus. The ancient Greeks knew the area problem; one of them (Eudoxos) famously using it to approximate pi and achieving a result more accurate than the state legislature of Indiana, who in 1897 decreed the value was 3.2 (I kid you not). The other problem (tangent) took a little longer, requiring Pythagorus and much else besides. Of course the Big Connection between area and tangent fell to Newton/Leibniz, or Leibniz/Newton, and I so tire of the primacy argument that we need to invent a name for the dynamic duo in the spirit of "Bennifer" or "Brangelina" so that you might avoid the primacy argument in the future in the way that I have not avoided it here. I suppose that leaves us either Gottack or Issfried, neither of which really rolls off the tongue. But I digress.

We want to calculate the area of some complex shape. We don't know how to solve this problem so (say it with me) we recast it as a simpler problem we can solve, even if the simpler problem is just an approximation. For us, the "simpler problem" we can solve is computing the area of a rectangle. I'll assume you understand at least that much.

Here's a picture presenting a visual feast of the concept:

practical application of the Golden Rule

At left: Area problem we cannot solve. At right: Area problem we can solve, albeit the solution just an approximation to the area on the left. We do not let this discourage us.

I will not compute the answer, which I suppose makes this less an example and more a something else (a clerihew?). It's the thought that counts. If you wished to calculate the literal actual area, you would simply construct a series of better approximations using more and more smaller and smaller rectangles. I dare say you might happen upon this trick on your own, were you say stranded on a desert isle with time to kill and not staring down some vengeful academic stuck in a backwater university teaching calculus to mewling undergrads instead of jetting to Stockholm to take his rightful place beside the other Nobel laureates, a fantasy of course because there is no Nobel for mathematics, so you will have to suffer with a Fields medal, which pays more and is offered to fewer but the public has never heard of it so nobody cares.

Footnote: Mathematicians have invented names for what we just did, in case you were starting to think maybe this isn't so hard after all. The collection of rectangles is called a partition, and using more and more smaller and smaller rectangles is called a refinement of the partition. The actual answer, which we obtain by using infinitely many infinitesimally small rectangles is called taking a limit. At some point algebra gets involved, which is when the wheels usually come off, but that is a story for another time.

There is a Part II of the Golden Rule, what we might call a corollary:
If you don't understand a concept, recast it as a simpler concept you do understand, even if the simpler concept is just an approximation.
This applies to the Great Trifecta of calculus -- derivatives, integrals, and infinite sums -- which often get cryptically tarted up, especially in fields that have run out of ideas so they're now just making the math harder (looking at you, physics). Do not be intimidated. An integral is just a sum that got too big for its britches; ditto an infinite series. Finally, a derivative is just a rate -- change in this divided by change in that -- regardless of whatever suit of lights some jackass lusting for tenure dressed it in.

As an example, consider the Fourier transform:

      X(ω) = −∞,∞   x(t) ⋅ exp(−iωt) dt

Let's assume you don't know what this means. How to proceed?

An integral is just a tarted-up sum, which you may have read somewhere recently. So let's detart it. Here, the integral is over t. In changing to a sum, we go from dt to little chunks of t:

      X(ω) = Σk=−∞,∞   x(kΔt) ⋅ exp(−iωkΔt) Δt

I don't know what ω is but it's just a place holder inside the sum so I can live with it for now. However, complex exponentials give me the heebie jeebies. Let's bust it up using Euler's identity: exp(ix) = cos(x) + i sin(x):

      X(ω) = Σk=−∞,∞   x(kΔt) ⋅ cos(ωkΔt) Δt
              +   i Σk=−∞,∞   x(kΔt) ⋅ sin(ωkΔt) Δt

This has to be true for any x(t). Let's assume we can find some magic x(t) that makes the sine term vanish -- that way we can get rid of the imaginary weirdness:

      X(ω) = Σk=−∞,∞   x(kΔt) ⋅ cos(ωkΔt) Δt

Since we're accepting approximations, we can use whatever Δt we like. I like Δt = 1 because that makes it go away:

      X(ω) = Σk=−∞,∞   x(k) ⋅ cos(kω)

This has to be true for all ω (whatever that is). Fair dinkum. What happens when ω is zero?

      X(0) = Σk=−∞,∞   x(k)

The cosine term has vanished (because it's equal to one). We're just summing x(t), which is equivalent to computing the area under x(t). (If you need convincing, make up an x(t), draw a picture, and replace the area with a bunch of rectangles having width = Δt = 1.) Make a note: X(0) = area under x(t).

Yet, if X(0) exists, then x(t) must go to zero for t outside some interval otherwise the area under x(t) would be infinite. Ergo, we can replace the infinite sum, which is a pain, with a finite sum, which is just counting:

      X(0) = Σk=−m,m   x(k)

Here, I assume x(t) = 0 for | t | > m. Things are looking simpler all the time.

Alas, however, ω = 0 isn't very generic. In fact, a value of zero is pretty darn special. So let's try some other value to help figure out what's going on. How about ω = 1? At least then the cosine term reappears:

      X(1) = Σk=−m,m   x(k) ⋅ cos(k)

This is a sum of the function x(t) multiplied by cos(t). In other words, x(t) weighted by cos(t). In still other words, the correlation of x(t) and cos(t). That's the very definition of the correlation of two functions: You mash them together and add up the cross-product terms.

Now we have our generic result. For any ω, X(ω) is a correlation of x(t) and cos(ωt). If x(t) and cos(ωt) are both positive or both negative at the same place, those kind of terms makes the correlation bigger (because the cross-product is positive). If the two are of opposite signs, those kind of terms make the correlation smaller (because the cross-product is negative). The Fourier transform tells us how much x(t) "looks like" a cosine of frequency ω. That's what a correlation does.

In summary, the Fourier transform tells us how much x(t) "looks like" a cosine of frequency ω.

Footnote: You may have noticed phase does not appear in this description (for phase to appear, we would have to correlate with cos(ωt + φ). Not to worry -- phase information reappears when we add back in the sine term we tossed out. Then we would say the Fourier transform tells us how much x(t) "looks like" a sinusoid of frequency ω. But that is a detail; it does not change the concept.

One more? Okay, one more. Consider the one dimensional wave equation. By no means the ugliest customer all things considered, but one you're bound to run into should you stick around STEM long enough:

      ∂2y/∂t2 = c22y/∂x2

What does this describe?

Yes, this describes a wave (heck, "wave" is right there in the name of the damn thing) where c is the propagation speed. But what do the symbols mean? Apply the Golden Rule. On the left is ∂2y/∂t2, which is ∂/∂t of ∂y/∂t. The quantity ∂y/∂t is the time rate of change of y, which is something like velocity. The time rate of change of velocity is acceleration. On the right we have ∂2y/∂x2 which is ∂/∂x of ∂y/∂x. The quantity ∂y/∂x is a slope. The spatial rate of change of slope is something like curvature. So all the wave equation really says is acceleration is proportional to curvature. More bendy => more acceleration, and vice-versa.

This might not make your life rainbows and kittens, but it's a start. When the going gets tough, the tough lower their standards, wrote Sanjoy Mahajan, who seems to me to be a pretty good guy in spite of being at MIT. Which perfectly captures the spirit of the Golden Rule, as I am calling it. However, I cannot print that on a mug or t-shirt or have it tattooed someplace intimate without Dr. Mahajan's permission, and the last thing he wants is a paper trail connecting him to a crazy person like LabKitty. So we are left with my statement of the Golden Rule, less catchy perhaps but nonetheless true.

LabKitty skull logo

1 comment:

  1. I haven't seen such an intuitive explanation of fourier transform anywhere! Although I did try to simplify problems before, your golden rule has now made me revisit a lot of concepts. Keep blogging!

    ReplyDelete