Tuesday, February 23, 2016

Mathematical models

Let's just say I drop a bowling ball from the top of my house. High school physics won't help much in predicting my wife's reaction, but I can use high school physics to predict what will happen to the ball.

If I remember correctly, the magic formula said that the distance traveled is one-half the force of gravity multiplied by the time squared. The force of gravity is about 9.8 meters per second squared (about 32 g=feet per second squared), so if I drop the ball from 16 feet... Ummm... lemme think here ... the formula tells me that it will take a second to hit the ground.
Let's take that just a tiny step further, and suppose I were to jump from an airplane that is flying at 32,000 feet. Once again, physics won't be all that helpful in determining my wife's reaction. Her reaction would likely depend on my life insurance company's reaction to me jumping out of an airplane at 32,000 feet.
Doing last minute calculations before boarding the plane

If I apply the magic formula from my high school physics class, then I would predict that I hit the ground at a speed of just under 1,000 miles per hour, about 45 seconds after I jumped. That's about mach 1.27, in other words 27% faster than the speed of sound. Yes. That's right. If I yelled "look out" to the folks below me, I would hit the ground before my warning reached them.

We know that this ain't gonna happen. We have all seen too many movies where we hear the guy yelling long before he hits the ground. Any of my readers will recall an important piece of trivia: the terminal velocity of a human body is about 120 miles per hours. The terminal velocity is the speed where the force of gravity balances out against the wind resistance. A falling body goes no faster than the terminal velocity. At 120 miles per hour, this speed is usually terminal.

If I am trying to predict the speed of a bowling ball dropped from a house, then I can probably neglect air resistance. But if I am dropping feathers, then wind resistance is a pretty gosh-darn important part of the model. How about when I am looking at the trajectory of long slender sticks of wood with a sharp point on one end, and feathers at the other? Is air resistance important for a bow hunter when determining how far above the heart of the deer to point?

Yet another super-hero who relies on John the Math Guy for all her Math Guy needs

Strange as it may seem, I recently had a client who asked that very question. An elaborate experiment was performed, and I got out my big slide rule to crunch the data. I could find no evidence in the data that air resistance was important. Arrows are arrow-dynamic. (I am really proud of that pun, by the way.)
Are you keeping track?  If I am dropping feathers or jumping from an airplane, I need to mind the air resistance. If I am shooting arrows or dropping bowling balls from my roof, I don't need to.

But, you may ask, what if I am determining the path of a satellite, where there is no air resistance? Can I just use the same formula: distance = one-half the constant of gravity times the square of the time? 

Well... yes and no. Yes, the formula works, but no, the force of gravity will not be the same as on Earth. It is entirely possible that the force of gravity is not the same over the whole trip. The Earth's gravity diminishes as the square of the distance from the center of the Earth. So, at a height of 4,000 miles above the Earth, the gravitational pull is about a quarter of what it is at the surface of the Earth. At a height of 32,000 feet, the difference in the acceleration of gravity is about 0.3%, so I could safely leave it out of my flight calculations when I test my life insurance policy.

All right... here's another good one... What if I am measuring the rate that helium balloon falls when I drop it?  Oh. There is some other force involved there... the weight of the atmosphere pushing down on the balloon. I need a totally different equation if Macy's calls me in to consult on their parade. But, I can ignore buoyancy when I am dealing with bowling balls and arrows, at least until I start filling my bowling balls with helium.

I have yet to regale the reader with an explanation of how the combination of the spin and dimples on a golf ball cause turbulence that reduces wind resistance and makes the ball go further. Nor have I mentioned how my wife's dimples effect my own turbulence and speed. I will save that for another blog.

The first point I am making is that a really, really accurate mathematical model of reality is really, really complicated. But as George Box once said "All models are wrong, but some are useful."

Now let's consider my deer hunting buddy. Let's say that he refused to believe my analysis and figgered in the air resistance when he determined where to point when he was out in the woods, killing poor defenseless deer. In order to make this air resistance correction, my buddy needs to know the constant for the wind resistance to use in the magic equation. In order to get that constant, he needs to spend an afternoon at the archery range, shooting arrows from different distances to get the data to calibrate the mathematical model. Then he has to buy me another six-pack to coerce me to turn his data into a value for the wind resistance parameter that fits his arrow.
I predict that there will be less venison in his freezer as a result of his figgering in the air resistance. It's not just because the calculation is harder - it's because the calibration of the effect is less stable. There is noise in his data. He might have flinched a bit on one shot during the calibration run, or pulled the bow back a bit too far on another shot, or measured the position of the arrow on the target a bit wrong on another. Since the effect is small, the calibration will be sensitive to this noise in the data.

