Finite difference method for the Black and Scholes PDE (TP-1)

Similar documents
1 Explicit Euler Scheme (or Euler Forward Scheme )

1 Explicit Euler Scheme (or Euler Forward Scheme )

Lecture 4 - Finite differences methods for PDEs

Chapter 5 Finite Difference Methods. Math6911 W07, HM Zhu

ACC 471 Practice Problem Set # 4 Fall Suggested Solutions

Project 1: Double Pendulum

Analysis of a Hybrid Finite Difference Scheme for the Black-Scholes Equation Governing Option Pricing

FINITE DIFFERENCE METHODS

Calculus I Homework: Four Ways to Represent a Function Page 1. where h 0 and f(x) = x x 2.

Computational Finance Finite Difference Methods

A Study on Numerical Solution of Black-Scholes Model

Practice Exam 1. Use the limit laws from class compute the following limit. Show all your work and cite all rules used explicitly. xf(x) + 5x.

PRICE INDEX AGGREGATION: PLUTOCRATIC WEIGHTS, DEMOCRATIC WEIGHTS, AND VALUE JUDGMENTS

Introduction. Valuation of Assets. Capital Budgeting in Global Markets

MATH60082 Example Sheet 6 Explicit Finite Difference

Infinite Reload Options: Pricing and Analysis

A distributed Laplace transform algorithm for European options

Numerical Methods in Option Pricing (Part III)

Final Exam Key, JDEP 384H, Spring 2006

Lecture 4. Finite difference and finite element methods

As an example, we consider the following PDE with one variable; Finite difference method is one of numerical method for the PDE.

SAT Practice Test #1 IMPORTANT REMINDERS. A No. 2 pencil is required for the test. Do not use a mechanical pencil or pen.

MAFS Computational Methods for Pricing Structured Products

3.1 THE 2 2 EXCHANGE ECONOMY

The study guide does not look exactly like the exam but it will help you to focus your study efforts.

Maximizing the Sharpe Ratio and Information Ratio in the Barra Optimizer

The Implicit Pipeline Method

Research Article Exponential Time Integration and Second-Order Difference Scheme for a Generalized Black-Scholes Equation

Calibration Lecture 4: LSV and Model Uncertainty

Complex Survey Sample Design in IRS' Multi-objective Taxpayer Compliance Burden Studies

Lab12_sol. November 21, 2017

a) Give an example of a case when an (s,s) policy is not the same as an (R,Q) policy. (2p)

ETNA Kent State University

PDE Methods for the Maximum Drawdown

ECON 200 EXERCISES (1,1) (d) Use your answer to show that (b) is not the equilibrium price vector if. that must be satisfied?

FE610 Stochastic Calculus for Financial Engineers. Stevens Institute of Technology

Managing and Identifying Risk

What are Swaps? Spring Stephen Sapp ISFP. Stephen Sapp

Numerical Methods For American Option Pricing. Peng Liu. June 2008

Galerkin Least Square FEM for the European option price with CEV model

2.17 Tax Expenditures. Introduction. Scope and Objectives

Queens College, CUNY, Department of Computer Science Computational Finance CSCI 365 / 765 Fall 2017 Instructor: Dr. Sateesh Mane.

Finite Element Method

Systems of Ordinary Differential Equations. Lectures INF2320 p. 1/48

Can more education be bad? Some simple analytics on financing better education for development

Evaluation of Asian option by using RBF approximation

11.1 Average Rate of Change

Number of Municipalities. Funding (Millions) $ April 2003 to July 2003

2.11 School Board Executive Compensation Practices. Introduction

Optimal Dam Management

2.1 Mathematical Basis: Risk-Neutral Pricing

Towards efficient option pricing in incomplete markets

Figure 11. difference in the y-values difference in the x-values

Application of an Interval Backward Finite Difference Method for Solving the One-Dimensional Heat Conduction Problem

Numerical Methods for the Solution of the HJB Equations Arising in European and American Option Pricing with Proportional Transaction Costs

What are Swaps? Basic Idea of Swaps. What are Swaps? Advanced Corporate Finance

Introduction to Algorithms / Algorithms I Lecturer: Michael Dinitz Topic: Splay Trees Date: 9/27/16

Market shares and multinationals investment: a microeconomic foundation for FDI gravity equations

Making Informed Rollover Decisions

Stochastic Differential Equations in Finance and Monte Carlo Simulations

THE ROLE OF GOVERNMENT IN THE CREDIT MARKET. Benjamin Eden. Working Paper No. 09-W07. September 2009

Package multiassetoptions

Numerical Methods for Stochastic Differential Equations with Applications to Finance

