# CompEcon Toolbox for Matlab

CompEcon is a set of MATLAB functions for solving a variety of problems in economics and finance. The library functions include rootfinding and optimization solvers, a integrated set of routines for function approximation using polynomial, splines and other functional families, a set of numerical integration routines for general functions and for common probability distributions, general solvers for Ordinary Differential Equations (both initial and boundary value problems), routines for solving discrete and continuous time dynamic programming problems, and a general solver for financial derivatives (bonds, futures, options).

The CompEcon Toolbox was developed to accompany:
Applied Computational Economics and Finance, Mario J. Miranda & Paul L. Fackler, MIT Press
MATLAB code for all of the examples in the text is supplied with the CompEcon Toolbox.

The CompEcon Toolbox runs on any MATLAB version 5 or higher.

Major Features

Solvers for Non-linear equations: f(x)=0 and Complementarity Problems: min(max(f(x),a-x),b-x)=0
Solvers for Unconstrained and Constrained Optimization Problems
Newton-Cotes and Gaussian Numerical Integration Routines
Function Interpolation and Approximation using polynomials, splines and other families of functions
ODE Solver for Boundary-Value Problems: f(t,x,x’)=0
Solver for Discrete Time/Discrete Variable Dynamic Programming Problems (Markov Chain)
Solver for Discrete Time/Discrete or Continuous Variable Dynamic Programming Problems
Solver for Financial Asset Pricing including Assets with Early Exercise Provisions
Solver for Continuous Time Stochastic Control Problems

Selected Examples

Resource Economics:
Renewable and Nonrenewable resource management (firm and social planners problems)
Water allocation problems

Finance:
Black-Scholes and Heston’s Stochastic Volatility Option Pricing Models
Bond Pricing
Learning-by Doing

Macroeconomics:
Optimal Growth

Agricutural Economics:
Optimal Livestock Replacement
Rational Expectations Commodity Market Equilibrium