Numerical Methods for Mathematical Finance (88-636)
This is a one-semester course for students in the
financial
mathematics program.
Each week there will be a 3 hour lecture (Sunday 16:00-19:00, building 605, room 12)
and a 1 hour problem session with teaching assistant Idan Alter
(either Sunday 21:00-22:00, building 604, room 103 or Friday 10:00-11:00, building 505,
room 105).
Review Class: Tuesday February 9, 18:00, Building 604, Room 101
My email: schiff "at" math.biu.ac.il.
My office phone: 03-531-8867.
My office hours: Tuesday 14:00-16:00. In the math and CS building, building 216, room 208.
Idan's email: alterid "at" cs.biu.ac.il
Syllabus
Exercise Sets
Every few weeks I will post an exercise set. I regard doing these exercises as the
best way to learn the course material.
Each exercise will include a couple of questions for which you will need to submit solutions, and
10% of the course grade will be based on your solutions.
You must submit reasonable attempts at solutions to all the specified questions from the exercise sets
to get the full 10% of the course grade.
Every student is expected to submit their own work.
The exercises will not be checked (sorry) but random checks for copying will be made,
and where there is firm evidence of copying, submissions will be disqualified.
The exercises should be submitted in hard copy, Idan will give instructions.
We will try to post solutions to the exercises.
- Exercise set 1. See also this file for the
nodes of the ziggurat for question 3. Last submission date: Sunday Nov 8.
Solutions: Q1,
Q2,
Q3,
Q5.
- Exercise set 2. Please submit questions 5 and 6 by Friday Dec 4.
Solutions: Q1,
Q2,
Q3 (thanks Adi!),
Q4,
Q5,
Q6.
- Exercise set 3. Please submit questions 2,3,4 by Friday Jan 22.
Solutions: Q2, Q3.
- Exercise set 4. Please submit questions 3,6 by 12:00 on Wednesday Feb 10.
Solutions:
Q1+2,
Q3,
Q5.
Note on Computer Programs
This course is based on Matlab. Matlab
is available to students in the university computer labs (building 604, top floor),
and I imagine quite a few students will also have access at work.
There is a student version of Matlab for sale for about 300 sheqel at the campus
bookshop (speak to Gilad there). This gives students a 4 year licence to use the
software. It is not a full version, but it is possible to add on toolboxes for
a very reasonable fee.
The course only uses basic commands in Matlab, so I think everything can also be
done using either of the free-software Matlab clones,
Octave
or
Scilab
.
Here are instructions on a way of working with Matlab on the department's
server (planet) from home.
Course Grades
10% of the course grade will be based on the exercises.
The remaining 90% will be based on two final exams.
The first exam (45% of the grade) will consist of theoretical questions and will be run as a regular university exam.
The second exam (45% of the grade) will consist of practical problems to
be solved using Matlab and will be held in the university computer labs after the theoretical exam.
All students are expected to know how to access Matlab in the labs so they can take the exam.
Exams from previous years appear below.
There have been changes in the course content from year to year.
5773 was the first year that (part of) the exam involved live use of Matlab
5769 Exams:
5770 Exams:
5771 Exams:
5772 Exams:
5773 Exams: This year the exam was split into 2, half a "theory" test and half a computer test
5774 Exams:
5775 Exams:
5776 Exams:
Material from class
I will post here things I used in class.
- First class - Introduction to Matlab.
- Ad hoc method for solving x2-3x+2-sin(x)/12=0 - using the command "roots" to solve
polynomial equations.
- Newton's method for solving x2-3x+2-sin(x)/12=0 - using a for loop.
- Newton's method for solving x2-3x+2-sin(x)/12=0 - using a while loop.
- bscall.m, compute Black-Scholes price for a call option as a function of volatility sigma. Other parameters are
defined in the file. It works for vectors. So if you do sigma=[0:0.01:0.5]; c=blscall(sigma); plot(sigma,c), you get
this plot showing the dependence of the call price on sigma.
- impv.m, Netwon's method to find implied volatility given that the option with parameters (except sigma)
defined in bscall.m has price 15.
- bscallput.m,
same as bscall.m, but finding prices both call and put. (Example of a function with more
than one output). So if you do sigma=[0:0.01:0.5]; [c,p]=bscallput(sigma); plot(sigma,c,'b',sigma,p,'r'), you get
this plot showing the call price in blue and the put price in red. They are parallel because of call-put
parity. In class we added axes labels, a legend and a title to get this.
- This function takes a value of r and sigma and gives an answer showing how well a set of option prices
(on GM from Friday Oct 16) fit these values of r and sigma. (Example of a function with more than one input.)
The bigger the answer the worse the fit.
- Plot the answer of the previous file for different r's and sigma's. The minimum gives the best choice!
After adding labels to the axes and a legend, the resulting plot was this.
- Second class - Generating Psuedo Random Numbers.
- Third class - intro to Monte Carlo, Weiner Process, Ito integrals.
- dice.m. Monte Carlo simulation of the expected value of the sum of 5 dice. Look at the matrix a to see
the range of answers.
- mypi.m. Monte Carlo simulation of pi, as 4 times the ratio of the area of the circle to
its circumscribing square.
- weiner.m. Generating some paths of the Weiner process. Sample of output.
- ii1.m. Generating some paths of the Ito integral defined by dI = W dW.
Sample of output. (Exact answer is I(t) = (W(t)^2-t)/2.)
- Fourth class - intro to SDEs, EM method, errors in EM and EM + MC, Ito lemma etc.
- vas1.m.
Simulate some paths of the Vasicek process and see what the parameters a,b,c mean
- vas2.m. Vasicek process, MC simulation of the probability
of going over a certain level.
- Fifth class - simple examples of MC simulation with SDE models for option pricing.
- gbmmax.m Pricing a max option in the GBM model.
- funnygbm.m Pricing a down and out put in a modified GBM model.
- Sixth class
- g2.m Pricing an option on the average of two correlated assets, as a
function of the correlation coefficient. Output:
Price as function of rho,
Stochastic error as function of rho.
- Sensitivity of the same option with respect to the price of one of the underlyings. h1.m
- using separate random variables for each simulation. h2.m - using common random
variables for the simulations. Compare results of [a,b]=h1(0.1,1e5) and [a,b]=h2(0.1,1e5) to see how
much better it works with common r.v.s. In fact if you don't use common r.v.s the stochastic error will increase
as h goes down - compare [a,b]=h1(0.01,1e5) and [a,b]=h2(0.01,1e5) with previous results.
- Week 7:
- Week 10:
- Euler method for the heat equation with Dirichlet boundary conditions
- Week 11:
- Euler method - same as last week with the loop over i replaced by a vector command.
For N=20 need M bigger than 4000.
- Crank Nicolson method for the same problem. No stability condition, so
(for example) can take N=200, M=1000.
- tridiag.m.
- Week 12
- zzz.m Crank-Nicolson for a nonlinear reaction-diffusion equation.
(You will also need F.m and Fp.m, the reaction term and
its derivative.)
- zzz.m - solving a PDE to get option prices - vanilla put (European).
- zzzb.m - solving a PDE to get option prices - down and out put (European).
Useful links
There is an enormous amount of useful information on the internet relevant to the
course and I would like to collect some links here. So, students, please send me
your links!
Please send me more links to put here!
Back to my main teaching page
Back to my home page