**Getting started on ****
Numerical Methods**

If you have never used your computer to solve economic models numerically, you probably don't have any software installed. There are a few programming languages to choose from. Matlab and Fortran are probably the most widely used languages among economist, although other options exist, such as GAMS, Python or R. Your decision on what language you choose from should mainly depend on two things: who you know and what you want to do. Who you know is important because sooner or later you'll need some help with your projects. Whether it is when you start out or when you get hung up on difficult problems later on, it is always good to have people around who could potentially help you. If everybody you know uses Matlab, there is probably little reason for you to choose anything but Matlab, at least to start out with. Same goes for Fortran. Having said that, it is also important to think about what kind of problems you plan on solving. Matlab is good to produce results early and visualize them but Fortran runs considerably faster than Matlab does. If you know that you will need a lot of computing power and that computing speed will be important, you may want to go with Fortran instead of Matlab. Although programming in Fortran is somehow similar to Matlab, there are a few differences. Matlab is very good and fast with matrices. Fortran in that case is not but compared to Matlab faster with loops. Matlab has a very easy to use interface, Fortran does not. For example, after running a program, Matlab will provide you the results for all your variables and parameter values and allow you to graph the result. In Fortran you have to write extra routines that output your results. In the absence of such routines, you won't have anything to show for. If you want to do serious quantitative GE macro research, learn Fortran early.
Note that most of the algorithms economist are likely to need (e.g. solving a system of equations, constraint and unconstraint optimization problems, etc.) are not included in the basic Matlab or Fortran programs. These routines usually come in the form of libraries that need to be purchased separately.
As a student at the University of Mannheim you can get the Matlab License for free at the MATLAB Landeslizenz. If you are not you can buy the Matlab Student version at the MathWorks student center. The current price for the student version is 35€. A very useful library you should invest in is the optimization toolbox (a Matlab version that includes Add-on-Products currently is 69€), which includes a range of algorithms useful for solving economic problems. Installing Matlab and the optimization toolbox is straight forward - just follow the instructions. If you do calibration, parallelization or resolve large scale problems you can use the BwUniCluster which again can be used for free by students of the University of Mannheim.
There are many Fortran compilers available, some are free (take a look at these sites for a list of free compilers: 1, 2), some are not. One good option is the Intel Visual Fortran Compiler, which comes in two versions: standard or professional. The only difference is that the professional version includes the IMSL Fortran Library. Student can order the Student Edition (which is a greatly discounted Standard version) from Custom Solutions. To install and run the Intel Visual Fortran Compiler, you will also need MS Visual Studio 2015 Standard Edition. For your Fortran system to be useful, you should also get a numerical library such as the IMSL Fortran Library or the NAG Fortran Library. According to Ken Judd, the NAG library is better than IMSL and contains some of the best available optimization routines (such as NPSOL from the Stanford System Optimization Laboratory). Visual Numerics sells student licenses for the IMSL library.To install your system do the following: - Install MS Visual Studio 2015 with the C++ component and choose development on and for IA-32 applications
- Install Intel Visual Fortran (NOTE: If you get an error message here, it may be that you need to download the most up-to-date version of the Intel compiler. Early versions were not compatible with Visual Studio 2015.)
- Install any library last
Once you have installed your compiler, try to compile and run one of the sample programs that comes with your software. To do so, you need to follow three steps. - Open the Fortran file you would like to compile
- Go to Build --> Build Solution (Ctrl+Shift+B)
- Go to Debug --> Start (F5), or Debug --> Start without Debugging (Ctrl+F5)
An excellent Fortran book for beginners and a great reference is Fortran 90 Programming. Another useful Fortran resource is Numerical Recipes in Fortran. Resources for numerical methods in economics include Ken Judd's website and his book Numerical Methods in Economics. There also exists a Summer Institute on Computational Economics. See also Johannes Pfeifer´s and Vahe Krrikyan`s slides on "Introduction to Scientific Computing". Two useful paper that provide deeper knowledge in how to use softwares efficiently are Best Practices for Scientific Computing, by Greg Wilson et al. and Code and Data for the Social Sciences: A Practitioner’s Guide, by Matthew Gentzkow and Jesse M. Shapiro. |