Category Archives: Miscellaneous

Yet Another Buffon’s Needle Simulation Using Python

I remember being amazed years ago when I first read about Buffon’s Needle problem. You can estimate the value of pi (~3.1416) by dropping a needle on a floor made from wooden slats, and counting how many times the needle … Continue reading

Posted in Miscellaneous | Leave a comment

Computing the Distance Between Two Zip Codes

Computing the distance between two zip codes is easy. And it’s difficult. To compute the distance between two zip codes, you can find the latitude and longitude of each zip code, then compute the distance between the two lat-lon points. … Continue reading

Posted in Miscellaneous | 1 Comment

The Distance Between Two Randomly Selected Points in the Unit Square

I ran across a math problem that is simultaneously surprisingly easy and surprisingly difficult: “What is the average distance between two randomly selected points in the unit square?” One Sunday afternoon, instead of walking my dogs in the rain, I … Continue reading

Posted in Miscellaneous | 1 Comment

Tabletop Dice Baseball

Computer and video games can be very sophisticated. But simple games can be fun too. Various versions of tabletop dice baseball have been around for well over 100 years. There are many variations, but in most you roll one or … Continue reading

Posted in Miscellaneous | Leave a comment

Making a Python Scatter Plot with Different Colors for Different Labels

I was doing some machine learning coding and I wanted to programmatically create a scatter plot. My data looks like: xs = np.array([1, 2, 3, 4, 5, 6, 7, 8]) ys = np.array([3, 4, 8, 5, 6, 7, 3, 2]) … Continue reading

Posted in Miscellaneous | Leave a comment

A Quick Look at the Pykka Code Library

Pykka is a Python language code library (or framework depending on your point of view) that helps you write programs that use the Actor paradigm. This is useful when you have many components that need to interact with each other … Continue reading

Posted in Miscellaneous | Leave a comment

The Nash Bargaining Example

While I was doing some research on machine learning, I unexpectedly came across an old economics problem that I hadn’t seen in a long time — the Nash Bargaining Problem. Suppose Bill and Jack have some items. Each item has … Continue reading

Posted in Miscellaneous | 1 Comment

Experimental Fighter Planes During World War II

I’ve always been interested in history from all eras. War is awful but war often leads to fast technological advances. Here are some experimental U.S. fighter planes that were built during World war II (1940 – 1945). None of these … Continue reading

Posted in Miscellaneous | Leave a comment

Explaining protobuf And Why I Don’t Use It Very Often

Protocol Buffer, also known as protobuf, is an interesting alternative to XML or JSON or C-family language classes or structs. Briefly, you can define what is very much like a class using a special (but very simple) language. Then you … Continue reading

Posted in Miscellaneous | Leave a comment

The Gale-Shapley Algorithm for the Stable Marriage Problem

Suppose there are 4 men and 4 women. Each man and each woman has an internal mental list of who their preferred mate would be. You want to match the men and women in marriage so that the marriages are … Continue reading

Posted in Miscellaneous | 1 Comment