Tuesday, March 17, 2009

hooray for math!

Lately I have run in to several interesting mathematical 'things'. I like math, so I decided to do a post on them.

The first cool math law is called Benfords law. I read an article about it a while ago and thought it was one of the more interesting properties of numbers I had heard of. It was discovered in 1881, and then again in 1937. It turns out that if you have a really large set of random numbers, the percentage of occurrence of each number decreases by a lot as you go up the number line. In other words, if I have a million random numbers, the number of 1's in that chunk of data will be much higher than the number of 2's, which will be higher than 3's and so on. Because of this law, insurance companies and banks can screen for fraud because humans are really bad at making up random numbers. So if someone tries to write a check for an amount that doesn't look suspicious, the number they choose will probably have lots of 5's in it. It may be impossible to detect the fraud after only 1 check, but after a lot, a definite pattern begins to emerge and Benfords law is violated. This throws a flag and the bank investigates. You can read more about Benfords law at wikipedia and here.

Another neat math trick is the Markov Chain. The Markov Chain is based on a simple idea: that the current state captures and has all the information that could possibly influence future states. So, we can kind of think of the chain as being a closed system, where no more variables or anything are introduced externally. Chutes and Ladders and Hi Ho Cherrio are both games that can be exactly modeled with a Markov chain. This is all in the realm of probability theory, which can be very dense, but there are some really cool applications for the Markov chain. The way I first heard about it was its use in predicting sports outcomes. Several NCAA prediction algorithms are based on a Markov chain. It can also be used for predicting gambling (black jack card counting tables are calculated with Markov chains), generating music, and my favorite, generating text. There are several examples of using Markov chains on text to impersonate people and pass the Turing test. The basic way it works is that you give it a huge chunk of text and it breaks that text up in to 3 word chunks. It then looks at each of these chunks, finds words in common with other chunks, and combines them. This means that the sentences make sense syntactically, but the content makes no sense at all. Wikipedia has a great article on Markov Chains, and you can find a Markov chain Text generator here and the python code for it here.

I'm sure as I take more math and explore the internet more, I will find more of these kinds of things, and I will do another post on them when I do.

No comments:

Post a Comment