Tuesday, December 21, 2004

oreily hacks

I own some books from O'Reily Hacks series, and like the format quite a bit. I gave a bit of thought as to why I like this very free-format style. This reminded me of a statistical method called Monte Carlo. The method was actually invented by mathematician Stan Ulam, and was instrumental in the development of the H-Bomb. The basic idea of the method is pretty simple, and the best practical explaination I know of is like this: say you have a very irregular shape that you need to measure the area of. Because the shape is so irregular it would be hard to use regular area-measurment algorithms on it. But we can do a pretty easy experiment which Stan proved will give us better and better approximations. First, we draw an easily measurable shape, like a rectangle around the irregular shape. Then we throw a dart randomly inside the rectangle. We record whether it ended up inside the irregular shape. Repeat many times. Tally up how many times the dart ended up inside the shape of interest. The area can be approximated by Area-Of-rectangle*(Dart-Hits-Inside-Weird-Shape/Total-Dart-Throws). This guess will get more and more accurate with the number of tries.
How does this relate to the O'Reily books? I think the disorganized format gives you a good idea of the overall area without covering it in an organized manner. This is similar to the dart throw in the Monte Carlo method. By having multiple somewhat random articles about the subject this format gives you a broad and accurate overview of an area which in some sense is more compact and broad than a well-organized book on the subject.

0 Comments:

Post a Comment

<< Home