Source: https://faculty.washington.edu/ezivot/econ424/solverex.pdf