Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
12 views8 pages

TP 2

The document outlines a numerical approach to approximate the price of an American put option using partial differential equations (PDE). It details the formulation of the problem, including the necessary equations and boundary conditions, and discusses various numerical schemes such as the Explicit Euler Scheme and implicit methods for solving the PDE. Additionally, it provides guidelines for implementing these methods, including coding requirements and stability checks.

Uploaded by

thibault Tatou
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views8 pages

TP 2

The document outlines a numerical approach to approximate the price of an American put option using partial differential equations (PDE). It details the formulation of the problem, including the necessary equations and boundary conditions, and discusses various numerical schemes such as the Explicit Euler Scheme and implicit methods for solving the PDE. Additionally, it provides guidelines for implementing these methods, including coding requirements and stability checks.

Uploaded by

thibault Tatou
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

1

Numerical methods for PDE in Finance - M2MO - U. Paris Cité


American options

Plan of work : follow sections 1-5 and write a short report about your results.
We look for a numerical approximation of the price of an American put option v = v(t, s),
t ∈ (0, T ) and s ∈ Ω := (Smin , Smax ), as the solution of the following Partial Differential
Equation:
min(∂t v + Av, v − φ) = 0, (t, s) ∈ (0, T ) × Ω, (1a)
v(t, Smin ) = vℓ (t), t ∈ (0, T ), (1b)
v(t, Smax ) = vr (t) ≡ 0, t ∈ (0, T ), (1c)
v(0, s) = φ(s), s∈Ω (1d)
with
σ2 2
Av := − s ∂s,s v − rs ∂s v + rv,
2
and σ, r, K are positive constants. Note that, if Smin = 0, (1b) is not necessary.
We will consider mainly the following payoff function φ = φ1 for the model of the
American put option: (payoff=1):
φ1 (s) := (K − s)+ .
Note that looking for v(t, s) ≃ a(t)s + b(t) for s ≃ 0 in (1a) leads to v(t, s) = K − s. Hence,
if Smin > 0, a natural choice for vℓ (t) is
vℓ (t) :≡ φ(Smin ) = K − Smin .
(Another barrier payoff function1 will be also used for testing the Brennan-Schwartz
algorithm, see below.)
In the numerical tests, we will chose the following financial parameters:
K = 100.0, T = 1, σ = 0.3, and r = 0.1 (2)
and we set the computational domain Ω = (Smin , Smax ) as follows:
Smin = 50, Smax = 250. (3)
Finally, we aim at computing the value v̄ := v(T, Sval ) at
Sval = 90.0. (4)
The exact value of v̄ is not known.2
1
Barrier payoff function - "payoff=2":
for K
 
K 2
≤s≤K
φ2 (s) := , with vℓ (t) = vr (t) = 0.
0 otherwise

2
Using a BDF scheme of second order, with centered approximation, with parameters (I, N ) =
(5000, 500), gives the following approximation: v̄ ≃ 13.12055
1 EXPLICIT EULER SCHEME 2

1 Explicit Euler Scheme (or ”Euler Forward Scheme”)


Notations. We adopt the usual notations : mesh sj = Smin + jh, j = 1, . . . , I, h =
(Smax − Smin )/(I + 1) (so that s0 = Smin and sI+1 = Smax ), and tn = n∆t, 0 ≤ n ≤ N ,
∆t = T /N . We then look for Ujn , an approximation of v(tn , sj ). We choose to work with
the unknown vector of RI :  n 
U1
n  .. 
U :=  .  .
UIn
Euler Forward scheme, or ”Explicit Euler” (EE) scheme, using the centered ap-
proximation, is the following scheme :
 n+1
− Ujn σ 2 2 −Uj−1
n + 2U n − U n n − Un

Uj j j+1 Uj+1 j−1
min + s − rs + rUjn ,


 j 2 j



 ∆t 2  h 2h
n+1
Uj − φ(sj ) = 0, 1 ≤ j ≤ I,


U n = vℓ (tn ),


 0n


UI+1 = vr (tn ),
for n = 0, . . . , N − 1. The scheme is initialized with Uj0 = φ(sj ). We denote by A the
discretization matrix associated to the operator A, of size I, and q(t) ∈ RI , such that
σ 2 2 −Uj−1 + 2Uj − Uj+1 Uj+1 − Uj−1
(AU + q(t))j := + s − rsj + rUj , 1 ≤ j ≤ I.
2 j h2 2h
= −(αj − βj )Uj−1 + (2αj + r)Uj − (αj + βj )Uj+1 , 1 ≤ j ≤ I.
2
σ 2 sj rsj
with αj = 2 h2 and βj = 2h . Recall that A is the tridiagonal matrix
tridiag − (αj − βj ), 2αj + r, −(αj + βj )),
and
 
