# Nine ways to implement the binomial method for option valuation in MATLAB

D.J. Higham

Research output: Contribution to journalArticle

18 Citations (Scopus)

### Abstract

In the context ofa real-life application that is of interest to many students, we illustrate how the choices made in translating an algorithm into a high-level computer code can affect the execution time. More precisely, we give nine MATLAB programs that implement the binomial method for valuing a European put option. The first program is a straightforward translation of the pseudocode in Figure 10.4 of The Mathematics of Financial Derivatives, by P. Wilmott, S. Howison, and J. Dewynne, Cambridge University Press, 1995. Four variants of this program are then presented that improve the efficiency by avoiding redundant computation, vectorizing, and accessing subarrays via MATLAB's colon notation. We then consider reformulating the problem via a binomial coefficient expansion. Here, a straightforward implementation is seen to be improved by vectorizing, avoiding overflow and underflow, and exploiting sparsity. Overall, the fastest of the binomial method programs has an execution time that is within a factor 2 of direct evaluation of the Black--Scholes formula. One of the vectorized versions is then used as the basis for a program that values an American put option. The programs show how execution times in MATLAB can be dramatically reduced by using high-level operations on arrays rather than computing with individual components, a principle that applies in many scientific computing environments. The relevant files are downloadable from the World Wide Web.
Language English 661-677 16 SIAM Review 44 4 10.1137/S0036144501393266 Published - 2002

### Fingerprint

Option Valuation
MATLAB
Execution Time
Natural sciences computing
Black-Scholes Formula
Financial Derivatives
Students
Derivatives
Binomial coefficient
Scientific Computing
Overflow
Sparsity
Notation
Figure
Computing
Evaluation

### Keywords

• algorithm
• American option
• Black--Scholes
• European option
• optimization
• overflow
• underflow
• vectorization

### Cite this

Higham, D.J. / Nine ways to implement the binomial method for option valuation in MATLAB. In: SIAM Review. 2002 ; Vol. 44, No. 4. pp. 661-677.
@article{05ee46ae19af4d35a4668500e57e0fee,
title = "Nine ways to implement the binomial method for option valuation in MATLAB",
abstract = "In the context ofa real-life application that is of interest to many students, we illustrate how the choices made in translating an algorithm into a high-level computer code can affect the execution time. More precisely, we give nine MATLAB programs that implement the binomial method for valuing a European put option. The first program is a straightforward translation of the pseudocode in Figure 10.4 of The Mathematics of Financial Derivatives, by P. Wilmott, S. Howison, and J. Dewynne, Cambridge University Press, 1995. Four variants of this program are then presented that improve the efficiency by avoiding redundant computation, vectorizing, and accessing subarrays via MATLAB's colon notation. We then consider reformulating the problem via a binomial coefficient expansion. Here, a straightforward implementation is seen to be improved by vectorizing, avoiding overflow and underflow, and exploiting sparsity. Overall, the fastest of the binomial method programs has an execution time that is within a factor 2 of direct evaluation of the Black--Scholes formula. One of the vectorized versions is then used as the basis for a program that values an American put option. The programs show how execution times in MATLAB can be dramatically reduced by using high-level operations on arrays rather than computing with individual components, a principle that applies in many scientific computing environments. The relevant files are downloadable from the World Wide Web.",
keywords = "algorithm, American option, Black--Scholes, European option, optimization, overflow, underflow, vectorization",
author = "D.J. Higham",
year = "2002",
doi = "10.1137/S0036144501393266",
language = "English",
volume = "44",
pages = "661--677",
journal = "SIAM Review",
issn = "0036-1445",
number = "4",

}

In: SIAM Review, Vol. 44, No. 4, 2002, p. 661-677.

Research output: Contribution to journalArticle

TY - JOUR

T1 - Nine ways to implement the binomial method for option valuation in MATLAB

AU - Higham, D.J.

PY - 2002

Y1 - 2002

N2 - In the context ofa real-life application that is of interest to many students, we illustrate how the choices made in translating an algorithm into a high-level computer code can affect the execution time. More precisely, we give nine MATLAB programs that implement the binomial method for valuing a European put option. The first program is a straightforward translation of the pseudocode in Figure 10.4 of The Mathematics of Financial Derivatives, by P. Wilmott, S. Howison, and J. Dewynne, Cambridge University Press, 1995. Four variants of this program are then presented that improve the efficiency by avoiding redundant computation, vectorizing, and accessing subarrays via MATLAB's colon notation. We then consider reformulating the problem via a binomial coefficient expansion. Here, a straightforward implementation is seen to be improved by vectorizing, avoiding overflow and underflow, and exploiting sparsity. Overall, the fastest of the binomial method programs has an execution time that is within a factor 2 of direct evaluation of the Black--Scholes formula. One of the vectorized versions is then used as the basis for a program that values an American put option. The programs show how execution times in MATLAB can be dramatically reduced by using high-level operations on arrays rather than computing with individual components, a principle that applies in many scientific computing environments. The relevant files are downloadable from the World Wide Web.

AB - In the context ofa real-life application that is of interest to many students, we illustrate how the choices made in translating an algorithm into a high-level computer code can affect the execution time. More precisely, we give nine MATLAB programs that implement the binomial method for valuing a European put option. The first program is a straightforward translation of the pseudocode in Figure 10.4 of The Mathematics of Financial Derivatives, by P. Wilmott, S. Howison, and J. Dewynne, Cambridge University Press, 1995. Four variants of this program are then presented that improve the efficiency by avoiding redundant computation, vectorizing, and accessing subarrays via MATLAB's colon notation. We then consider reformulating the problem via a binomial coefficient expansion. Here, a straightforward implementation is seen to be improved by vectorizing, avoiding overflow and underflow, and exploiting sparsity. Overall, the fastest of the binomial method programs has an execution time that is within a factor 2 of direct evaluation of the Black--Scholes formula. One of the vectorized versions is then used as the basis for a program that values an American put option. The programs show how execution times in MATLAB can be dramatically reduced by using high-level operations on arrays rather than computing with individual components, a principle that applies in many scientific computing environments. The relevant files are downloadable from the World Wide Web.

KW - algorithm

KW - American option

KW - Black--Scholes

KW - European option

KW - optimization

KW - overflow

KW - underflow

KW - vectorization

UR - http://epubs.siam.org/SIREV/sirev_toc.html

UR - http://personal.strath.ac.uk/d.j.higham/Plist/P46.pdf

U2 - 10.1137/S0036144501393266

DO - 10.1137/S0036144501393266

M3 - Article

VL - 44

SP - 661

EP - 677

JO - SIAM Review

T2 - SIAM Review

JF - SIAM Review

SN - 0036-1445

IS - 4

ER -