### Automatic Differentiation

Github

If researchers use the result of the derivatives in a part of computer simulation, researchers should not waste their time taking derivatives by hand. This is especially the case as the complexity of the problem increases. For example, taking derivatives by hand for heterogeneous agent model by hand will require an unreasonable man-hour. Of the numerical differentiation methods, symbolic method is slow and will require a lot of coding (in matlab). Forward/backward-difference is strictly inferior to automatic differentiation in accuracy. Threrefore, automatic differentiation (by operator overloading) should be used if applicable. Since there was not an (open-source) automatic derivative package that used sparse matrix storage for matlab, I updated a pre-existing package from Martin Fink for our use. Instruction for usage is in <README.pdf> file.

Examples:

### Linearized Model Solver for Heterogeneous Agents

github

This is a collection of codes to solve heterogeneous agent models by perturbation methods. This collection of codes include:

• Linear solver based on schur decomposition
• Systematic state space reduction based on Krylov subspace methods
• Linear rational expectation model solver based on sparse methods (to be used after dimensionality reduciton)
• Dimensionality reduction based on quadratic splines

Examples:

If a standard uniform grid method is used the number of grid points increases as $O(N^d)$ for a problem with d-dimensional state space and N grid points per dimension. This curse of dimensionality forces people to make (sometimes arbitrary) assumptions to reduce the dimensionality of the state space. However, there is a different solution to the curse of dimensionality. Using sparse grids (Smolyak grid), grid points scale at $O(N \log(N)^{d-1})$, and using adaptive sparse grids will further reduce the number of necessary grid points. This is still work in progress, but here are some example of sparse grids in action.