MA 573 Assignment 9 solution

$27.99

Original Work ?

Download Details:

  • Name: HW9.zip
  • Type: zip
  • Size: 189.46 KB

Category: You will Instantly receive a download link upon Payment||Click Original Work Button for Custom work

Description

5/5 - (2 votes)

1. (a) Write a Python code to implement the solver for a tridiagonal matrix-vector
system of linear equations, Ax = b.
(b) Modify the solving algorithm such that it can handle also the generalized
tridiagonal matrices of the form


∗ ∗ ∗ 0 0 · · · 0 0 0
∗ ∗ ∗ 0 0 · · · 0 0 0
0 ∗ ∗ ∗ 0 · · · 0 0 0
0 0 ∗ ∗ ∗ · · · 0 0 0
· · · · · · · · · · · · · · · · · · · · · · · · · · ·
0 0 0 0 0 · · · ∗ ∗ ∗
0 0 0 0 0 · · · ∗ ∗ ∗


as they arise when implementing boundary conditions, either linearly or from
non-central difference quotients.
Context: The solver should be written in a separate file, such that the program takes as
input the matrix tridiagonal/generalized tridiagonal A and the vector b. Best implement
a check that the algorithm runs only if the matrix has the correct structure and
produces an error message otherwise. As many remaining problems will use this
program, please test it extensively (e.g., by checking Ax = b by multiplication) to make
sure not to have errors in.
2
2. Price a European all option (ST − K)
+ by using an explicit finite difference scheme for
the Black–Scholes PDE

−vt(t, s) + 1
2
σ
2
s
2
vss(t, s) + rsvs(t, s) = rv(t, s)
v(0, s) = (s − k)
+
for S0 = 100, σ = 20%, r = 3%, T = 1 and K = 115. Use 1000 space discretization
point on the interval [0, 200] and implement the explicit boundary condition at 0 and a
linearity boundary condition at 200. Calculate the price for (a) 20, (b) (50), (c) 100, (d)
500 time discretization steps and compare it to the price explicitly calculated by the
Black-Scholes formula.
3. Exactly the same as problem 2., but use now the Crank-Nicolson scheme instead of the
explicit one.
4. Consider the finite difference scheme
3v(t, x) − 4v(t − ∆t, x) + v(t − 2∆t, x)
2∆t
(similar to HW 8). Assume that you want to use it to solve the system of ODEs

∂tv = Av
numerically (ignoring the issue for the first step, which can e.g. be implemented by an
implicit scheme).
(a) Find the shift polynomial associate to the finite difference scheme.
(b) Find the roots of the shift polynomial.
(c) Calculate the amplification factors Λim for all eigenvalues λi of A.
(d) Assuming that the eigenvalues are all in the interval [λmin, λmax], under which
condition on ∆t is the finite difference scheme stable?
6 points per problems