Sunday, October 28, 2012

J'adore Halloween

                             "When ghosts and goblins by the score
                             ring your bell or pound your door
                             you better not be stingy or
                             your nightmares will come true!  Boo!"
                                                                   --Some Disney Writer

Some holidays are celebrated soberly and somberly as a matter of duty, gratitude--Veterans Day, Memorial Day, Labor Day, Easter, etc, etc.  But the only pure fun one is Halloween, my favorite.  Thanksgiving and Christmas suck, Easter blows, too much work and expectation.  Independence Day is also good, but it's a lazy good.

Halloween is perfect.  No expectations.  All the creativity and fun you can stand.  A perfect excuse to be as dumb and excited as you want.

So God Bless Halloween, and God Bless Pumpkin Pi....

Pumpkin Pi

Sunday, October 14, 2012

le Saut de Baumgartner (Baumgartner's Jump)

          "And He will raise you up on eagle's wings,
          bear you on the breath of dawn,
          make you to shine like the sun,
          and hold you in the palm of His hand."
                                                 -- Josh Grobman "On Eagle's Wings"

Felix Baumgartner completed his much pre-hyped jump from 128,100 feet, achieving a top speed 1.24 times the speed of sound.  It must have been an amazing ride, with the bill footed by Red Bull and everything.  I am neon green with envy.  Sure, it could be death to try, but it would be worth it just to see the blue-glowing world one time.  Besides, the life insurance is paid.

Gravity creates constant downward acceleration.  Friction with air produces drag that runs the opposite direction in which one is moving, and is proportional to velocity squared.  So the sum of all the forces on Felix, as with any skydiver, during his fall were equal to his mass times his actual acceleration.  Since drag is proportional to the square of velocity, the drag force and the gravitational pull become equal, and acceleration reaches zero.  This is known as terminal velocity.  Not nearly as exciting as the name sounds.  I know; I was disappointed, too.  In equation form it looks like this:

The drag coefficient includes half the surface area of the guy in the suit and a proportionality constant.  Based on his reported time in freefall and an area of 4.3354 square meters I found this to be 1.15, which is actually quite reasonable.

The next issue to deal with in the problem is the air density.  Anybody who's ever been up a tall mountain or a plane ride knows air gets thinner with elevation.  As a result, drag forces are higher near the ground than at the elevation Baumgartner jumped from.  Without that included, we're only left with the beautiful sky, without any interesting math.  So we can expect that Felix's speed went way up, and then it actually decreased until he pulled his parachute at 270 seconds.  Then it really dropped.

There's a ton more I just didn't have time to do.  For example, the drag coefficient is dependent on the velocity and density of the air, the gravitational force decreases as elevation increases, etc, etc.  But I just didn't have time.  Sigh!

Enough of all that.  I drew it out on paper and coded it out in Matlab.  Let's see what it looks like.  First, his position with time:
The scale of this is in tens of thousands of feet, so you can see where he pulls the cord at 270 seconds and about 8400 feet.  At that point, his descent slows way down.  Now, the velocity of the fall:
Two important spots here.  On the right, you can see where his chute deploys.  On the left, you can see where he reached terminal velocity in the upper atmosphere about 50 seconds in.  This was his terminal velocity.  After that, the rising density of the atmosphere continually slowed him down.  Kinda like being married.

As you can see, the model is a little off; the maximum velocity should be closer to 850 feet per second, while I've got him maxing out a little over a thousand.  That is probably due to my crude modeling of gravitational and temperature gradients at high elevation.  What can I say?  There's only so many hours in a Sunday afternoon.  Oh--one last thing.  The modeling on this is highly non-linear, so I saw no way to punch out an analytical solution.  Really, I don't think there is one, but maybe someone out there knows better than I do.
The equations and code are posted here:  http://thesexyuniverse.com/2012/12/08/baumgartners-jump/


Cheers!

Sunday, July 1, 2012

Gagner au Blackjack

         "Mystical explanations are regarded as profound;
         the truth is that they do not even go the length of being superficial."

                                                                   --Nietzsche, The Gay Science 3:126

I hate my Prius for the reasons it's hard to hate.  The gas mileage is impeccable.  When gas prices go up or down I barely notice it.  Everything in it is electronically guided.  The electronics are well made, and even better programmed.  When I turn the wheel, I feel the same resistance, get the same angle from the tires, and move through every curve identically every time.  Pressing the gas yields the same experience.  The vehicle does exactly what you expect it to do.  Easy driving?  You bet.  To say the transmission is automatic is an understatement.  The gearing is practically continuous: it shifts without you even feeling a thing.  

You can eat, talk on your cellphone, and paint the Mona Lisa while inebriated in your Prius, and do it in perfect safety.  Here's why:

  • The car is so dang responsive that even if you notice an impending collision when there's only one second to impact, you've still got plenty of time to come to a complete stop.
  • Even if you don't avoid the collision, the Prius doesn't weigh anything.  So whatever you hit will be barely scraped.
  • The car might as well be a sled for what it weighs, but I still don't think you can die in it.  It's a moving series of arches--designed to bounce back while preserving survival space.  There are so many airbags, and aircurtains, and air teddy bears pervading the thing...the entire compartment is a cushion waiting to happen. 
 I'd like a car that's challenging to drive and easy to fix.  Controlling the vehicle should require effort and attention--the response should vary as the road varies.  The driver should have to feel the road, guide the machine.  Under the hood, all should be linear.  Electricity should flow through wire from battery to plug.  Fuel should be pumped from tank to injector and out to pressure regulator.  The Prius will have none of this.  All is electronic.  Every part is attached to a board.  Surely easy to repair if you can get the parts.  You can't get the parts.  Sigh...

Here is the trade--a little bit of unpredictability in the drive for predictability in the machine's operation.  In the world of an engineer or an economist, this is the sacred trade-off--instability where it is cheap for stability where it costs.  The Prius does the opposite.  It's the perfect first car for someone who has no interest in knowing anything about how the car works.  The difficulty of vehicle repair may be the greatest hoax ever played in the modern world.  A well-made vehicle is no more than an array of coupled linear systems.  Systems where input a leads to event b and follows inexorably to consequence c.  Easy to understand.  Easy to analyze.  Easy to fix.  A good car should require no more than a socket and screwdriver set.

 Non-linear and random systems defy human understanding.  At the scale of human sight and human life, linear movements are the stuff of survival.  A thrown rock moves roughly in a straight line until gravity overcomes it.  The sun moves around the earth at the same speed, day after day after day.  Seasons come and go, and it's not hard to predict a range of days when frost will set in or when the air will become hotter.  Common sense is suddenly good enough to live on.

Except when it's not.  Common sense has kept farmers alive for tens of thousands of years and hunter-gatherers for at least a few million years before that.  But when it comes to understanding the real workings of the very large or very small world, it is useless.  It's common sense, for example, that the sun circles the earth.  I see it circle the earth every day.  It is only through imagination, art, and mathematics that the real nature of the sun and earth can be understood.

The reason is because these systems are random and/or non-linear.  And while it's hard to fathom processes like mountain forming, and aging, the human mind has a tremendous advantage over other minds in a non-linear world.  The human brain is big for the same reason a dog's brain is big--so it can predict the emotions and behavior of other humans.  Seems like a terrible waste of  grey matter, but it is through unconscious emotions and intuitions that we begin to understand the unpredictable.

Randomness and non-linearity are mathematically described by probability curves, partial differential equations, chaos theory, and stochastic calculus.  In the realm of human knowledge this is just about as new as it gets.  Many of the mathematical operations can never be carried out on paper, and chaos theory itself was impractical until the advent of personal computing.

When we encounter non-linear systems we understand them by humanizing them.  We anthropomorphize--see a man where there is none.  A pilot, a driver, and a ship captain call their respective vehicles "her" and christen them with names.  They become the equivalent of the Cylon fighters in Battlestar Galactica--"more of an animal, maybe, than the human models... like a pet".  More powerful ones--the weather, the sea, the sun, the crops, the rivers--become the realms of divinity.  Notwithstanding Feuerbach, God is often seen in the non-linearity and randomness the conscious mind is insufficient to analyze.  That which is not human at all must become woman and man, as these are the non-linear, stochastic systems every human mind can posit and understand.  Like Ginger Guardiola mentions in her lectures, civilizations where weather patterns and crop yields are plentiful and predictable develop pantheons mimicking that experience.  And where the weather and crops are unreliable, the pantheons are vindictive and barely sane.

This is why intuitive thinking leads to faith.  This is why scientists and believers must struggle to reach agreement.  The analytical mind and the religious mind seek to understand the same systems, and encounter many of the same difficulties.   When Stephen Hawking stated his hope to "understand the mind of God", he was neither being profound nor faithful.  For Hawking, the mind of God is no more than the collection of constants that govern the physical universe.  He's not being anymore profound than feelgoodism and self help.  The beliefs that survive and thrive are often those which generate the easiest profit.  Barf!


Which all leads to Blackjack.  Blackjack is an excellent game for one who plays it astutely and attentively.  It destroys the timid and elevates the player from the shallow mysticism of luck.  The fastest way to lose at Blackjack is to play scared and rely on fortune.

Playing Blackjack is like hiking across a mountain range.  When one looks at the crags and peaks, it's easy to think they fall randomly, but they do not.  Instead they follow a pattern dictated by non-linear differential dynamics.  But each pebble on the mountain, it's size, and composition, is a result of random distribution.  A hiker moving at a relatively set pace will find mountain, mountain, mountain over time, and a predictable distribution of rocks and pebbles.  In Blackjack, each shuffle of the shoe can be thought of as a mountain, and each set of hands as the pebbles on it.

There is some argument as to whether the house has a built-in advantage in Blackjack.  I don't believe there is an inevitable advantage inherent to the cards and the game itself.  Rather, the advantage lies in the collected psychology of the players.  There will always be a supply of players who don't know how to play, drink while they play, or think their winning or losing depends on "luck".  Because of this, virtually anyone can find or learn a system that will allow him or her to come out even or close to it over a period of several hands.  Blackjack is like intercollegiate wrestling--even if your opponent is bigger, stronger, and smarter, there are still things you can do to avoid total disaster.

Beginning from a perfectly shuffled deck (or shoe of decks) from which no cards have been taken, the chances of winning or losing the first hand is about even.  The chance of the first card having a value of 10 is 4/13, of 1 or 11 is 1/13, and the same for each of 2 through 9.  If the dealer is showing 10, it is 53.4% likely that s/he is holding 18 or better.  Once the dealer checks, if you survive, the chance drops to 46.1%.  A simple system of playing each hand based on probability is the key to Blackjack survival.  

If perfect shuffling existed throughout the deck and players played rationally every hand, it would be impossible for either the house or the players to come out ahead over time.  In reality, though, perfect shuffling is a virtual impossibility, just as a perfectly smooth distribution of energy throughout the cosmos is virtually impossible.  The possibility of coming out ahead lies only in strategic betting before each hand is thrown.  There are many card-counting and betting systems out there, but each is flawed because they attempt to linearize a non-linear, stochastic system.  Instead, one must learn to play Blackjack as if the game is a brilliant and lovely Queen.

Each hand has a range of probable outcomes based on the cards remaining in the shoe.  The mean and the variance of the hands in a given deal follows a non-linear pattern as the shoe is dealt.  You must develop a true Gnosis, a true intuition, a true feel for the cards themselves.  You must foreknow the hands that will come, and predestine the hands for big wins or small losses.  I could give you a set of rules, I'm sure.  But that would be like following rules for dating, living, or getting rich.  It wouldn't be any fun, and probably wouldn't work out anyway.  Self-enslavement never does.  You might just as well go drive a Prius.

Thursday, May 17, 2012

Cinquante Ans de Changement et Encore Non Fini

        "You who are on the road
        Must have a code that you can live by
        And so become yourself
        Because the past is just a good bye.

        Teach your children well,
        Their father's hell did slowly go by,
        And feed them on your dreams
        The one they picked, the one you'll know by."
 
                                               --Graham Nash
 
I don't normally do this, but Dr X has a great post discussing Governor George Wallace's inaugural speech in 1963:
It is very appropriate then that from this Cradle of the Confederacy, this very Heart of the Great Anglo-Saxon Southland, that today we sound the drum for freedom as have our generations of forebears before us done, time and time again through history. Let us rise to the call of freedom-loving blood that is in us and send our answer to the tyranny that clanks its chains upon the South. In the name of the greatest people that have ever trod this earth, I draw the line in the dust and toss the gauntlet before the feet of tyranny . . . and I say . . . segregation today . . . segregation tomorrow . . . segregation forever.
I don't agree at all with his statement at the end.  The reality is that most of the way politics is practiced in the US is about evoking feelings of anger and fear, unfortunately. But it's still amazing to think how much real progress has been made for civil rights and freedom in my country, and in only one generation.  What a blessing.