(−α1 + β1 )vℓ (t)

 0 

q(t) :=  ..
.
 
 . 
 0 
(−αI − βI )vr (t)
The matrix A and the vector q(t) are the same as the one used for European options.
Let also g be the vector of RI with components gj := φ(sj ). We finaly obtain the
following equivalent form of the scheme (EE) in RI :
U n+1 − U n
min( + AU n + q(tn ), U n+1 − g) = 0, n = 0, . . . , N − 1, (5)
∆t
U 0 = g.
(where the ”min” must be understood component-wise). One can check that the main
iteration can also be written
Uin+1 = max(Uin − ∆t(AU n + q(tn ))i , gi ), 1 ≤ i ≤ I,
2 A FIRST IMPLICIT SCHEME: THE SPLITTING SCHEME 3

or, in vector form,

U n+1 = max(U n − ∆t(AU n + q(tn )), g).

• Write the code for the corresponding Euler Forward scheme. 3


• Check that the program does give a stable solution with the parameters I=20 and N=20.
• Check that there is an unstable behavior with other parameters (such as I=50 and N=20).
• Using for instance N ≃ 2 ∗ I 2 /10, with I + 1 = 20, 40, · · · , obtain an approximation of
v̄ (value at T = 1, and s = Sval ). Pay attention that Sval may not be a grid point: in this
case, a further linear interpolation of the discrete values at the grid nodes surrounding
Sval should be performed.
Typical results are 4
I= 19, N= 80, v:= 12.947098, err= 0.000000, ord= 0.00 [tcpu= 0.027]
I= 39, N= 320, v:= 13.064717, err= 0.263003, ord= 0.00 [tcpu= 0.209]
I= 79, N= 1280, v:= 13.109572, err= 0.070922, ord= 0.95 [tcpu= 1.078]
I= 159, N= 5120, v:= 13.117805, err= 0.009205, ord= 1.47 [tcpu= 12.508]
I= 319, N= 20480, v:= 13.119987, err= 0.001726, ord= 1.21 [tcpu=127.680]

2 A first implicit scheme: the splitting scheme


For stability reasons, we now focus on implicit schemes. We first propose an implicit
splitting scheme.5 Although the following scheme might be less accurate than the implicit
Euler scheme (see next section), it corresponds to a much simpler algorithm. The scheme
is as follows:
U n+1,(1) − U n
(i) compute U n+1,(1) s.t. + AU n+1,(1) + q(tn+1 ) = 0, (6)
∆t
(ii) compute U n+1 s.t. U n+1 = max(U n+1,(1) , g). (7)

• Write the code for this method (for instance in the case SCHEME=’EI-AMER-SPLIT’).
The advantage of this method is to be free of a CFL condition for stability, and that it is
also simple to implement.
• Propose a variant of the previous scheme, of Crank-Nicolson type (θ = 12 scheme). 6
• For both methods, compute the corresponding convergence tables for (I + 1, N ) =
(20, 20) ∗ 2k , k = 0, 1, 2, 3, 4, ....
Notice that the Crank-Nicolson type method with the splitting above is not second
order consistent in time with respect to the PDE (1a). 7
3
For instance, when parameter SCHEME has value SCHEME=’EE-AMER’
4
Errors ek estimated by taking the differences |vk − vk−1 |, ”order” (in time) estimated as βk :=
log(ek−1 /ek )/ log(∆tk−1 /∆tk ).
5
For a convergence proof of this method, we refer to Barles, Daher and Romano (1994).
6
Solution: U n+1 = max(U n+1,(1) , g) where U n+1,1 solution of the Crank-Nicolson scheme, that is:
U n+1,(1) − U n 1 1
+ (AU n+1,(1) + q(tn+1 )) + (AU n + q(tn )) = 0.
∆t 2 2

7
A second order method consistent is proposed in Osterlee (2003) - see also Section 4. For a precise
discussion and analysis, see Bokanowski and Debrabant (2020) on arXiv.
3 IMPLICIT EULER SCHEME 4

3 Implicit Euler Scheme


We now turn to the time-implicit Euler Scheme for the American option, which takes the
following form:

U n+1 − U n
min( + AU n+1 + q(tn+1 ), U n+1 − g) = 0, n = 0, . . . , N − 1, (8)
∆t
U 0 = g.

(U n is known and we look for a solution U n+1 ). Let us define