King s College London

INTERNATIONAL REAL ESTATE REVIEW 1999 Vol. 2 No 1: pp

1 Asset Pricing: Bonds vs Stocks

Advanced Numerical Methods for Financial Problems

MATH6911: Numerical Methods in Finance. Final exam Time: 2:00pm - 5:00pm, April 11, Student Name (print): Student Signature: Student ID:

MASM006 UNIVERSITY OF EXETER SCHOOL OF ENGINEERING, COMPUTER SCIENCE AND MATHEMATICS MATHEMATICAL SCIENCES FINANCIAL MATHEMATICS.

Advanced Topics in Derivative Pricing Models. Topic 4 - Variance products and volatility derivatives

Pricing American Options Using a Space-time Adaptive Finite Difference Method

From Discrete Time to Continuous Time Modeling

TRADE FACILITATION AND THE EXTENSIVE MARGIN OF EXPORTS

Boundary conditions for options

Economathematics. Problem Sheet 1. Zbigniew Palmowski. Ws 2 dw s = 1 t

2017 Year-End Retirement Action Plan

Graduate Macro Theory II: Notes on Value Function Iteration

Price indeterminacy in day-ahead market

Capital Budgeting in Global Markets

Binary Search Tree and AVL Trees. Binary Search Tree. Binary Search Tree. Binary Search Tree. Techniques: How does the BST works?

Labor Market Flexibility and Growth.

King s College London

AN OPERATOR SPLITTING METHOD FOR PRICING THE ELS OPTION

Financial Risk Management

Finite Difference Methods for Option Pricing

Lecture 20 Heat Equation and Parabolic Problems

1 The Hull-White Interest Rate Model

American Equity Option Valuation Practical Guide

EXAMINATIONS OF THE HONG KONG STATISTICAL SOCIETY

Black-Scholes-Merton Model

Final exam solutions

FROM NAVIER-STOKES TO BLACK-SCHOLES: NUMERICAL METHODS IN COMPUTATIONAL FINANCE

Numerical schemes for SDEs

Option Pricing Models for European Options

Managing and Identifying Risk

Queens College, CUNY, Department of Computer Science Computational Finance CSCI 365 / 765 Fall 2017 Instructor: Dr. Sateesh Mane.

Production, safety, exchange, and risk. Kjell Hausken

Taxes and Entry Mode Decision in Multinationals: Export and FDI with and without Decentralization

arxiv: v1 [q-fin.cp] 1 Nov 2016

Math 416/516: Stochastic Simulation

Transcription:

Numerical metods for PDE in Finance - ENSTA - S1-1/MMMEF Finite difference metod for te Black and Scoles PDE (TP-1) November 2015 1 Te Euler Forward sceme We look for a numerical approximation of te European put function v = v(t, s), t [0, T ], s [0, S max ]. It satisfies in first approximation te Black and Scoles backward PDE on te truncated domain Ω = [S min, S max ] : s2 2 s 2 v rs s v + rv = 0, t (0, T ), s (S min, S max ) t v σ2 2 v(t, S min ) = v l (t) Ke rt S min, t (0, T ) v(t, S max ) = v r (t) 0, t (0, T ) v(0, s) = ϕ(s) := (K s) +, s (S min, S max ). On prendra les constantes numériques suivantes : K = 100, S min = 0, S max = 200, T = 1, σ = 0.2, r = 0.1 In particular, we aim at computing v(t, s) at final time t = T. We first introduce a discrete mes as follows. Let := Smax S min I+1 be (spatial) mes step, and t := T N be te time step. Ten s := S min +, = 0,..., I + 1 are te mes points, and t n = n t, n = 0,..., N te time mes. We are looking for U n, an approximation of v(t n, s ). For any function v C 2 (or v C 3 for (4)), we recall te following approximations, as 0, v (s ) = v(s ) v(s 1 ) v (s ) = v(s +1) v(s ) v (s ) = v(s +1) v(s 1 ) (1) + O() (2) + O() (3) + O( 2 ). (4) We terefore obtain several possible approximations by finite differences for te first order derivative : S v(t n, s ) U n U n 1 S v(t n, s ) U n +1 U n S v(t n, s ) U n +1 U n 1 (backward difference approximation) (5) (forward difference approximation) (6) (centered difference) (7) 1