I have blogged about this before, the temptation to try to add more parameters to improve regression. I even wrote an honest-to-goodness scientific paper that at one time earned the Guinness Book of World Records distinction of having the largest color difference ever reported.
And there is my second point. Sometimes the quest for that perfect model is just a dumb idea.
One of my favorite drinking buddies

As my pal Einstein once said,"Everything should be made as simple as possible, but not simpler." As a guy who hangs out all day with mathematical models, I know that models are often not all that simple. Anorexia, paparazzi, you name it! I am with Einstein on this one.
Now some serious advice for any would-be applied mathematicians who would actually consider taking advice from a guy with a dorky hat, old man sunglasses, and a slide rule. A good share of the work done by an applied mathematician is determining exactly which effects are necessary to include in the mathematical model.

Saturday, February 13, 2016

Valentine's Day Movie Picks

"So, what are gonna do for Valentine's Day?" That question always scares me when it comes out of my wife's mouth. It scares me because I have learned that the question really means that I have the responsibility of decision-making, but don't have the authority to enact that decision. If I come up with the "wrong suggestion", then I will be in trouble. I cried a little bit under my breath.


I took a deep breath, and I did come up with a suggestion that was a winner. I could tell it was a winner because I didn't get instantly ridiculed. "You know Honey," I said in my sweetest James Earl Jones kinda voice, "the restaurants are always so crowded on Valentine's Day. Maybe we should make a nice meal and watch the greatest romance movie ever made."

Intimate pic of Madelaine and I from Valentine's Day 2015.
I'm the one with the chocolate stains on my earlobe

"Oh? What movie might that be?" Like I said... I wasn't ridiculed for coming up with a stupid idea! But she did put me on the spot. Luckily I had a few suggestions in my pocket. "I dunno... Must Love Mathematicians? Sleepless in CIELAB?" She came back with Pretty Woman, and then "that one with Cary Grant and what's-her-name... and they agree to meet at the Empire State Building..."

How does one decide what movie to watch? I have had such good luck with crowd-sourcing before. I like the idea of crowd sourcing... You ask a few thousand of your closest friends about which tie goes best with your boxer shorts, and you'll be guaranteed not to look like someone who gets all their fashion advice from Donald Trump.

I decided the rules ahead of time. I would Google the phrase "best romantic movie of all time", and take the first 20 hits that gave me lists of movies. I would take ten movies from each website, and compile these into one big list. The winning movie would be the one that occurred in the most lists.

Of course, as soon as you make rules, you set yourself up for problems. The first website I looked at had 100 movies listed. The next had 20. So... does the first website get 100 votes, and the second site only 20? That sounds about as fair as the whole super-delegate thing.

So, I decided that if the site had a count-down sort of thing, I would pick the best ten. If the movies were just plopped into the file without reference to any ranking, I would just take the first ten.

I am sure that most of my readers are getting a little hot under the collar just reading my description of meta-analysis! Boy, this sure does get my central processing unit going!

I thus had a list of 200 movies, with many duplicated. The duplicates were the ones I was most interested in. Without further ado, here are the winners...

Annie Hall

When Harry Met Sally

Pretty Woman

Say Anything

Here is a list of the most commonly cited romantic movies. Cue up one of these movies on your Roku box, stream yourself a little Amazon Prime Rib, and you got yourself a Valentine's date.

Annie Hall 10
When Harry Met Sally 9
Pretty Woman 6
Say Anything… 6
Casablanca 5
Four Weddings and a Funeral 5
It Happened One Night 5
Roman Holiday 5
Sleepless in Seattle 5
The Notebook 5
The Philadelphia Story 5
The Princess Bride 5

Then again... I showed the list to my lovely and darling wife. "Annie Hall??!?!?  That's a good movie, but it's not romantic! It's a friggen' Woody Allen movie, for Mose's sake!" I guess it's like my gramma always used to say: you can source all of the crowd some of the time, and you can source some of the crowd all of the time, but you just can't make peanut butter out of lilac petals with a pair of galoshes.