B := Id + ∆tA, and b := U n − ∆t q(tn+1 ).

For each n, one must compute a solution x ∈ RI of the following non-linear system

min(Bx − b, x − g) = 0, in RI . (9)

Then, the scheme (8) will consist of setting U n+1 = x. There exists several algorithms for
solving (9). This problem is also referred to as an obstacle problem.

3.1 PSOR Algorithm (PSOR = ”Projected Successive Over Relaxation”)


This is an iterative method based on the decomposition B = L + U where L is the lower
triangular part of B and U is the strict upper triangular part. 8
Recall that the solution x of min(Lx − b, x − g) = 0 can be solved explicitly.
• Check that the solution x = xk+1 of min(Lx−(b−U xk ), x−g) = 0 can be programmed
using the following pseudo-code
for i=1 .. n
x(i) =( b(i)- sum_{j=1,..,J, j!=i} (B(i,j) x(j)) ) / B(i,i)
x(i) =max(x(i),g(i))
end

Hence, the PSOR algorithm takes the form


# Data: matrix B=L+U, vector g, vector x0 (initial guess)
# Data: threshold eta, integer kmax
x=x0, k=0
while (k<kmax):
xold = x
for i=1 .. n
x(i) =( b(i)- sum_{j=1,..,J, j!=i} (B(i,j) x(j)) ) / B(i,i)
x(i) =max(x(i),g(i))
end
8
For a given starting vector x0 ∈ RI , we define xk+1 as the solution of the system

min(Lxk+1 − (b − U xk ), xk+1 − g) = 0.

Assuming that Li,i := Bi,i > 0, the system can be solved explicitly, using that L is also lower triangular.
By a fixed point argument, the method can be shown to be convergent as soon as B is a strictly diagonal
dominant matrix with Bi,i > 0 ∀i (see the notes).
3 IMPLICIT EULER SCHEME 5

k = k+1

# PRINTS FOR DEBUG PURPOSE / CONVERGENCE ANALYSIS vs. k:


# formatted print [k, norm(x-xold), norm(min(Bx-b,x-g))], such as:
err1=lng.norm(x-xold)
err2=lng.norm(np.minimum(B*x-b,x-g))
print("k=%3i, |x-xold|=%10.6f, |min(Bx-b,x-g)|=%10.6f\n" % (k,err1,err2))

if norm(x-xold)<= eta:
STOP
if (k=kmax):
WARNING MESSAGE

• Complete the iterative method in a fonction PSOR


• Plug this method in the code : SCHEMA=’EI-AMER-PSOR’.
• Observe that the method slows down for larger I values (for instance, test with
σ = 0.3, N = 10, I + 1 = 100, and observe that the number of PSOR iterations grows at
each time iteration).
• (Optionnal) Observe that the method can be accelerated by using over-relaxation,
i.e. the following decomposition (instead of B = L + U ):

B = Lw + Uw

where Lw = ( w1 − 1)D + L, D = diag(A), Uw = B − Lw . You may try w ∈ (1, 2), for


instance w = 1.5.

3.2 Semi-smooth Newton’s method


The following method will work whatever the form of the data and payoff functions.9
We now aim at applying a Newton type algorithm for solving F (x) = 0 with

F (x) := min(Bx − b, x − g).

We consider the following algorithm: iterate over k ≥ 0 (for a given x0 starting point of
RI , to be chosen)
xk+1 = xk − F ′ (xk )−1 F (xk ),
until F (xk ) = 0 (or, that xk+1 = xk ). We define F ′ (xk ) as follows (row by row derivative)

Bi,j if (Bxk − b)i ≤ (xk − g)i ,



′ k
F (x )i,j :=
δi,j otherwise.

(Note the specific choice F ′ (xk )i,j = Bi,j even in the case when (Bxk − b)i = (xk − g)i .
The other choice F ′ (xk )i,j = δi,j if (Bxk − b)i = (xk − g)i also works but may be less
efficient : more iterations might be needed.)
9 P
Assuming for instance that B is an M -matrix in the sense Bii ≥ 0, Bij ≤ 0, and Bii > j̸=i |Bij |
for all i. An analysis of the scheme can been found in Bokanowski, Maroso, Zidani (2009). This type of
algorithm goes back to Howard’s algorithm, 1957.
3 IMPLICIT EULER SCHEME 6

Figure 1: American put option. Evaluated at time t = 0 for terminal time T = 1 (σ = 0.3,
r = 0.1; N = 20, I = 20).

• Write the code of Newton’s method in a function newton


