Monday, January 19, 2009

With certain unalienable Rights

I have an etymology calendar on my desk, and today's word is freedom. The author makes a serious mistake in writing, "'Liberty' … also means 'free' but in the sense of rights granted rather than any innate quality."

Liberty carries its natural-rights sense as used by enlightenment thinkers such as Locke and Bastiat, viz., government is the servant of free people and not their master.

For a contemporary example, consider Ron Paul who wrote (with emphasis added), "Democracy represented unlimited rule by an omnipotent majority, while a constitutionally limited republic was seen as the best system to preserve liberty. Inalienable individual liberties enshrined in the Bill of Rights would be threatened by the 'excesses of democracy.'"

In 1943, the U.S. supreme court declared, "One's right to life, liberty, and property, to free speech, a free press, freedom of worship and assembly, and other fundamental rights may not be submitted to vote; they depend on the outcome of no elections."

Thomas Jefferson took an even more radical position: "Rightful liberty is unobstructed action according to our will within limits drawn around us by the equal rights of others. I do not add 'within the limits of the law,' because law is often but the tyrant's will, and always so when it violates the rights of the individual."

The tenth amendment to the U.S. constitution (so-called these days) makes plain that the federal government is not the source of the people's rights, and this in turn is consistent with the Declaration's connection of government's just powers to "the consent of the governed."

Thursday, January 15, 2009

They see me rollin': a probability problem

Say you're playing 7-card stud and are dealt rolled-up deuces. If you see the case deuce as someone else's door, what is the probability that you'll bring it in?

In stud high games, the player with the lowest upcard is the bring-in. Suits break ties, with different places using different orders, so let's use bridge order, i.e., clubs, diamonds, hearts, and spades. Deuce of clubs always pays the bring-in.

The search space is small enough to use brute force. Front matter first:

> import Control.Monad
> import qualified System.IO.UTF8 as UTF8
> import Text.Printf
Modeling suits is straightforward:
> data Suit = C | D | H | S deriving (Show, Ord, Eq, Enum)
Haskell's deriving clause saves tedious definitions. For example, making Suit an instance of the Ord typeclass means that clubs are less than diamonds and so on.

We walk through all possibilities and report the probability:

> main = do
>   mapM_ display doors
>   putStrLn $ printf "Hero bringin probability: %.3f%%"
>                     (100.0 * k / n :: Float)

Simulate the deal. Automatically deriving an instance of the Enum typeclass allows us to use shorthand for all suits. From the problem statement, we know our hero will see two deuces, and the others are in the hole. Enumerating all possibilities is trivial with a list comprehension.

>   where doors = deal [C .. S]
>         deal xs = [ (h,v) | h <- xs, v <- xs, h /= v ]

Here we apply the definition of probability: the ratio of the number of times an event occurs with the total number of events:

>         hero  = [1.0 | (h,v) <- doors, h < v ]
>         (k,n) = (sum hero, fromIntegral $ length doors)

Given a pair of hero and villain door cards, pretty-print it to the standard output:

> display (h,v) = UTF8.putStrLn bringin
>   where hv = "Hero: " ++ (suit h) ++ ", Villain: " ++ (suit v)
>         bringin | h < v     = hv ++ " *"
>                 | otherwise = hv
>         suit C = "♣"
>         suit D = "♦"
>         suit H = "♥"
>         suit S = "♠"

Output:

Hero: ♣, Villain: ♦ *
Hero: ♣, Villain: ♥ *
Hero: ♣, Villain: ♠ *
Hero: ♦, Villain: ♣
Hero: ♦, Villain: ♥ *
Hero: ♦, Villain: ♠ *
Hero: ♥, Villain: ♣
Hero: ♥, Villain: ♦
Hero: ♥, Villain: ♠ *
Hero: ♠, Villain: ♣
Hero: ♠, Villain: ♦
Hero: ♠, Villain: ♥
Hero bringin probability: 50.000%

Wednesday, January 14, 2009

Sally's generosity project

When I first heard about Sally's unusual assignment for her functional area, I was standing in the Opry Mills Mall. (They have this great place there called Dave & Buster's — why in the world don't we have one of those in the Huntsvegas geek mecca?)

My cell phone rang, and I saw Jenny was calling. This was just before Christmas, and everyone at work knew I'd gone to Nashville to spend time with friends and family — and also to nearly freeze myself and my progeny to death in our 9° viewing of ice sculptures inspired by How The Grinch Stole Christmas.

I prepared for bad, bad news, but instead she asked the seemingly random question of whether I was still a coordinator for Dave Ramsey's Financial Peace University. "Uh, yeah," I stumbled, "what's up?" She clued me in and said she wanted to give an FPU scholarship. A young couple at our church are engaged to be married soon: the bride-elect also happens to be an Alabama alumna, so I figured that would mean extra warm fuzzies for the benefactress.

The next Monday (that would be December 22 for those scoring at home), Sally gave me a blue envelope with instructions to do a good deed. The only catch was that I had to write about it on my blog. When I got home, I hoped my wife would suggest a great gift, but we had a zillion other gifts flying through our heads trying to get ready for a Christmas trip to her grandmother's. So the task went into the background.

Christmas Eve at her grandmother's is completely nuts. My wife enjoys telling the story of my first ever Christmas Eve with her family. I leaned over to her, eyes no doubt wide with fright, and whispered, "Who are all these people?"

"This is my immediate family!" she proudly declared. Neices and uncles and nephews and aunts and cousins once, twice, and thrice removed. (Being around this sprawling brood is great practice for the aspiring genealogist.) You see, growing up, we didn't have any family in town, so I was used to laid-back, quiet Christmases with my parents and two brothers. Nothing like the loud bazaar over in Florence full of shouts, screeching monkeys, and goods of all sorts.

So maybe I was conserving my mental energy and couldn't spare the cycles Sally's worthy cause deserved.

When we go to Florence, my mother-in-law is great about offering to keep the kids so Sam and I can sneak out for a quiet date. One of our favorite places do go is Dale's, same brand as Dale's sauce you can buy in stores. Wonderful, delicious, scrumptuous steak, and they do everything for you but wipe your mouth when you're done. Order ribs and they even bring you warm wet towels with lemon slices. Well worth the trip, and I detest sitting in a car!

The other is Ricatoni's, an Italian restaurant on Court Street. On the drive over, we'd talked about maybe going there for lunch or dinner but didn't make firm plans. After sufficient recovery from the Christmas Eve piranha tank, cabin fever started to set in, so off we traipsed for my bride to feed her toasted-ravioli jones.

"Let's give a big tip to our waitress," Sam suggested on the way over, and the conspirators proceeded to carry out their plan. The food was outstanding as always. I had the catch, so I forgot for a while that I was six hours inland.

On the way out, I handed our waitress, probably a student at UNA, the bill folder, wished her a merry Christmas, and walked out feeling satisfied body and soul.