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

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.

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.

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.

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:

- Sample exam.
- Exam, moed aleph. My solutions.
- Exam, moed bet. My partial moed bet solutions, mostly English.

- Exam, moed aleph. My solutions - I did not write up the second version of the last question.
- Exam, moed bet. My solutions

- Exam, moed aleph. My solutions (not really finished but hopefully understandable).
- Exam, moed bet. My solutions, not including question 5b (only 1 student did this).

- Exam, moed aleph. Exam, moed aleph in English. Exam, moed aleph in English with solutions.
- Computer test, moed aleph. Note there were several slightly different versions! Comments on grading.
- Exam, moed bet.
- Computer test, moed bet. Note there were several slightly different versions! Comments on grading.

- Exam, moed aleph. Exam with solutions.
- Computer test, moed aleph. Note there were several slightly different versions! Solutions.
- Exam, moed bet.
- Computer test, moed bet. Note there were several slightly different versions!

- Exam, moed aleph. Exam with solutions.
- Computer test, moed aleph, with solutions.
- Exam, moed bet.
- Computer test, moed bet, with solutions.

- Exam, moed aleph. Exam with solutions. Some things not written out in full.
- Computer test, moed aleph, with solutions.
- Exam, moed bet.
- Computer test, moed bet.

- First class - Introduction to Matlab.
- Ad hoc method for solving x
^{2}-3x+2-sin(x)/12=0 - using the command "roots" to solve polynomial equations. - Newton's method for solving x
^{2}-3x+2-sin(x)/12=0 - using a for loop. - Newton's method for solving x
^{2}-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.

- Ad hoc method for solving x
- Second class - Generating Psuedo Random Numbers.
- Linear sequential method to generate uniformly distributed random numbers.
- Proof of the Box-Muller method for generating standard normal variables.

- 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.
- 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:
- Importance sampling:
First example is1.m, pricing a deep out of the money call option.
See the answer as a function of mu, and
the error as a function of mu.

Second example is2.m, pricing a deep out of the money Asian call option. See the answer as a function of mu, and the error as a function of mu.

- Control variables: dao.m for pricing a down and out put option with a low barrier.

- Importance sampling:
First example is1.m, pricing a deep out of the money call option.
See the answer as a function of mu, and
the error as a function of mu.
- 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

- Official Matlab sites with links to lots of Matlab tutorials.
- Official Matlab primer.
- Cleve Moler's book on numerical computing with Matlab.
- Hebrew introduction to Matlab
- Youtube has a bunch of useful videos about Matlab. For example, this one on Monte-Carlo simulation with Matlab. Please send me links of videos you found useful.
- Wikipedia has a ton of articles on subjects relevant to the course. Again, please send me links you find useful.
- An Introduction to Computational Finance Without Agonizing Pain, book by Peter Forsyth (recommended by Steve Solun).
- Tobias Jahnke's Notes on numerical methods in financial mathematics . (recommended by Steve Solun).
- Martin Haugh's notes on variance reduction techniques: Part 1, Part 2 (recommended by Steve Solun).

Back to my main teaching page

Back to my home page