|   Home   |   Training   | 

Using ListConvolve for the Explicite Finite Difference Method

Download the notebook

Developing an explicite finite difference method for the Black-Scholes equation

The partial differential equation from Black-Scholes for a derivate [Graphics:Images/index_gr_1.gif] on the security [Graphics:Images/index_gr_2.gif] is given as

[Graphics:Images/index_gr_3.gif]

Numerical approximation for the partial derivates follow for example from the Taylor series. The parital derivates in the equation above are replaced through the appropriate Taylor series

[Graphics:Images/index_gr_4.gif]
[Graphics:Images/index_gr_5.gif]

In the next step the notation is changed to make it more consistent with a grid scheme.

[Graphics:Images/index_gr_6.gif]
[Graphics:Images/index_gr_7.gif]

To better illustrate the structure of the equation some more notational adjustments are made. The new structur will later help to simplify the calculations

[Graphics:Images/index_gr_8.gif]
[Graphics:Images/index_gr_9.gif]

Solving the last expression for [Graphics:Images/index_gr_10.gif] and simplifying leads to

[Graphics:Images/index_gr_11.gif]
[Graphics:Images/index_gr_12.gif]

The last expression can be rewritten as

[Graphics:Images/index_gr_13.gif]

with [Graphics:Images/index_gr_14.gif]and [Graphics:Images/index_gr_15.gif].
The presented calculation scheme is a version of the explicit finite difference method. While applying this calculation schemebei the new values for the derivate [Graphics:Images/index_gr_16.gif]are stepwise calculated from [Graphics:Images/index_gr_17.gif] and [Graphics:Images/index_gr_18.gif]. Picture 1 illustrates this approach.

[Graphics:Images/index_gr_19.gif]

Implementing the numerical method with ListConvolve

An efficient Mathematica function for the calculation of the differences needed in [Graphics:Images/index_gr_20.gif] and [Graphics:Images/index_gr_21.gif] is available through ListConvolve. To demonstrate this  ListConvolve is applied to a list of symbols.

[Graphics:Images/index_gr_22.gif]
[Graphics:Images/index_gr_23.gif]

ListConvolve used for  Δ  results in the following expression

[Graphics:Images/index_gr_24.gif]
[Graphics:Images/index_gr_25.gif]

The first list in ListConvolve, the kernel {1,0,1}, is applied piecewise to the second list and multiplicates the elements the elements of the second list and adds them up according to the values given in the kernel. This operation runs internally in Mathematica and is much faster as any loop written in Mathematica code.

The approach used for Δ can also be applied for the calculation of  Γ. ListConvolve can therefore replace loops which are common to the explicit approximation of partial differential equations.

[Graphics:Images/index_gr_26.gif]
[Graphics:Images/index_gr_27.gif]

To complete the specification of the finite difference method for the numerical solution of partial differential equations boundary and initial conditions are needed. These result from the given valuation problem.

Example: Numerical valuation of a call option

To illustrate the application of the method the following call option will be valued

[Graphics:Images/index_gr_28.gif]

The number of grid points for the discrete prices of the stock [Graphics:Images/index_gr_29.gif] can freely be chosen within a specific range. Increasing the number of time steps improves the accuracy but also increases the overall calculation time. For a first demonstration the number of discrete stock prices is set to 20.

[Graphics:Images/index_gr_30.gif]

The grid points for the stock price should be placed in a range not to tight around the current stock price.  In this example the reange is choosen from zero  up to twice the strike price. From the chosen region results the step size ΔS for the discretization of the stock prices range. One way to generate the list of grid points is to use NestList .  #+ΔS& within NestList is a generic function defined for local use.
On the list of discrete stock prices the exercise function of the option can be applied. The resulting list provides the starting or initial values for the numerical method.

[Graphics:Images/index_gr_31.gif]

The necessary number of time steps for the explicite FDM to converge depends on the step size for the discretization of the stock price, the volatility and the strike price (see Willmot [1998], p. 629). Using the formula given in  Willmot [1998] the number of time steps can be calculated as

[Graphics:Images/index_gr_32.gif]

Then the size of the time steps are

[Graphics:Images/index_gr_33.gif]

For the calculation of [Graphics:Images/index_gr_34.gif] and [Graphics:Images/index_gr_35.gif] the Mathematica function ListConvolve is used as explained above. (Attention: Before executing the following Mathematica code make sure that V is initiated with numbers.)

[Graphics:Images/index_gr_36.gif]

After the loop is finished V contains a list of option values. Each option value corresponds to a discrete stock price on the grid. Interplation on these numbers can be used to calculate the option price for the current price of the underlying [Graphics:Images/index_gr_37.gif].

[Graphics:Images/index_gr_38.gif]
[Graphics:Images/index_gr_39.gif]

References

Clewlow, L./Strickland, C., 1998, Implementing Derivatives Models, John Wiley & Sons Ltd.

Willmot, P., 1998,  Derivatives: The theory and practice of financial engineering, John Wiley & Sons Ltd.


Converted by Mathematica      October 5, 2000