• Program the implicit Euler scheme using Newton’s method. 10
• Test the method with N = 20, I = 50 and the classical payoff function φ1 .
• Draw errors tables: with N = I and with N = I/10. Compare with the EI/CN splitting
schemes.
Remark: With the particular payoff function φ2 , one can check that the method also
works, whereas the Brennan and Schwartz algorithm (in appendix) would introduce an
error when solving (9).
Remark: there are (roughly) equivalent methods for the obstacle problems, known as
”Primal-Dual” method, the ”policy iteration algorithm”, or ”Howard’s algorithm”.

3.3 Brennan and Schwartz algorithm (may be skipped on first reading)


There exists a direct method for solving min(Bx − b, x − g) = 0, when the solution x has
a particular ”shape”. 11 The idea is to write a decomposition of the form B = U L (L:
lower triangular matrix, and U : upper triangular matrix, with Uii = 1, ∀i), and to use the
equivalence, which is valid in particular cases :

min(U Lx − b, x − g) = 0 ⇔ min(Lx − U −1 b, x − g) = 0. (10)

Then, the right-hand-side of (10) has a simple explicit solution given by

(i) solve c = U −1 b: upwind algorithm.


(ii) solve min(Lx − c, x − g) = 0: downwind algorithm.

10
For instance SCHEME=’EI-AMER-NEWTON’
11
In the case of the American put with one asset, and for a finite element approach, see Jaillet, Lamberton
and Lapeyere (1990). The algorithm has initially been introduced by Brennan and Schwartz.
4 HIGHER ORDER SCHEMES 7

This method can therefore be seen as a ”projected” UL algorithm.


• For instance set SCHEME=’EI-AMER-UL’ in the main working file, in order to plug this
scheme.
• Program the B = U L decomposition of a tridiagonal matrix B in a function of the form
[U,L]=uldecomp(B).
Check first that the decomposition B = U L is working on the specific matrix B :=
Id + ∆tA, in the case I = 10.
To do so, one can introduce in the main loop a test that is only performed at iteration
n=0, as follows:

if SCHEME==’EI-AMER-UL’:
if n==0:
# Here decompose B=UL and test the decomposition
B= ...
U,L = uldecomp(B);
# Here test that the norm of B-UL is zero or close to zero:
print(’norme de B-UL: ’,lng.norm(B-U@L,np.inf));

# Here American option scheme


...

• Code the projected downwind algorithm (complete the function descente_p), in order
to find the solution x of min(Lx − b, x − g) = 0.
• Code the implicit Euler scheme using the upwind algorithm (which is given) and the
projected downwind algorithm. Test the method with N = 20, I + 1 = 50 (and with the
classical payoff function). Check that the equation min(Bx − b, x − g) = 0 is correctly
solved at each time iteration. To this end one can print the norm ∥ min(Bx − b, x − g)∥
after each new computation of the vector U in the main loop

Pold=P;
P=... % scheme definition

err=lng.norm(min(B*U-Uold,U-payoff(s)),np.inf);
fprintf(’Check: |min(B x- b, x-g)|= %15.10f\n’, err);

• Run the program again with the particular payoff φ2 instead of φ1 . Check that in that
case min(Bx − b, x − g) ̸= 0 (as soon as n = 0).

4 Higher order schemes


We aim at coding,testing and comparing three different schemes:

(i) Implicit Euler (already done above)


4 HIGHER ORDER SCHEMES 8

(ii) Crank-Nicolson: initialize with U 0 = g, and, for n ≥ 0:

U n+1 − U n 1 1
min( + (AU n+1 + q(tn+1 )) + (AU n + q(tn )), U n+1 − g) = 0
∆t 2 2
(11)

(iii) BDF scheme (see below)

drawing errors tables, with N = I and with N = I/10. (all the implicit schemes can use
Newton’s algorithm for solving the intermediate discrete obstacle problems.)
The BDF scheme (or Backward Difference Formula scheme) is as follows.12 Initialize
U = g. Compute U 1 with the EI scheme. Then, for n = 1, . . . , N − 1, compute U n+1
0

such that :
3U n+1 − 4U n + U n−1
min( + AU n+1 + q(tn+1 ), U n+1 − g) = 0 (12)
2∆t
(U n−1 , U n are known and we look for a solution U n+1 ).
• Check that the scheme is mathematically consistent of order two (check the consis-
tency at time tn+1 ) in time and space).
• Draw errors tables: with N = I and with N = I/10, compare.

12
Osterlee (2003). For an analysis, see Bokanowski and Debrabant IMA J. of Numerical Analysis,
41(2):900-934 (2021) or arXiv

You might also like