An n-gram is a word of length that we can create from a set of letters. With two letters , we can form these 3-grams: , , , , , , , and . We will let stand for tails and for heads, so that a 3-gram can represent an outcome if we flip a coin 3 times.
Penney’s game concerns two good friends and their -grams. The game is simple and seemingly fair. Soon Player 1 will call off their long friendship and leave, however. We will find that, whenever , Player 2 is always more likely to win.
Continue reading “Monte Carlo Simulations: Penney’s Game”
I want to begin our coding adventure with something simple yet useful in many areas. I think that has to be using Monte Carlo simulation to solve a problem, especially that for which we do not know the exact solution.
In essence, there are 2 stages for implementing a Monte Carlo simulation:
- Input stage: Define a set of possible inputs for the problem. Randomly generate inputs from this set. We can do this one at a time, or altogether.
- Output stage: For each generated input, find the output by following the problem description. I will refer to this “give me an input and I’ll give you an output” as a simulation. Combine the outputs to arrive at some meaningful result.
The benefit of a computer program shines in both stages. Our computer can create many inputs and evaluate their outputs much faster than we can.
Over the next few posts, we will examine how we can apply Monte Carlo simulation to solve problems in probability and integration. Whenever possible, we will consider the exact solution and see how good our approximate solution is.
Continue reading “Monte Carlo Simulations: Craps”
Let’s start off with something that puzzled mathematicians for over 300 years: infinity.
There are two definitions that we can give to infinity. One is “in the limit,” and the other “infinite set.” I will explain what each means and how things can go wrong at infinity. Lastly, I will draw pictures to prove a mathematical fact involving infinity. You will be surprised by just how obvious it is.
Continue reading “To Infinity and Beyond!”
Hi and welcome to my blog.
I love to explain hard math in simple terms. I do so by drawing pictures, making analogies, and writing code.
That’s exactly what you will find here: (1) thought-provoking figures, (2) relatable examples, and (3) simple code in Matlab, Python, and R.
From here on out are things that I find really interesting. I hope that you like them.