Te first two approximations are said to be consistent of order 1 (in space), wile te second one is consistent of order 2. We also recall te approximation wic is consitent of order 2 in space. 2 SSv(t n, s ) U n 1 + 2U n U n +1 2, (8) Hence we obtain te so-called Euler Forward sceme (or Explicit Euler sceme), abreviated EE using te centered approximation, as follows : U n+1 U n t + σ2 2 s2 U n 1 + 2U n U n +1 2 rs U n +1 U n 1 + ru n = 0 n = 0,..., N 1, = 1,..., I U n 0 = v l (t n ) Ke rtn S min, n = 0,..., N (9) U n I+1 = v r (t n ) 0, U 0 = ϕ(s ) (K s ) +, n = 0,..., N = 1,..., I Let us remark tat we ave taken = 1 and = I as extremal indices in. For = 1, te sceme utilizes te known value U n 0 := v l(t n ) (left boundary value). For = I, te sceme utilizes te known value U n I+1 := v r(t n ) (rigt boundary value). 2 Programming Euler Forward 2.1 Preliminaries. We coose to work wit te unkown te vector corresponding to (v(t n, s )) =1,...,I : U n = U n 1. U n I. We would like to write (9) under te vector form as follows : U n+1 U n + AU n + q(t n ) = 0, (10) t were A is a square matrix of dimension I and q(t) is a column vector of size I. Let us denote α := σ2 s 2 2 2, β := r s. We look for A and q(t) suc tat ( α i + β i )U n i 1 + (2α i + r)u n i + ( α i β i )U n i+1 (AU + q(t n )) i. 2

By identification we see tat A is a tridiagonal matrix 2α 1 + r α 1 β 1 0 α 2 + β 2 2α 2 + r α 2 β 2......... A := α i + β i 2α i + r α i β i......... 0 α I + β I 2α I + r and q(t) will contain te known boundary values U 0 and U n+1 : ( α 1 + β 1 )v l (t) q(t) := 0.. 0 ( α I β I )v r (t) 2.2 Getting into te program. a) Download te working program 1 (tp1.m if using Matlab, or tp1.sci if using Scilab). Tis program as some lines to be completed in order to work properly. In te case of te matlab program, you will also ave to download oter function files BS.m and ploot.m (you can also take te solution file tp1sol.m) b) Ceck te program for te payoff function u0, ul (for v l ) and ur (for v r ) and program tem correctly. (notice tat te instruction y=max(k-s,0) works for s vector, K scalar, and return a vector of same size as s.) c) In te section MESH, complete te value of te mes step and program te vector s containing te (s ) 1 I values. Typically it sould look like : dt=t/n; =(Smax-Smin)/(I+1); s=smin+ (1:I) *; // column vector (s 1,..., s I ) T d) Program te matrix A and test te program. Under te matlab command window, type tp1. (Under Scilab, type exec tp1.sci or exec( tp1.sci,-1)) e) Program te function q(t). For instance in matlab : q = @(t) [(-alpa(1) + bet(1))* ul(t); zeros(i-2,1); (-alpa(end) - bet(end))* ur(t)]; In Scilab tis may look like function y=ul(t); y=k*exp(-r*t); endfunction function y=ur(t); y=0; endfunction; function y=q(t) y=zeros(s); // vector of zeros wit same size as te s vector y(1)= (-a(1)+b(1))*ul(t); u($)= (-a($)-b($))*ur(t); endfunction 1. See ttp ://people.mat.ussieu.fr/ boka/enseignement/2015/s11/ 3

2.2 Euler Forward sceme (or Euler Explicit sceme) a) Program te explicit form of te vector U n+1, in terms of U n, in te main loop, using te matrix A and te function q. In te end, it sould look like (in matlab) case EE P = (Id - dt*a)*p - dt*q(t); Note tat te grapic function ploot also plots te exact Black and Scoles formula (see te given function BS in te file BS.m). b) Correct te lign errli=0 in te main loop, in order to compute correctly te maximum norm. between te sceme values and te Black and Scoles values : U V BS = max 1 i I U i V BS (s i ) 2.3 Solution. A solution file is given in tp1sol.m 3 First numerical tests a) Test te Euler forward sceme (EE). First fix N = 10 and take I = 10, 20, 50,.... Ten take te following N = I values : 10, 20, 50, 100. Observe tat : - te sceme is not always numerically stable - it does not always give a positive solution (i.e. we do not always ave U n 0 n, ). b) Try to understand te origin of te oscillations wen tey occur. One sould look at te amplification matrix defined as B := I d ta (Te coefficients of B are tey positive? Do tey ave a modulus smaller tan 1?) c) Fill in te CFL number defined ere as µ := t 2 /( 1 σ 2 S max 2 ) and print it. Ceck tat tere is no stability problem wen ν is sufficiently small. d) In te case wen σ = 0.002 and for instance wit N = 10 and I = 50 : observe tat te sceme is stable but tat te solution given by te sceme is not positive. e) Order of te sceme. We first consider te following values of I and of N : I = 10, 20, 40, 80, 160, and N = I 2 /10 (tat is, N = 10, 40,...). Tis is in order to ave t 2. Fill in te following error table and compute te corresponding (spatial) order of te metod. More precisely, if te error is e k for a given parameter I = I k, we will compute te order at step k by te formula α k := log(e k 1/e k ) log( k 1 / k ) log(e k 1/e k ). log(2) Te idea is to try to detect a beavior of te form e k = C α k, were C est a constant and were k is te spatial mes size corresponding to I k. Te numerical (spatial) order sould be close to two. But ere setting N const I 2 is costly in terms of number of operations. More precisely, since t = const 2 one can see tat error also beaves as O( t), tat is, a first order error beavior wit respect to te time discretisation. 4

