Question: Finite Difference Implicit Option Pricing Mehtod

Can somebody show me how to input this into maple please

f_i+1,j := (a_j)(f_i,j-1) + (b_j)(f_i,j) + (c_j)(f_i,j+1)

 

where 

a_j := [1/2 (r-q) j Delta t - 1/2 sigma^2 j^2 Delta t] 

b_j := [1 + sigma^2 j^2 Delta t + r Delta t] 

c_j := [-1/2 (r-q) j Delta t - 1/2 sigma^2 j^2 Delta t] 

 

with r:= 0.05, Delta t:= T/N , Delta S:=S/M, T:=0.4, q:=0, K:=1.1, S:=2, M=N:=10

I then want to define a tridiagonal matrix |i-j|>1, a_i,j =0

 

[1 0 0 0 0 0 0 0 0 0 0 0 0 0 ]

[a_1 b_1 c_1 0 0 0 0 0 0 0 ]

[0 a_2 b_2 c_2 0 0 0 0 0 0 0]

[. . . . . . . . . . . . . . . . . . ]

[. . . . . . . . . . . . . . . . . . ]

[ 0 0 0 0 0 0  0 0 0 0 0 0 a_m-1 b_m-1 c_m-1 ]

[ 0 0 0 0 0 0 0 . . . . . . . . . . . . . . . . . . . . 1]

 

With this matrix multiplied by the vector 

[f_i,0]

[f_i,1]

[. .  .]

[. . . ]

[. . . ]

[f_i,m]

 

which then equals the vector

[f_i+1,0]

[f_i+1,1]

[. .  .]

[. . . ]

[. . . ]

[f_i+1,m]

 

I was told to start with i:=N-1 and then to define this vector in maple

[f_N,0]

[f_N,1]

[. .  .]

[. . . ]

[. . . ]

[f_N,m]

which would equal a vector containing the max(K-j Delta S, 0) for 1<= j <= M. I was told to note that this matrix is not dependent on i. I need to find the matrix inverse and premultiply the vector by the inverse N times.

 

I am able to do everything up until the Matrix part which is where I am stuck.

Can anbody help me with this? 

Please Wait...