Source: https://python-programming.quantecon.org/_pdf/quantecon-python-programming.pdf