I N e k order α k 10 10 20 40 40 160 80 640 160 2540 Tis motivates te use of implicit scemes in order to avoid te time-step condition (or CFL condition). Exercice : backward and forward difference approximations a) Program in te same way te oter approximations (backward differences / décentrage droit : DROIT and te forward differences - décentrage gauce GAUCHE ). Te parameter CENTRAGE is defined at te begining of te program (section NUMERICAL DATA) and determines te type of finite difference approximation tat is used. b) Using te forward differences, fix temporarily σ = 0.002 and N = 10, I = 50, and ceck tat now te solution keeps positive. c) Using te backward differences, fix temporarily σ = 0.002 and N = 10, I = 50, and ceck tat now te numerical solution is unstable (understand te problem by looking at te coefficients of te amplification matrix). 4 Implicit Euler sceme (EI) Te CFL constraint imposes some restriction on te time step t. Implicit scemes may allow us to get rid of tis restriction. For instance, te implicit euler sceme, ereafter abrieviated EI (for Frenc Euler Implicit ), wit centered difference approximation for te first spatial derivatives reads U n+1 U n t + σ2 2 s2 U n+1 1 n+1 + 2U U+1 n+1 U+1 n+1 2 rs U 1 n+1 + ru n+1 = 0 n = 0,..., N 1, = 1,..., I U0 n+1 = v l (t n+1 ) Ke rt n+1 S min, n = 0,..., N 1 (11) U n+1 I+1 = v r(t n+1 ) 0, n = 0,..., N 1 U 0 = (K s ), = 1,..., I a) Write te sceme in vector form, in analogy wit (10). b) Program EI : set te parameter SCHEMA= EI at te begining of te program, and complete accordingly, in te main loop, te part case EI... Note tat in order to solve a linear system of te form Ax = b one may use te linear solver in matlab (resp. Scilab) as follows x=a\b; c) Ceck tat wit te EI sceme tere is no more stability problems (wit for instance N = 10 and I = 50). 5

5 Crank-Nicolson sceme a) Program te Crank-Nicolson sceme (CN) (tis is te θ-sceme wit θ = 1 2 ). b) Numerically study te convergence of te centered CN sceme. To do so, one can compute te numerical error obtained wit te following values N = I + 1 {10, 20, 40, 80, 160}. Ten do te same study as for te Euler implicit sceme and compare by making an error table (and wit an order estimation) One sould observe a second order beavior for CN, wile it sould be first order for EI. c) Ceck tat tese results are coerent wit te teory. 6 Exercices Exercice 2 : te Call option a) Using te put-call parity formula, do a function tat also computes te black and scoles formula for te call. b) Propose adequate left and rigt boundary conditions (tat is, at s = S min and s = S max ) for te call option, in te form (v(t, S min ) = v l (t) and v(t, S max ) = v r (t), were v l, v r are function to determine. 2 c) Propose an apropriate PDE for te call option, using tese boundary conditions. d) Write an Euler explicit sceme for te call option, and program it. Exercice 3 : using sparse matrices. Te matrix A as only a few non zero elements (about 3I non zero elements). It is possible to code only te non-zero elements of A by using te matrix type sparse. Type elp sparse or doc sparse for documentation in matlab (use A=spzeros(I,I) to initialize, type A or full(a) to ceck te values, use Id=speye(I,I) for te sparse identity matrix ; te rest of te code sould be oterwise uncanged.) Program in particular te EI sceme by using only sparse matrices, and compare te speed of te new code wit respect to te old one for large I values. Execution time can be evaluated by using te commands tic; toc; (resp. time() in Scilab) as follows : tic; % INSTRUCTIONS; %... t=toc; printf( cpu time : t=%5.2f, t); (t contains te time elapsed between te calls of tic and toc.) 2. v l (t, s) 0, v r(t, s) s Ke rt. 6