During the winter break, I was reading this book called Street-Fighting Mathematics, which is a cool book teaching tricks and approximations for various calculations. I strongly suggest reading through it if you want to strengthen your mathematical arsenal. In one of the chapters, the reader is invited to give an approximate answer to this integral within 5 minutes, correct to :
Let’s look at an algorithmic problem. We have a graph, and we want to color all the vertices with 2 colors such that each edge connects 2 vertices of the same color. This problem is called . An example of a 2-colorable graph is shown below.
Let’s suppose that you ask all your friends how many friends they have, and compare that average friends that your friends have to the number of friends you have. It might surprise you that on average, you will have less friends than your friends have.
Last weekend I just finished reading Naive Set Theory by Paul Halmos, and I think it would be good to write down some thoughts and interesting proofs in the book while the material is still fresh in my mind.
A pure function is a function that always evaluates to the same results given the same inputs, and does not produce any side effects in the process. There are many advantages to using pure functions. In this blog post I will show how we can still effectively use pure functions to handle state. Most of my code examples would be in Python, but I also show equivalent Haskell code for some examples. Only basic knowledge of Haskell syntax and its type system is needed to understand the Haskell code, and I believe that looking at the type signatures of the Haskell functions would help in understanding the Python code too.