1 Introduction

The most common approach for pricing double barrier options is based on solving a partial differential equation of Black–Scholes type (see Wilmott 1998). However, such an equation does not have a closed-form solution and thus requires numerical approximation. To this aim, some scholars (see, for example, Boyle and Lau 1994; Cheuk and Vorst 1996; Ritchken 1996; Ahn and Gao 1999; Boyle and Tian 1999; Figlewski and Gao 1999; Tian 1999) have proposed the use of binomial and trinomial lattices, according to which the time variable and the price of the underlying asset (hereafter referred to as the space variable) are discretized on a suitable tree of nodes. This approach, albeit relatively simple to implement, has the disadvantage of not being very flexible, since the number of time-steps and the number of space discretization nodes in the tree cannot be chosen independently. As a consequence, binomial and trinomial lattices have progressively left the scene to a more modern and versatile numerical technique, namely the finite difference method, which has been employed, for instance, by Zvan et al. (2000), Duffy (2006), Wade et al. (2007), Ndogmo and Ntwiga (2011), and Milev and Tagliani (2013). In the present paper, we show that the performances of the finite difference method for double barrier option pricing can be considerably improved by applying a suitable mesh optimization and a Richardson extrapolation technique.

When pricing double barrier options by finite difference approximation (as well as by binomial/trinomial trees), some difficulties arise. In fact, the solution to be computed is not smooth at the strike price and at the barriers, and thus the space mesh, i.e. the set of nodes that are used to discretize the underlying asset price, must be chosen appropriately. First of all, to avoid losses of accuracy, a node of the mesh must be located exactly at the strike price, and other two nodes must be located exactly at the barriers (see Tian 1999; Pooley et al. 2003; Duffy 2006, Chapter 13,). Furthermore, if we want to improve the accuracy of the computed solution by applying some Richardson extrapolation procedure (see, for example, Arciniega and Allen 2004; Feng and Linetsky 2008; Chan et al. 2009; Ballestra 2014), we need a smooth pattern of error reduction, which requires us to use a mesh with equally spaced nodes. It is also worth noticing that, when using finite difference methods, a uniform mesh does also guarantee the highest rates of truncation error reduction (see, for example, Hirsch 1988, Chapter 4; Hyman et al. 2000; Duffy 2004). In the following, for the sake of brevity, a space mesh that satisfies the above two requirements will be said aligned and uniform.

Now, an aligned and uniform mesh is straightforward to obtain only if the strike price and the barriers are the terms of some arithmetic progression. This is the case that is usually considered when proposing finite difference schemes for double barrier option pricing, see, e.g., Duffy (2004), Wade et al. (2007), Ndogmo and Ntwiga (2011), and Milev and Tagliani (2013). Nevertheless, it can also happen that the strike price and the barriers are not in arithmetic progression. Anyway, even if they are, in the frequently encountered case where the barriers are discretely monitored, another issue arises. In fact, when pricing double barrier options with discretely monitored barriers, we have to discretize not only the space interval between the two barriers, but also the space interval below the lower barrier and the space interval above the upper barrier (by contrast, in the case of continuously monitored barriers, only the space interval between the barriers needs to be considered). Then, clearly, if we want to use an aligned and uniform mesh, the number of space discretization nodes below the lower barrier, denote it \(N_{L}\), the number of space discretization nodes between the lower and the upper barriers, denote it \(N_{M}\), and the number of space discretization nodes above the upper barriers, denote it \(N_{U}\), cannot be chosen arbitrarily. In the following, a mesh that is not only aligned and uniform but also such that \(N_{L}\), \(N_{M}\) and \(N_{U}\) are freely and a-priori decided by the user will be called optimal. As we may easily understand (and as will be clear in Sect. 3) in the general case an optimal mesh is impossible to have, at least in the original space domain of the partial differential problem that we have to solve.

In the present paper we propose a definitive and also very effective remedy to this issue. Specifically, we map the original space domain to a new computational one in which an optimal space mesh can always be constructed. This is accomplished by means of a suitable transformation of coordinates, which involves some parameters that are implicitly defined and whose existence and uniqueness is theoretically established. Such a change of coordinates is thoroughly analyzed from both the theoretical and the computational standpoint, and it is proven to be monotone, infinitely regular, and also simple to implement, so that it can be used without introducing any kind of singularity or incurring in any computational issue.

After applying the transformation of coordinates, a new partial differential problem is obtained which we solve by means of a finite difference scheme with repeated Richardson extrapolation in both space and time. The overall approach exhibits high efficacy. In particular, barrier option prices are computed with an error (in the maximum norm) close to the machine precision (i.e. of the order \(10^{-11}\) or \(10^{-12}\)) in less than 0.6 s. As shown by numerical simulations, the improvement over existing methods is due to the combination of the mesh optimization and the repeated Richardson extrapolation.

It is also worth to remark that our mesh optimization approach does not depend on the partial differential equation being solved, and thus it could also be applied to option pricing models other than the Black–Scholes model, such as the standard CEV model (Cox 1996), the CEV model with time dependent parameters (Lo et al. 2000, 2009) or the fractional Brownian motion (Mandelbrot and Van Ness 1968).

The remainder of the paper is organized as follows: in Sect. 2 the partial differential problem that yields the price of a double barrier option under the Black–Scholes model is briefly presented. In particular, our attention is focused on the case of discretely monitored barriers, but continuously monitored barriers could be considered as well; in Sect. 3 the procedure for constructing an optimal mesh is developed and theoretically analyzed; in Sect. 4 it is shown how to compute the optimal mesh by means of suitable bisection/Newton algorithms whose convergence is a-priory theoretically guaranteed; in Sect. 5 the finite difference scheme is briefly sketched; in Sect. 6 some numerical results are presented and discussed; finally, in Sect. 7 some conclusions are drawn.

2 The mathematical problem

In this section, the partial differential problem that is satisfied by the price of a double barrier option is briefly recalled. In doing that, we only consider the case of the popular Black–Scholes model, even if the proposed mesh optimization approach can also be used in conjunction with other models (for example the CEV model, see Cox 1996, or the fractional Brownian motion, see Mandelbrot and Van Ness 1968).

Let the price of an asset satisfy the following stochastic differential equation (under the risk-neutral measure):

$$\begin{aligned} dS(t) = r S(t) dt + \sigma S(t) dW(t), \end{aligned}$$
(1)

where r and \(\sigma \) are the (constant) interest rate and volatility, respectively, W is a Wiener process.

Let us consider a double barrier call option written on the above asset, with maturity T, strike price E, lower barrier L and upper barrier U. Moreover, let the barriers be applied discretely, at the \(I_b\) times \(t_{b,1}\), \(t_{b,2}\), \(\ldots \), \(t_{b,{I_b}}\). Following a common approach, the barrier dates are assumed to be equally spaced in [0, T], that is \(t_{b,i} = i \Delta T_b\), \(i=1,2,\ldots ,I_b\), where \(\Delta T_b = \frac{T}{I_b}\) denotes the time between two consecutive barriers. Let us observe that, as will be perfectly clear later on, the mesh optimization technique which we are going to present is not at all restricted to the pricing of the aforementioned kind of double barrier option. By contrast, the case of a put option, the case of continuously monitored barriers, and the case of unequally spaced barrier dates could be dealt with as well. Finally, we will focus our attention onto the case \(L< E < U\) (the strike lies between the barriers), which is the one that is usually encountered in the financial practice. Nevertheless, the reader will easily figure it out that the very unfrequent case \(E< L < U\) could also be considered.

The barrier option price, denote it \({\widetilde{V}}(S,t)\), can be obtained by recursively solving, for \(i = I_b, I_b-1, \ldots , 1\), the following partial differential problems:

$$\begin{aligned} \frac{\partial {\widetilde{V}}(S,t)}{\partial t} + r S \frac{\partial {\widetilde{V}}(S,t)}{\partial S} + \frac{1}{2}\sigma ^2 S^2 \frac{\partial ^2 {\widetilde{V}}(S,t)}{\partial S^2} - r{\widetilde{V}}(S,t) = 0, t \in [t_{b,i-1}, t_{b,i}[,\nonumber \\ \end{aligned}$$
(2)

with boundary conditions

$$\begin{aligned} {\widetilde{V}}(0,t) = 0, \lim _{S\rightarrow +\infty } {\widetilde{V}}(S,t) = 0, t \in [t_{b,i-1}, t_{b,i}[, \end{aligned}$$
(3)

and final condition

$$\begin{aligned} {\widetilde{V}}(S,t_{b,i}) = {\widetilde{\psi }}_i(S), \end{aligned}$$
(4)

where

$$\begin{aligned} {\widetilde{\psi }}_{I_b}(S) = \left\{ \begin{array}{ll} \max (S-E,0) &{} \text {if } L< S < U, \\ 0 &{} \text {if } S \le L \text { or } S\ge U, \end{array} \right. \end{aligned}$$
(5)

and for \(i=1,2,\ldots ,I_b-1\) we have:

$$\begin{aligned} {\widetilde{\psi }}_i(S) = \left\{ \begin{array}{ll} {\widetilde{V}}(S,t_{b,i}) &{} \text {if } L< S < U, \\ 0 &{} \text {if } S \le L \text { or } S\ge U. \end{array} \right. \end{aligned}$$
(6)

That is, first of all we have to solve problem (2)–(3) on the time interval \([t_{b,I_{b}-1}, t_{b,I_b}[\) with the final condition (5), then we have to solve problem (2)–(3) on the time interval \([t_{b,I_b-2}, t_{b,I_b-1}[\) with the final condition (6) (\(i=I_b-1\)), then we have to solve problem (2)–(3) on the time interval \([t_{b,I_b-3}, t_{b,I_b-2}[\) with the final condition (6) (\(i=I_b-2\)), \(\ldots \), and finally we have to solve problem (2)–(3) on the time interval \([t_{b,0}, t_{b,1}[\) with the final condition (6) (\(i=1\)). Note that, according to (6), the final condition of the problem that holds in the time interval \([t_{b,i-1}, t_{b,i}[\) depends on the solution at time \(t_{b,i}\), which is obtained by solving the problem that holds in the time interval \([t_{b,i}, t_{b,i+1}[\), \(i=1,2,\ldots ,I_b-1\).

The partial differential problem (2)–(3) must be solved by numerical approximations. In particular, in this paper we will use a finite difference scheme enhanced by repeated Richardson extrapolation in both space and time.

2.1 Domain localization of problems (2)–(3)

To solve problem (2)–(3) by finite difference approximation, first of all, domain localization is needed, i.e. the unlimited space domain of problem (2)–(3) must be substituted with a bounded one:

$$\begin{aligned} \Omega _S = [S_{\min }, S_{\max }], \end{aligned}$$
(7)

where \(S_{\min }\) and \(S_{\max }\) have to be chosen such that the error due to the truncation of the domain is negligible. In this paper, since the domain localization is not the focus of our analysis, \(S_{\min }\) and \(S_{\max }\) are chosen according to a simple and common procedure, which is described below. First of all, let \(S_{b,i}\) denote the price of the underlying asset at the barrier date \(t_{b,i}\), \(i=0,\,\ldots ,I_b\). Using the closed-form solution of (1) we have (see, for example, Wilmott 1998):

$$\begin{aligned} S(t) \sim S_{t_{b,i}} e^{\left( r - \frac{\sigma ^2}{2}\right) (t - t_{b,i}) + \sigma (W(t)-W(t_{b,i}))}, \,\,\,\, t \in \, [t_{b,i}, t_{b,i+1}[, \,\,\,\, i=0,1,\ldots ,I_b-1.\nonumber \\ \end{aligned}$$
(8)

Now, based on the probability distribution of the increments of the Wiener process, we have that for any (given) \(t \in \, [t_{b,i}, t_{b,i+1}[\)

$$\begin{aligned} \text {Prob} \left( |W(t)-W(t_{b,i})| \ge 7 \sqrt{\Delta T_{b}} \right) < 2.6 \times 10^{-12}. \end{aligned}$$
(9)

Then, we choose \(S_{\min }\) and \(S_{\max }\) as follows:

$$\begin{aligned} S_{\min } = L e^{\left( r - \frac{\sigma ^2}{2}\right) \Delta T_{b} - 7 \sigma \sqrt{\Delta T_{b}}}, \,\,\,\, S_{\max } = U e^{\left( r - \frac{\sigma ^2}{2}\right) \Delta T_{b} + 7 \sigma \sqrt{\Delta T_{b}}}. \end{aligned}$$
(10)

The above relations yield suitable values of \(S_{\min }\) and \(S_{\max }\). In fact, if at the barrier date \(t_{b,i}\) we have \(L< S(t_{b,i}) < U\) (otherwise, if \(S(t_{b,i}) \le L\) or \(S(t_{b,i}) \ge U\), the option expires), then at any (given) time \(t \in \, ]t_{b,i}, t_{b,i+1}[\) the probability that \(S(t)<S_{\min }\) or \(S(t)>S_{\max }\) is almost null (smaller than \(2.6 \times 10^{-12}\)). Therefore, values of S that lie outside the interval \([S_{\min }, S_{\max }]\) are very extreme, and thus they can be reasonably neglected (they contribute with an almost null probability to the option price).

Thus, we can safely replace the boundary conditions (3) with the following ones:

$$\begin{aligned} {\widetilde{V}}(S_{\min },t) = 0, {\widetilde{V}}(S_{\max },t) = 0, t \in [t_{b,i-1}, t_{b,i}[. \end{aligned}$$
(11)

2.2 The optimal space mesh

Let us think to solve problems (2), (4), (11) by a finite difference method and to enhance its accuracy by Richardson extrapolation. Then, in order to discretize the derivatives with respect to S in (2), a finite set of nodes (space mesh) in \([S_{\min }, S_{\max }]\) has to be employed. However, due to the fact that the solution \({\widetilde{V}}(S,t)\) is not smooth at \(S=E\), \(S = L\) and \(S = U\), the space mesh must be chosen appropriately. In particular, to obtain a smooth pattern of error reduction, which is necessary for the Richardson extrapolation to be effective, one node must be located exactly at \(S = E\) and other two nodes must be located exactly at \(S = L\) and \(S = U\) (see Ritchken 1996; Hyman et al. 2000; Pooley et al. 2003). Moreover, to achieve the highest rate of spatial consistency (i.e., the highest rate of reduction of the truncation error due the space discretization), the nodes must be equally spaced (see, for example, Hirsch 1988, Chapter 4; Duffy 2004). In this paper, for the sake of brevity, a space mesh that satisfies the above two requirements is said aligned and uniform.

In addition, we would also like to freely decide how many discretization nodes to use in each one of the intervals \([S_{\min }, L]\), [LU] and \([U, S_{\max }]\). For instance, we could want to employ a larger number of nodes in the interval [LU] than in the intervals \([S_{\min },L]\) and \([U, S_{\max }]\), because the barrier option price experiences its largest variations in [LU] whereas in \([S_{\min }, L]\) and \([U, S_{\max }]\) it is almost flat and null. Therefore, one should be able to arbitrarily choose both the number of space discretization intervals between \(S_{\min }\) and L, denote it \(N_{L}\), the number of space discretization intervals between L and U, denote it \(N_{M}\), and the number of space discretization intervals between U and \(S_{\max }\), denote it \(N_{U}\).

In substance, we would like to freely specify three integers \(N_{L}\), \(N_{M}\), \(N_{U}\), and, setting \({N}= N_{L}+ N_{M}+ N_{U}\), we would like to have a mesh with \({N}+ 1\) equally spaced nodes \(S_1\), \(S_2\), \(\ldots \), \(S_{{N}+ 1}\) such that \(S_1 = S_{\min }\), \(S_{N_{L}+ 1} = L\), \(S_{j^*} = E\) for some integer \(j^* \in \left\{ N_{L}+ 2, N_{L}+ 3, \ldots , N_{L}+ N_{M}\right\} \), \(S_{N_{L}+ N_{M}+ 1} = U\), \(S_{{N}+ 1} = S_{\max }\). Throughout this paper, a space discretization mesh that is aligned and uniform and also such that \(N_{L}\), \(N_{M}\) and \(N_{U}\) can be decided arbitrarily is referred to as optimal.

3 The mesh optimization procedure

It is clear that in the space domain \(\Omega _S\) an optimal mesh is impossible to obtain. More precisely, we cannot even construct an aligned and uniform mesh, unless \(S_{\min }\), \(S_{\max }\), L, U, E, \(N_{L}\), \(N_{M}\) and \(N_{U}\) do not satisfy very particular (and also restrictive) requirements. For example, let us assume that the nodes \(S_1\), \(S_2\), \(\ldots \), \(S_{{N}+ 1}\) are such that \(S_{N_{L}+ 1} = L\) and \(S_{N_{L}+ N_{M}+ 1} = U\). Therefore, if we want this mesh to be uniform, the distance between two consecutive nodes must be:

$$\begin{aligned} \Delta S_M = \frac{U-L}{N_{M}}. \end{aligned}$$
(12)

Then, clearly, we can have one of the nodes equal to the strike price E only in the very special circumstance where

$$\begin{aligned} l_E = \frac{E-L}{\Delta S_M} \end{aligned}$$
(13)

is an integer value. By contrast, if \(l_E\) is not an integer, the strike price E is internal to the interval \(\left[ S_{N_{L}+ j_E + 1}, S_{N_{L}+ j_E + 2}\right] \), where \(j_E\) denotes the integer part of \(l_E\).

Nevertheless, as we are going to show, it is possible to find a function \(\phi : \Omega _S \rightarrow {\mathbb {R}}\) that satisfies the following conditions:

  1. (C1):

    \(\phi \) is a strictly increasing \(C^{\infty }\) function;

  2. (C2):

    if we set \(z_{\min } = \phi (S_{\min })\) and \(z_{\max } = \phi (S_{\max })\), and choose \({N}+1\) equally spaced points in \([z_{\min }, z_{\max }]\), i.e. \(z_i = z_{\min } + (i-1) \Delta z\), \(i=1,2,\ldots ,{N}+1\), where

    $$\begin{aligned} \Delta z = \frac{z_{\max } - z_{\min }}{{N}}, \end{aligned}$$
    (14)

    then we have: \( z_{N_{L}+ 1} = \phi (L), \,\,\,\,\, z_{j_E} = \phi (E), \,\,\,\,\, z_{N_{L}+ N_{M}+ 1} = \phi (U), \) for some positive integer \(j_E\).

That is, if we denote:

$$\begin{aligned} \Omega _z = [z_{\min }, z_{\max }] = [\phi (S_{\min }), \phi (S_{\max })], \end{aligned}$$
(15)

the function \(\phi \) which we are going to determine maps the original space domain \(\Omega _S = [S_{\min }, S_{\max }]\) to the domain \(\Omega _z\), where we can choose \({N}+1\) equally spaced points \(z_1\), \(z_2\), \(\ldots \), \(z_{{N}+ 1}\) such that \(z_1 = z_{\min }\), \(z_{{N}+ 1}=z_{\max }\) and, in addition, \(z_{N_{L}+ 1}\), \(z_{j_E}\) and \(z_{N_{L}+ N_{M}+ 1}\) coincide with the transformed lower barrier, strike price and upper barrier, respectively.

Therefore, if we apply the change of coordinates

$$\begin{aligned} z = \phi (S), \end{aligned}$$
(16)

to problem (2), (4), (11), we end up with a partial differential problem that can be discretized by using an optimal mesh (actually, we will have an optimal mesh in the computational domain \(\Omega _z\)).

Remark 1

Condition (C1) ensures that the function \(\phi \) is invertible in \(\Omega _S\), such that we can actually apply the change of variables (16) to solve the partial differential equation (2) (if the function \(\phi \) was not invertible, then we could not go back from the computational domain \(\Omega _z\) to the true domain \(\Omega _S\)). Furthermore, the fact that \(\phi \) is \(C^{\infty }\) is crucial as well, since it guarantees that the partial differential equation that we are going to obtain after applying the transformation of coordinates is a partial differential equation with smooth coefficients (non-smooth coefficients would inevitably spoil the accuracy of the space discretization scheme).

The function \(\phi \) will be obtained as the composition product of other two functions, which we denote \(T_1\) and \(T_2\). Precisely, we are going to construct the function \(\phi : \Omega _S \rightarrow \Omega _z\) as follows:

$$\begin{aligned} \phi (S) = T_2(T_1(S)), \end{aligned}$$
(17)

where the functions \(T_1\) and \(T_2\) will be chosen appropriately. In particular, \(T_1\) will be used to transform the interval [LU] into a new interval \([T_1(L), T_1(U)]\) where we can choose \(N_{M}+ 1\) equally spaced points such that one of them coincide with \(T_1(E)\). That is, first of all, by means of a suitable function \(T_1\), we will accommodate the interval between the two barriers, such to align the space discretization mesh with the strike price. Then, the function \(T_2\) will be used to transform the whole set of points \([T_1(S_{\min }), T_1(S_{\max })]\) into the interval \(\Omega _z\) where we can choose nodes \(z_1\), \(z_2\), \(\ldots \), \(z_{{N}+ 1}\) that satisfy condition (C2). In particular, \(T_2\) will accommodate the intervals \([T_1(S_{\min }), T_1(L)]\) and \([T_1(U), T_1(S_{\max })]\), such to obtain an optimal mesh in the whole computational domain \([z_{\min }, z_{\max }]\).

3.1 Constructing \(\varvec{T_1}\)

In order to construct the function \(T_1\) the following result is needed.

Proposition 1

Let \(l_E\) be defined according to (12), (13), and let \(j_E\) denote the integer part of \(l_E\). Moreover, assume that \(l_E\) is greater than one and is not an integer. Then, the number of positive solutions of the following transcendental equation in the \(\beta \) variable

$$\begin{aligned} \frac{j_E e^{\frac{\beta U}{E}} + (N_{M}-j_E)e^{\frac{\beta L}{E}}}{N_{M}} - e^\beta = 0 \end{aligned}$$
(18)

is exactly equal to one. Moreover, the positive solution of (18), which we denote \(\beta ^*\), is such that:

$$\begin{aligned} \beta ^* < - \frac{E}{U-E} \ln \left( \frac{j_E}{N_{M}}\right) . \end{aligned}$$
(19)

Before proving Proposition 1 let us make some useful comments on it.

Remark 2

The assumption that \(l_E\) is not an integer is not restrictive at all. In fact, if \(l_E\) is an integer, then Proposition 1 is not needed at all, because the strike price E does already coincide with one of the equally spaced meshpoints \(S_{N_{L}+1}\), \(S_{N_{L}+2}\), \(\ldots \), \(S_{N_{L}+N_{M}+1}\) and the change of coordinates \(T_1\) is not applied (better saying, in such a case we would choose \(T_1\) to be the identity map, see (34)).

Remark 3

The assumption that \(l_E\) is greater than one is a sort of “minimal requirement” that one has to satisfy when solving problem (2), (4), (11) by a lattice-based scheme. In fact, if it was \(l_E < 1\), then, according to (13), both the lower barrier L and the strike E would be located within the same discretization interval of length \(\Delta S_M\). This means that the space mesh which we are trying to use is unreasonably too coarse, as it does not even allows us to distinguish between the strike price and the lower barrier. Obviously, if we had \(l_E < 1\), then we would simply have to select a larger value of \(N_{M}\), such to have L and E separated by at least one space discretization node.

Proof of Proposition 1

Let us consider the function

$$\begin{aligned} f(\beta ) = \frac{j_E e^{\frac{\beta U}{E}} + (N_{M}-j_E)e^{\frac{\beta L}{E}}}{N_{M}} - e^\beta . \end{aligned}$$
(20)

We shall prove that f has a unique positive root. To this aim, we note that

$$\begin{aligned} f(0)=0, \end{aligned}$$
(21)

and, due to the fact that \(U>E>L\),

$$\begin{aligned} \lim _{\beta \rightarrow +\infty } f(\beta ) = +\infty . \end{aligned}$$
(22)

Furthermore, f is of class \(C^{\infty }\) and

$$\begin{aligned} f'(\beta ) = \frac{j_E\frac{U}{E} e^{\frac{\beta U}{E}} + (N_{M}-j_E)\frac{L}{E}e^{\frac{\beta L}{E}}}{N_{M}} - e^\beta , \end{aligned}$$
(23)

which yields

$$\begin{aligned} f'(0) = \frac{j_E\frac{U}{E} + (N_{M}-j_E)\frac{L}{E}}{N_{M}} - 1. \end{aligned}$$
(24)

Since \(j_E\) is the integer part of \(l_E\), and owing to (12) and (13) we have

$$\begin{aligned} j_E < \frac{E-L}{U-L}N_{M}. \end{aligned}$$
(25)

From relations (24) and (25) we easily obtain

$$\begin{aligned} f'(0)<0. \end{aligned}$$
(26)

Relations (21), (22), (26) (and the continuity of f), imply that f has at least one root \(\beta ^* >0\).

Let us show that \(\beta ^*\) is the unique positive solution of (18). To this aim, let us assume instead that the function f has two positive roots, say \(\beta _1^*\) and \(\beta _2^*\), with \(\beta _2^* > \beta _1^*\). Then, by using (21), (22), (26), we immediately obtain that there exist two values of \(\beta \), say \(\beta _1\) and \(\beta _2\), such that

$$\begin{aligned} 0< \beta _1< \beta _2 \le \beta _2^*, f'(\beta _1)=0, f'(\beta _2)=0, f(\beta _1)<0, f(\beta _2) \ge 0.\nonumber \\ \end{aligned}$$
(27)

Let us consider the following function:

$$\begin{aligned} f_1(\beta ) = \frac{j_E(E-U) e^{\frac{\beta U}{E}} + (N_{M}-j_E)(E-L)e^{\frac{\beta L}{E}}}{N_{M}E}. \end{aligned}$$
(28)

Note that, according to (20), (23), the function \(f_1\) takes the same values of f at all those points \(\beta \) such that \(f'(\beta )=0\). In fact, from \(f'(\beta )=0\) and (23) it follows that

$$\begin{aligned} e^\beta = \frac{j_E\frac{U}{E} e^{\frac{\beta U}{E}} + (N_{M}-j_E)\frac{L}{E}e^{\frac{\beta L}{E}}}{N_{M}}, \end{aligned}$$
(29)

which, if substituted in (20), yields \(f_1(\beta )=f(\beta )\). Therefore, according to (27), we must have:

$$\begin{aligned} f_1(\beta _1) <0, f_1(\beta _2) \ge 0. \end{aligned}$$
(30)

These two relations and the continuity of \(f_1\) imply that \(f_1\) must have at least one root in the interval \(]\beta _1, \beta _2]\). Moreover, from (28) we have:

$$\begin{aligned} f_1(0) = \frac{j_E(L-U) + N_{M}(E-L)}{N_{M}E}, \end{aligned}$$
(31)

which, together with (25), implies

$$\begin{aligned} f_1(0) >0. \end{aligned}$$
(32)

By setting (28) equal to zero, we obtain a very simple exponential equation from solving which we can see that \(f_1\) has a unique and positive real root. Now, according to (32) and to the first of (30), such a unique root should be located between 0 and \(\beta _1\). Nevertheless, this is in contradiction with the fact that \(f_1\) must have a root in the interval \(]\beta _1, \beta _2]\), and so, by absurd, f cannot have more than one positive solution.

Finally, relation (19) easily follows from (21), (26), from the continuity of f and from the fact that

$$\begin{aligned} f\left( - \frac{E}{U-E} \ln \left( \frac{j_E}{N_{M}}\right) \right) = \frac{j_E}{N_{M}} e^{-\frac{E}{U-E}} >0. \end{aligned}$$
(33)

We are now in the position to state the first change of coordinates to be applied. The function \(T_1: \Omega _S \rightarrow R^+\) is chosen as follows:

$$\begin{aligned} T_1(S) = \left\{ \begin{array}{ll} e^{\beta ^* \frac{S}{E}}, &{} \text {if} \,\, l_e \,\, \text {is not an integer}, \\ S &{} \text {if} \,\, l_e \,\, \text {is an integer}, \end{array}\right. \end{aligned}$$
(34)

where \(\beta ^*\) is the positive solution of (18), which exists unique according to Proposition (1). Note that \(T_1\) reduces to the identity function if \(l_e\) is an integer, because in such a case the node \(S_{j_E}\) does already coincide with the strike price E, and thus, actually, in the price interval [LU] no transformation of variables is needed (see also Remark 2).

Let us define:

$$\begin{aligned} y_{\min } = T_1(S_{\min }), \,\,\, y_{L} = T_1(L), \,\,\, y_{E} = T_1(E), \,\,\, y_{U} = T_1(U), \,\,\, y_{\max } = T_1(S_{\max }).\nonumber \\ \end{aligned}$$
(35)

Then, let us discretize the interval \([y_L, y_U]\) using \(N_{M}+ 1\) equally spaced points \(y_L\), \(y_L + \Delta y\), \(y_L + 2 \Delta y \), \(\ldots \), \(y_U\), where

$$\begin{aligned} \Delta y = \frac{y_U - y_L}{N_{M}}. \end{aligned}$$
(36)

Then, the following Proposition holds. \(\square \)

Proposition 2

The function \(T_1\) is \(C^{\infty }[L, U]\) and is strictly increasing. Moreover, if \(y_L\), \(y_E\) are defined as in (35) and \(j_E\) is the integer part of \(l_E\) given by (13), we have:

$$\begin{aligned} y_L + j_E \Delta y = y_E. \end{aligned}$$
(37)

Proof of Proposition 2

The first part of Proposition 2 follows immediately from (34). Moreover, (37) is a direct consequence of (34), (35), (36) and of the fact that \(\beta ^*\) is a solution of (18). \(\square \)

Remark 4

According to Proposition 2, one of the \(N_{M}+1\) equally spaced points that we have chosen in \([y_L, y_U]\), i.e. the point \(y_{j_E}\), exactly coincides with the (transformed) strike price \(y_E\).

3.2 Constructing \(\varvec{T_2}\)

In the general case, the transformation of coordinates (35) will not satisfy condition (C2), since, unless considering very special values of \(S_{\min },L,E,U,S_{\max },N_{L},N_{M},N_{U}\), we cannot have \({N}\Delta y = y_{\max } - y_{\min }\) with \({N}= N_{L}+N_{M}+N_{U}\). In fact, if the change of coordinates \(T_1\) allows us to transform the interval \([y_L, y_U]\) such that (37) holds true, the intervals \([y_{\min }, y_L]\) and \([y_U, y_{\max }]\) (corresponding, in the original domain, to \([S_{\min }, L]\) and \([U, S_{\max }]\), respectively), still need to be accommodated (actually, we have no guarantee that if we choose \({N}+1\) equally spaced nodes in \([y_{\min }, y_{\max }]\), two of them exactly coincide with the transformed barriers \(y_L\) and \(y_U\)). Therefore, we shall resort to a second transformation of coordinates \(T_2\), which, in turn, requires some mathematical preliminaries.

Lemma 3

Let \(q \in ]-1,0[\) and let the function \(h:{\mathbb {R}}^+ \rightarrow {\mathbb {R}}\) be defined as follows:

$$\begin{aligned} h(x) = e^{-x} - \sqrt{\pi x}(1 -{\textstyle {\text {erf}}}(\sqrt{x})), \end{aligned}$$
(38)

where erf\((\cdot )\) is the error function:

$$\begin{aligned} {\textstyle {\text {erf}}}(x) = \frac{2}{\sqrt{\pi }} \int _0^x e^{-t^2} dt. \end{aligned}$$
(39)

Then the equation

$$\begin{aligned} h(x) + q = 0 \end{aligned}$$
(40)

has a unique positive root, which, in order to stress out its dependence on q, we denote by a(q).

Proof of Lemma 3

Let us observe that \(h(0)= 1\) and \(\displaystyle {\lim \nolimits _{x \rightarrow +\infty } h(x) = 0}\). Then, since \(-1< q < 0\), and h is a continuous function in \([0, +\infty )\), equation (40) has at least one positive root. Moreover, we have:

$$\begin{aligned} h'(x) = - \frac{\sqrt{\pi }}{2 \sqrt{x}}(1 -{\textstyle {\text {erf}}}(\sqrt{x})), \end{aligned}$$
(41)

so that h is a strictly decreasing function in \([0, +\infty [\), and the uniqueness of a(q) follows.

Let us define:

$$\begin{aligned} q_L = \frac{N_{L}\Delta y}{y_L - y_{\min }} - 1 , \,\,\,\,\,\,\, q_U = \frac{N_{U}\Delta y}{y_{\max } - y_U} - 1, \end{aligned}$$
(42)

and let the functions \(g_L:\) \([y_{\min }, y_L[ \rightarrow {\mathbb {R}}\) and \(g_U:\) \(]y_U, y_{\max }] \rightarrow {\mathbb {R}}\) be defined as follows:

$$\begin{aligned} g_L(y)= & {} \left\{ \begin{array}{ll} y - (y_L - y_{\min }) {\widetilde{g}}(y,q_L,y_L,y_{\min }) &{} \text {if}\,\, -1<q_L<0, \\ y + q_L (y- y_L) e^{1- \frac{y_L - y_{\min }}{y_L - y}} &{} \text {if} \, q_L \ge 0, \end{array} \right. \end{aligned}$$
(43)
$$\begin{aligned} g_U(y)= & {} \left\{ \begin{array}{ll} y - (y_U - y_{\max }) {\widetilde{g}}(y,q_U,y_U,y_{\max }) &{} \text {if}\,\, -1<q<0, \\ y + q_U (y- y_U) e^{1- \frac{y_U - y_{\max }}{y_U - y}} &{} \text {if} \, q_U \ge 0, \end{array} \right. \end{aligned}$$
(44)

where

$$\begin{aligned} {\widetilde{g}}(y,q,y_1,y_2)= & {} \left( -\frac{y_1-y}{y_1 - y_2} e^{-\frac{a(q)(y_1 - y_2)^2}{(y_1-y)^2}} \right. \nonumber \\&\left. + \sqrt{\pi a(q)} \left( 1-{\textstyle {\text {erf}}}\left( \frac{\sqrt{a(q)}(y_1 - y_2)}{y_1-y}\right) \right) \right) , \end{aligned}$$
(45)

and a(q) denotes the (unique) positive solution of equation (40). \(\square \)

Lemma 4

The functions \(g_L\) and \(g_U\) are infinitely smooth in \([y_{\min }, y_L[\) and \(]y_U, y_{\max }]\), respectively and are such that

$$\begin{aligned} \lim _{y \rightarrow y_L^-} g_L(y)= & {} y_L, \,\,\,\,\,\, \lim _{y \rightarrow y_U^+} g_U(y) = y_U, \end{aligned}$$
(46)
$$\begin{aligned} \lim _{y \rightarrow y_L^-} {g'_L(y)}{}= & {} 1, \,\,\,\,\,\, \lim _{y \rightarrow y_U^+} {g'_U(y)} = 1, \end{aligned}$$
(47)
$$\begin{aligned} \lim _{y \rightarrow y_L^-}{g^{(n)}_L(y)}{}= & {} 0, \,\,\,\,\,\, \lim _{y \rightarrow y_U^+} {g^{(n)}_U(y)}{} = 0, \,\,\,\, n=2,3,4,5,\ldots , \end{aligned}$$
(48)
$$\begin{aligned} {g'_L(y)}> & {} 0 \,\,\, \forall y \in ]y_{\min }, y_L[, \,\,\,\,\,\, {g'_U(y)}{} > 0 \,\,\, \forall y \in ]y_U,y_{\max }[, \end{aligned}$$
(49)
$$\begin{aligned} {g''_L(y)}{}> & {} 0 \,\,\, \forall y \in ]y_{\min }, y_L[ \,\,\, \text {if} \,\,\, q_L<0, \end{aligned}$$
(50)
$$\begin{aligned} {g''_L(y)}{}< & {} 0 \,\,\, \forall y \in ]y_{\min }, y_L[ \,\,\, \text {if} \,\,\, q_L>0, \end{aligned}$$
(51)
$$\begin{aligned} {g''_U(y)}{}> & {} 0 \,\,\, \forall y \in ]y_U,y_{\max }[\,\,\, \text {if} \,\,\, q_U<0, \end{aligned}$$
(52)
$$\begin{aligned} {g''_U(y)}{}< & {} 0 \,\,\, \forall y \in ]y_U,y_{\max }[\,\,\, \text {if} \,\,\, q_U>0, \end{aligned}$$
(53)
$$\begin{aligned} \frac{y_L - g_L(y_{\min })}{y_L-y_{\min }}= & {} q_L+1, \,\,\,\,\,\, \frac{y_U - g_U(y_{\max })}{y_U-y_{\max }} = q_U+1. \end{aligned}$$
(54)

Proof of Lemma 4

The fact that \(g_L\) and \(g_U\) are infinitely smooth in their domains, as well as relations (46) are trivial. Moreover, (47)–(53) can be immediately obtained by taking derivatives in (43)–(45). In particular, we can easily compute the following relations, which will be useful for later purposes:

$$\begin{aligned} {g'_L(y)}{}= & {} \left\{ \begin{array}{ll} 1 - e^{- \frac{a(q_L)(y_L - y_{\min })^2}{(y_L - y)^2}} &{} \text {if}\,\, -1<q_L<0, \\ 1 + q_L \left( 1+ \frac{y_L-y_{\min }}{y_L-y} \right) e^{1- \frac{y_L - y_{\min }}{y_L - y}} &{} \text {if} \,\,\, q_L \ge 0, \end{array} \right. \end{aligned}$$
(55)
$$\begin{aligned} {g'_U(y)}{}= & {} \left\{ \begin{array}{ll} 1 - e^{- \frac{a(q_U)(y_U - y_{\max })^2}{(y_U - y)^2}} &{} \text {if}\,\, -1<q_U<0, \\ 1 + q_U \left( 1+ \frac{y_U-y_{\max }}{y_U-y} \right) e^{1- \frac{y_U - y_{\max }}{y_U - y}} &{} \text {if} \,\,\, q_U \ge 0, \end{array} \right. \end{aligned}$$
(56)
$$\begin{aligned} {g''_L(y)}{}= & {} \left\{ \begin{array}{ll} 2 a(q_L) \frac{(y_L - y_{\min })^2}{(y_L - y)^3} e^{- \frac{a(q_L)(y_L - y_{\min })^2}{(y_L - y)^2}} &{} \text {if}\,\, -1<q_L<0, \\ q_L \frac{(y_L-y_{\min })^2}{(y_L-y)^3} e^{1- \frac{y_L - y_{\min }}{y_L - y}} &{} \text {if} \,\,\, q_L \ge 0, \end{array} \right. \end{aligned}$$
(57)
$$\begin{aligned} {g''_U(y)}{}= & {} \left\{ \begin{array}{ll} 2 a(q_U) \frac{(y_U - y_{\max })^2}{(y_U - y)^3} e^{- \frac{a(q_U)(y_U - y_{\max })^2}{(y_U - y)^2}} &{} \text {if}\,\, -1<q_U<0, \\ q_U \frac{(y_U-y_{\max })^2}{(y_U-y)^3} e^{1- \frac{y_U - y_{\max }}{y_U - y}} &{} \text {if} \,\,\, q_U \ge 0. \end{array} \right. \end{aligned}$$
(58)

Finally, let us focus our attention on the first of relations (54) (the proof of the second one is analogous). If \(q_L \ge 0\), then the first of relations (54) is rather trivial (it can be obtained by setting \(y = y_{\min }\) in (43)). Instead, if \(0< q_L < 1\), the first of (53) follows from setting \(y = y_{\min }\) in (43) and from the fact that \(a(q_L)\) satisfies equation (40).

We are now in the position to state the change of coordinates \(T_2: [y_{\min }, y_{\max }] \rightarrow {\mathbb {R}}\):

$$\begin{aligned} T_2(y) = \left\{ \begin{array}{ll} g_L(y) &{} \text {if} \,\, y_{\min } \le y< y_L, \\ y &{} \text {if} \,\, y_{L} \le y \le y_U, \\ g_U(y) &{} \text {if} \,\, y_U < y \le y_{\max }, \\ \end{array} \right. \end{aligned}$$
(59)

and we have the following result. \(\square \)

Lemma 5

The function \(T_2\) is \(C^{\infty }[y_{\min }, y_{\max }]\) and is strictly increasing. Moreover

$$\begin{aligned} \frac{T_2(y_L) - T_2(y_{\min })}{N_{L}} = \frac{T_2(y_U) - T_2(y_L)}{N_{M}} = \frac{T_2(y_{\max }) - T_2(y_{U})}{N_{U}} = \Delta y. \end{aligned}$$
(60)

Proof of Lemma 5

The functions \(g_L\) and \(g_U\) are \(C^{\infty }[y_{\min }, y_L)\) and \(C^{\infty }(y_U, y_{\max }]\), respectively, due to Lemma 4 and relation (59). Therefore, using (46), (47) and (48) we obtain that \(T_2\) is \(C^{\infty }[y_{\min }, y_{\max }]\). Moreover, \(T_2\) is strictly increasing because of (49). Finally, (60) follows from (36), (42), (54) and (59). \(\square \)

3.3 Constructing \(\varvec{\phi }\)

Once the transformations of coordinates \(T_1\) and \(T_2\) are determined according to (34) and (59), respectively, we can finally construct the function \(\phi : \Omega _S \rightarrow \Omega _z\) using (17), and we have the following proposition.

Proposition 6

The function \(\phi \) satisfies conditions (C1) and (C2).

Proof

Proposition 6 is a direct consequence of Lemma 5 and Proposition 2.

Therefore, let us consider the transformation of coordinates:

$$\begin{aligned} z = \phi (S), \end{aligned}$$
(61)

which maps the original domain \(\Omega _S\) to the domain \(\Omega _z\), where

$$\begin{aligned} z_{\min }=\phi (S_{\min }), \,\,\,\, z_{\max }=\phi (S_{\max }). \end{aligned}$$
(62)

Note that, since the function \(\phi \) satisfies condition (C1), relation (61) is invertible:

$$\begin{aligned} S = \phi ^{-1}(z). \end{aligned}$$
(63)

Then let us define:

$$\begin{aligned} V(z,t) = {\widetilde{V}}(\phi ^{-1} (z), t). \end{aligned}$$
(64)

By using the transformation of coordinates (61) and (64), the partial differential problem (2), (4), (11) can be rewritten as follows:

$$\begin{aligned}&\frac{\partial {V}(z,t)}{\partial t} + \alpha _1(z) \frac{\partial {V}(z,t)}{\partial z} + \alpha _2(z) \frac{\partial ^2{V}(z,t)}{\partial z^2} - r{V}(z,t) = 0, t \in [t_{b,i-1}, t_{b,i}[,\nonumber \\ \end{aligned}$$
(65)
$$\begin{aligned}&{V}(z_{\min },t) = 0, {V}(z_{\max },t) = 0, t \in [t_{b,i-1}, t_{b,i}[, \end{aligned}$$
(66)
$$\begin{aligned}&{V}(z,t_{b,i}) = \psi _i(z), \end{aligned}$$
(67)

where

$$\begin{aligned} \alpha _1(z)= & {} r \phi ^{-1}(z) \phi '(z) + \frac{1}{2}\sigma ^2 \left( \phi ^{-1}(z)\right) ^2 \phi ''(z), \nonumber \\ \alpha _2(z)= & {} \frac{1}{2}\sigma ^2 \left( \phi ^{-1}(z) \phi '(z)\right) ^2, \end{aligned}$$
(68)
$$\begin{aligned} \psi _{I_b}(z)= & {} \left\{ \begin{array}{ll} E \max \left( \displaystyle {\frac{\ln z}{\beta ^*}}-1,0\right) &{} \text {if } z_L< z < z_U, \\ 0 &{} \text {if } z \le z_L \text { or } z\ge z_U, \end{array} \right. \end{aligned}$$
(69)
$$\begin{aligned} \psi _i(z)= & {} \left\{ \begin{array}{ll} V(z,t_{b,i} &{} \text {if } z_L< z < z_U, \\ 0 &{} \text {if } z \le z_L \text { or } z\ge z_U, \end{array} \right. \end{aligned}$$
(70)
$$\begin{aligned} \phi '(z)= & {} \left\{ \begin{array}{ll} \frac{\beta ^*}{E} e^{\frac{\beta ^* \phi ^{-1}(z)}{E}} g'_L\left( \frac{\beta ^*}{E} e^{\frac{\beta ^* \phi ^{-1}(z)}{E}}\right) &{} \text {if } z < z_L, \\ \frac{\beta ^*}{E} e^{\frac{\beta ^* \phi ^{-1}(z)}{E}} &{} \text {if } z_L \le z \le z_U, \\ \frac{\beta ^*}{E} e^{\frac{\beta ^* \phi ^{-1}(z)}{E}} g'_U\left( \frac{\beta ^*}{E} e^{\frac{\beta ^* \phi ^{-1}(z)}{E}}\right) &{} \text {if } z > z_U, \end{array} \right. \end{aligned}$$
(71)
$$\begin{aligned} \phi ''(z)= & {} \left\{ \begin{array}{ll} \left( \frac{\beta ^*}{E}\right) ^2 e^{\frac{\beta ^* \phi ^{-1}(z)}{E}} g'_L\left( \frac{\beta ^*}{E} e^{\frac{\beta ^* \phi ^{-1}(z)}{E}}\right) \!+\! \left( \frac{\beta ^*}{E}\right) ^3 e^{\frac{2\beta ^* \phi ^{-1}(z)}{E}} g''_L\left( \frac{\beta ^*}{E} e^{\frac{\beta ^* \phi ^{-1}(z)}{E}}\right) &{} \text {if } z < z_L, \\ \left( \frac{\beta ^*}{E}\right) ^2 e^{\frac{\beta ^* \phi ^{-1}(z)}{E}} &{} \text {if } z_L \!\le \! z \!\le \! z_U, \\ \left( \frac{\beta ^*}{E}\right) ^2 e^{\frac{\beta ^* \phi ^{-1}(z)}{E}} g'_U\left( \frac{\beta ^*}{E} e^{\frac{\beta ^* \phi ^{-1}(z)}{E}}\right) \!+\! \left( \frac{\beta ^*}{E}\right) ^3 e^{\frac{2\beta ^* \phi ^{-1}(z)}{E}} g''_U\left( \frac{\beta ^*}{E} e^{\frac{\beta ^* \phi ^{-1}(z)}{E}}\right) &{} \text {if } z > z_U. \end{array} \right. \nonumber \\ \end{aligned}$$
(72)

Note that the coefficients \(\alpha _1\) and \(\alpha _2\) in (68) need to be computed only one time, at the beginning of the numerical simulation. Moreover, once the inverse function \(\phi ^{-1}\) is obtained (see the next section), the functions \(\phi '\) and \(\phi ''\) in (71) and (72) can be evaluated very easily and quickly on any standard computer. \(\square \)

4 Applying the transformation of coordinates

To use the change of coordinates (17) we proceed as follows. First of all, once \(N_{L}\), \(N_{U}\), \(N_{M}\) are chosen (i.e. decided by the user), we obtain \(S_{\min }\) and \(S_{\max }\) according to (10), we calculate \(j_E\) as the integer part of \(l_E\) defined as in (13), and thus we compute the unique positive solution \(\beta ^*\) of equation (18) (this task is accomplished by applying the bisection method, whose convergence is theoretically established below).

To this point, the function \(T_1\) is known (see (34)), and so we can evaluate \(y_{\min }\), \(y_{L}\), \(y_{E}\), \(y_{U}\), \(y_{\max }\) (according to (35)), \(\Delta y\) (according to (36)), \(q_L\) and \(q_U\) (according to (42)). Then, we compute \(a(q_L)\) and \(a(q_U)\) as the unique positive solutions of equation (40) with \(q=q_L\) and \(q=q_U\), respectively (this is done by applying the bisection method, whose convergence is theoretically established below).

To this point, we can evaluate the functions \(g_L\) and \(g_U\) (see (43) and (44)) and thus the function \(T_2\) is known too (see (59)). Therefore, the change of variables (16) is completely determined, and in particular we can use it to compute \(z_{\min }\) and \(z_{\max }\) according to (61). Then, in the computational domain \(\Omega _z = [z_{\min }, z_{\max }]\) we can construct the optimal mesh of \({N}+1\) nodes \(z_1\), \(z_2\), \(\ldots \), \(z_{{N}+1}\) such that \(z_1 = z_{\min } = \phi (S_{\min })\), \(z_{N_{L}+ 1} = \phi (L)\), \(z_{j_E} = \phi (E)\), \(z_{N_{L}+ N_{M}+ 1} = \phi (U)\), \(z_{{N}+1}=z_{\max }= \phi (S_{\max })\).

Now, once \(z_1\), \(z_2\), \(\ldots \), \(z_{{N}+1}\) are obtained, according to (63), (64), (68), (71), (72) we have to evaluate the inverse function \(\phi ^{-1}(z)\) at \(z=z_1\), \(z_2\), \(\ldots \), \(z_{{N}+1}\) (in order to solve the partial differential equation (65) we need to compute its coefficients \(\alpha _1\) and \(\alpha _2\) at the nodes of the mesh). To this aim, we observe that we have \(\phi ^{-1}(z_1)=y_{\min }\), \(\phi ^{-1}(z_{{N}+1})=y_{\max }\) and \(\phi ^{-1}(z_i)=z_i\) for \(i=N_{L}+1, N_{L}+2, \ldots , N_{L}+N_{M}+1\). However, for \(i=2,3,\ldots ,N_{L}\) and \(i=N_{L}+N_{M}+2,N_{L}+N_{M}+3,\ldots ,{{N}}\), \(\phi ^{-1}(z_i)\) is not known and need to be calculated based on (17), (34) and (59). In particular, owing to (17), in order to compute \(\phi ^{-1}(z_i)\) for \(i=2,3,\ldots ,N_{L}\) and \(i=N_{L}+N_{M}+2,N_{L}+N_{M}+3,\ldots ,{{N}}\), we have to solve the equations

$$\begin{aligned}&T_2(y) - z_i = 0, \,\,\,\, y \in \, ]y_{\min }, y_L[, \,\,\,\, i=2,3,\ldots ,N_{L}, \end{aligned}$$
(73)
$$\begin{aligned}&{g}_U(y) - z_i = 0, \,\,\,\, y \in \, ]y_U, y_{\max }[ \,\,\,\, i=N_{L}+N_{M}+2,N_{L}+N_{M}+3,\ldots ,{{N}},\nonumber \\ \end{aligned}$$
(74)

which, owing to (59), requires us to solve

$$\begin{aligned}&{g}_L(y) - z_i = 0, \,\,\,\, y \in \, ]y_{\min }, y_L[, \,\,\,\, i=2,3,\ldots ,N_{L}, \end{aligned}$$
(75)
$$\begin{aligned}&{g}_U(y) - z_i = 0, \,\,\,\, y \in \, ]y_U, y_{\max }[ \,\,\,\, i=N_{L}+N_{M}+2,N_{L}+N_{M}+3,\ldots ,{{N}}.\nonumber \\ \end{aligned}$$
(76)

Note that, due to (46), (49), and to the fact that \({g}_L(y_{\min })=z_1\), \({g}_L(y_{\max })=z_{{N}+1}\), the solutions of (75) and (76) exist unique (they will be computed by using the Newton algorithm, whose convergence is theoretically established below).

In summary, the overall mesh optimization procedure requires us to solve equations (18), (40), (75), (76). Now, these equations do not have exact closed-form solutions. Nevertheless, we can solve them (with machine precision) by using bisection and Newton methods that are very simple to implement and whose convergence can be proven theoretically. In fact, we have the following results:

Lemma 7

Let the bisection method be used to compute the (unique) positive solution \(\beta ^*\) of equation (18), starting from the interval \(\left[ 0, - \frac{E}{U-E} \ln \left( \frac{j_E}{N_{M}}\right) \right] \). Then, such an algorithm does always converge (with its usual dichotomic convergence rate).

Proof of Lemma 7

Let us observe from Proposition 1 and from its proof that the left hand side of (18) is a continuous function of \(\beta \) and is negative if \(\beta \in ]0, \beta ^*[\) and is positive if \(\beta \in \big ]\beta ^* - \frac{E}{U-E} \ln \left( \frac{j_E}{N_{M}}\right) \big ]\). Then the thesis immediately follows.

Lemma 8

Let q be any real number in \(]-1,0[\). Moreover, let the bisection method be used to compute the (unique) solution a(q) of equation (40) (with h given by (38)), starting from the interval \([0, -\ln (-q)]\). Then, such an algorithm does always converge (with its usual dichotomic convergence rate).

Proof of Lemma 8

Let us observe from (38) that \(h(0)+q=1+q\) and \(h(-\ln (-q))+q=- \sqrt{\pi x}(1 -{\textstyle {\text {erf}}}(\sqrt{x}))\). Then, the Lemma follows immediately by noting that \(q \in ]-1,0[\) (so that \(h(0)>0\)) and \(1 -{\textstyle {\text {erf}}}(\sqrt{x})>0\) (so that \(h(-\ln (-q))<0\)).

Moreover, let the functions \({\overline{g}}_L: [y_{\min }, y_L] \rightarrow {\mathbb {R}}\) and \({\overline{g}}_U: [y_U, y_{\max }] \rightarrow {\mathbb {R}}\) be defined as the continuations of the functions \({g}_L\) and \({g}_U\) (see (43) and (44)), respectively, that is

$$\begin{aligned} {\overline{g}}_L(y)= & {} \left\{ \begin{array}{ll} g_L(y) &{} \text {if} \,\, y_{\min } \le y < y_L, \\ y_L &{} \text {if} \,\, y = y_L, \end{array} \right. \end{aligned}$$
(77)
$$\begin{aligned} {\overline{g}}_U(y)= & {} \left\{ \begin{array}{ll} g_U(y) &{} \text {if} \,\, y_U < y \le y_{\max }, \\ y_U &{} \text {if} \,\, y = y_U. \end{array} \right. \end{aligned}$$
(78)

Note that, from Lemma 4, it follows that the \({\overline{g}}_L\) and \({\overline{g}}_U\) are infinitely smooth in \([y_{\min }, y_L]\) and \([y_U, y_{\max }]\), respectively.

The solutions of equations (75), (76) are obtained based on the following results. \(\square \)

Lemma 9

Let z be any real number in \(]g_L(y_{\min }), y_L[\) and let the Newton method be used to approximate the (unique) solution of equation:

$$\begin{aligned} {\overline{g}}_L(y) - z = 0, \,\,\,\, y \in [y_{\min }, y_L], \end{aligned}$$
(79)

starting from the initial guess \(y = y_L\) if \(q_L<0\) or \(y=y_{\min }\) if \(q_L\ge 0\). Then, such an algorithm does always converge (with its usual quadratic convergence rate).

Proof of Lemma 9

For the sake of brevity, let us only consider the case \(q_L<0\) (the case \(q_L \ge 0\) is perfectly analogous). According to Lemma 4, \({\overline{g}}_L\) is an infinitely smooth increasing and convex function. Then, the thesis follows. \(\square \)

Lemma 10

Let z be any real number in \(]y_U, g_U(y_{\max })[\) and let the Newton method be used to approximate the (unique) solution of the equation

$$\begin{aligned} {\overline{g}}_U(y) - z = 0, \,\,\,\, y \in [y_U, y_{\max }], \end{aligned}$$
(80)

starting from the initial guess \(y = y_U\) if \(q_U<0\) or \(y=y_{\max }\) if \(q_U \ge 0\). Then, such an algorithm does always converge (with its usual quadratic convergence rate).

Proof of Lemma 10

The proof is identical to the proof of Lemma 9 and therefore is omitted.

Thus, based on all the above Lemmas, in order to obtain \(\beta ^*\), we solve equation (18) by using the bisection method, with starting interval \(\left[ 0, - \frac{E}{U-E} \ln \left( \frac{j_E}{N_{M}}\right) \right] \); in order to obtain \(a(q_L)\) and \(a(q_U)\), we solve equation (40), with \(q=q_L\) and \(q=q_U\), respectively, by using the bisection method with starting interval \([0, -\ln (-q)]\); in order to obtain \(\phi ^{-1}(z_i)\), \(i=2,3,\ldots ,N_{L}\), we solve equation (79) by using the Newton method, with initial guess \(y = y_L\) if \(q_L<0\) or \(y=y_{\min }\) if \(q_L \ge 0\); in order to obtain \(\phi ^{-1}(z_i)\), \(i=N_{L}+N_{M}+2,N_{L}+N_{M}+3,\ldots ,{{N}}\), we solve equation (80) by using the Newton method, with initial guess \(y = y_U\) if \(q_U<0\) or \(y=y_{\max }\) if \(q_U \ge 0\).

All the above root finding algorithms, whose convergence has been theoretically established, can be easily implemented on any computer. Therefore, we can compute almost exact (up to the machine precision) values of \(\beta ^*\), \(a(q_L)\), \(a(q_U)\) and \(\phi ^{-1}(z_i)\) for \(i=2,3,\ldots ,N_{L}\) and \(i=N_{L}+N_{M}+2,N_{L}+N_{M}+3,\ldots ,{{N}}\), in an extremely small time (actually, much smaller than the time that is required for solving the partial differential problem (65)–(67)). \(\square \)

5 The finite difference scheme with repeated Richardson extrapolation in space and time

We can now solve problem (65)–(67) by numerical approximation. To this aim, we shall also discretize the time derivative in (65), which is done by using a mesh of equally spaced \(M+1\) time levels \(t_0, t_1, \ldots , t_M\), such that \(t_k = k \Delta t\), \(k=0,1,\ldots ,M\), where \(\Delta t = \frac{T}{M}\).

Then, we apply a finite difference scheme enhanced by repeated Richardson extrapolation in both space and time. Note that, as already mentioned, the Richardson extrapolation will be effective since the space mesh is aligned and uniform, and thus the finite difference scheme achieves a smooth convergence pattern (see, for example, Hairer et al. 1993; Chan et al. 2009). To provide evidence of this fact, in Sect. 6 we will also present a numerical simulation in which the Richardson extrapolation technique is applied without any mesh optimization procedure (so that the mesh is not aligned). The results will be considerably less accurate than that obtained by using the optimized mesh.

The numerical method that we are going to apply is analogous to that proposed in Ballestra (2014) for the pricing of vanilla options (with no barriers) and is based on a finite difference scheme that is second-order accurate in space and first-order accurate in time. Actually, this is a very standard three-point finite difference approximation, and thus, for the sake of brevity, we will only give a brief description of it (for more details the interested reader is referred, for example, to Quarteroni et al. (2007), Tavella and Randall (2000) and Ballestra (2014)). In the partial differential equation (65), the time derivative is evaluated (at \(z=z_i\) and \(t=t_k\)) by the implicit (first-order) Euler scheme:

$$\begin{aligned} \frac{\partial V(z_i,t_k)}{\partial t} \simeq \frac{V_i^{k+1} - V_i^{k}}{\Delta t}, \,\,\,\,\,\,\, i = 2,3,\ldots ,N, \,\,\,\,\,\,\, k = 0,1,\ldots ,M-1, \end{aligned}$$
(81)

whereas the space derivatives are discretized by using the following (second-order) approximation:

$$\begin{aligned} \frac{\partial V(z_i,t_k)}{\partial z}\simeq & {} \frac{V_{i+1}^{k} - V_{i-1}^{k}}{2 \Delta z}, \nonumber \\ \frac{\partial V(z_i,t_k)}{\partial z}\simeq & {} \frac{V_{i+1}^{k} - 2V_{i}^{k} + V_{i-1}^{k}}{(\Delta z)^2}, \,\,\,\, i = 2,3,\ldots ,N, \nonumber \\&\qquad \qquad \qquad \qquad \qquad \quad k = 0,1,\ldots ,M-1, \end{aligned}$$
(82)

where \(\Delta z\) is given by (14).

By substituting (81) and (82) in equation (66), and by imposing the boundary conditions \(V_{1}^{k} =0\) and \(V_{N+1}^{k} =0\), we obtain, for each value of k \(\in \) \(\left\{ 0,1,\ldots ,M-1\right\} \), a tridiagonal system of linear equations that allows us to obtain the option price at time \(t_k\). These systems must be solved recursively for \(k = M-1\), \(M-2\), \(\ldots \), 0 starting from the knowledge of \(V_i^M\) (since, according to (67), we have \(V_i^M = \psi _{I_b}(z_i)\), \(i = 1,2,\ldots ,N+1\)). In addition, following (Pooley et al. 2003; Ballestra 2014), at every barrier date \(t_{b,i}\), right after the barrier constraints are imposed, the numerical solution (which is discontinuous at the barriers) is projected onto the space of piecewise linear functions.

The accuracy of the resulting approximation is enhanced by Richardson extrapolation, which is repeated four times in both the space and time variables. Precisely, problem (65)–(67) is solved by using, first of all, a mesh with \(N+1\) space points and \(M+1\) time levels, then a mesh with \(2N+1\) space points and \(4M+1\) time levels, then a mesh with \(3N+1\) space points and \(9M+1\) time levels, then a mesh with \(4N+1\) space points and \(16M+1\) time levels, and finally a mesh with \(5N+1\) space points and \(25M+1\) time levels. That is, the mesh is progressively refined, such that the space length and the time step pass from \((\Delta z, \Delta t)\) to \((\frac{\Delta z}{2}, \frac{\Delta t}{4})\), then to \((\frac{\Delta z}{3}, \frac{\Delta t}{9})\), then to \((\frac{\Delta z}{4}, \frac{\Delta t}{16})\), and finally to \((\frac{\Delta z}{5}, \frac{\Delta t}{25})\). Note that the time step is reduced by a factor that is the square of the factor by which the space length is reduced. This is due to the fact that, as already mentioned, the error of the space discretiztion is \(O(\Delta z^2)\), whereas the error of the time discretization is \(O(\Delta t)\). By doing that, we end up with a sequence of five finite difference approximations, from which an enhanced numerical solution is obtained by standard (repeated) Richardson extrapolation (see, for example, Ballestra 2014; Hairer et al. 1993).

6 Numerical results

Let us show the computational performances that the mesh optimization approach and the repeated Richardson extrapolation proposed in this paper allow us to reach. To this aim, let \({\widetilde{V}}_{ap}(S,t)\) denote the approximate value of the price of the double barrier option obtained by using the numerical procedure described in Sects. 3 and 4. The error on the option price (at the current time \(t=0\)) is measured using the (discrete) maximum norm:

$$\begin{aligned} ErrMax = \displaystyle {\max _{i=1,2,\ldots ,N+1}} \left| {\widetilde{V}}_{ap}(S_i,0) - {\widetilde{V}}(S_i,0) \right| . \end{aligned}$$
(83)

Note that the exact option price \({\widetilde{V}}\) needed in (83) is not available and thus we can only compute it by numerical approximation. Then, to obtain an “exact”, or, better saying, reference value of the option price, we employ the approach proposed in Sullivan (2000), Andricopoulos et al. (2003), and Andricopoulos et al. (2007). Now, such a numerical method, being based on a suitable integral formulation of the barrier option price, does not require us to discretize differential operators, but only to compute certain integrals that involve the probability density function of the price of the option’s underlying asset. Therefore, if these integrals are approximated by some high-order quadrature rule, the price of the double barrier option can be evaluated very quickly and with extreme accuracy (close to the machine precision). Nevertheless, the approach presented in Sullivan (2000), Andricopoulos et al. (2003), and Andricopoulos et al. (2007), albeit mathematically ingenious and very efficient from the computational standpoint, is not very versatile, since it can be used only if the transition probability density function of the price of the stochastic process (1), or at least, the characteristic function associated to it (see, e.g., Fang and Oosterlee 2011), is explicitly known. By contrast, a partial differential approach (such as the one developed in the present manuscript) is much more flexible and can also be applied to those models that do not admit an explicit representation of the transition probability density function (among which, let us recall the CEV model with time-varying parameters, see Lo et al. 2000, 2009).

Table 1 Test Case 1

The numerical experiments that follow are performed on a computer AMD Ryzen 3 3200U CPU 2500Ghz 8,00 GB and the software programs are written in Fortran.

TEST CASE 1. Let us consider a discrete double barrier option with maturity \(T=0.5\) years, lower barrier \(L=20\), strike price \(E = 25.96\), upper barrier \(U=30\). Note that L, E and U are chosen such that the ratio (13) is not an integer, so that the first case in (34) applies. Finally, we set \(I_b=100\) (number of equally spaced barrier dates), \(\sigma = 0.3\) and \(r=0.03\). Based on these data and on relations (10) we compute the lower and the upper bound of the domain \(\Omega _S\): \(S_{\min } = 17.238837791978\) and \(S_{\max } = 34.799910178911\).

As is usually done, the mesh parameters \({N_{L}}\), \({N_{M}}\), \({N_{U}}\) (as well as the number of time steps M) are varied, even though the error obtained (in the discrete maximum norm) is already of the order \(10^{-11}\) when the mesh size parameter N (which is equal to \({N_{L}} + {N_{M}} + {N_{U}}\)) is not much bigger than one hundredth (see Table 1). The errors and computer times experienced are shown in Table 1, where, for the sake of completeness, we also report the values of \(\beta ^*\), \(q_L\), \(q_U\), \(a(q_L)\), \(a(q_U)\), \(y_{\min }\), \(y_L\), \(y_E\), \(y_U\), \(y_{\max }\), i.e. the values of the various quantities involved by the mesh optimization procedure (see Sects. 3 and 4).

As we may observe, the mesh optimization procedure allows us to obtain excellent results. In fact, if \(N_{L}= 5\), \(N_{M}= 40\), \(N_{U}=10\) (so that the overall number of space discretization intervals N is equal to 56) and the number of time discretization steps M is equal to 400, the error ErrMax is already of the order \(10^{-9}\).

Moreover, the approach developed in this paper is also extremely efficient from the computational standpoint, since the barrier option price can be computed with an error ErrMax of the order \(10^{-11}\) in only 0.27 s.

TEST CASE 2. As a second test case, let us consider a discrete double barrier option with maturity \(T=1\) year, lower barrier \(L=5\), strike price \(E = 7.85\), upper barrier \(U=10\). Moreover, we set \(I_b=50\), \(\sigma = 0.2\) and \(r=0.05\). These data and relations (10) yield: \(S_{\min } = 4.104352572684\) and \(S_{\max } = 12.196816703217\). The errors and computer times obtained are shown in Table 2 (again we also report the values of \(\beta ^*\), \(q_L\), \(q_U\), \(a(q_L)\), \(a(q_U)\), \(y_{\min }\), \(y_L\), \(y_E\), \(y_U\), \(y_{\max }\)).

Again, the proposed approach is extraordinarily efficient from the computational standpoint, as an error ErrMax of the order \(10^{-11}\) can be obtained in only 0.16 s.

Table 2 Test Case 2

TEST CASE 3. As a third test case, let us consider a discrete double barrier option with maturity \(T=1\) year, lower barrier \(L=45\), strike price \(E = 52.38\), upper barrier \(U=60\). Moreover, we set \(I_b=400\), \(\sigma = 0.35\) and \(r=0.03\). These data and relations (10) yield: \(S_{\min } = 39.808655549752\) and \(S_{\max } = 67.813849040528\). The errors and computer times are shown in Table 3.

As we may observe, the proposed numerical method confirms to be extraordinarily efficient, as an error ErrMax of the order \(10^{-12}\) can be obtained in only 0.59 s.

Table 3 Test Case 3

6.1 Further tests and comparisons

The proposed numerical approach relies on both the mesh optimization procedure and the space-time Richardson extrapolation. Then, it is interesting to investigate the role played by each of these techniques in achieving the excellent computational performances documented by the numerical experiments presented so far.

To this aim, first we apply the finite difference scheme with space-time Richardson extrapolation (as described in Sect. 5) directly to problem (2)–(4), i.e., without using the mesh optimization procedure. More precisely, we solve the Black–Scholes problem on its original space domain (in the S variable) using equally spaced nodes \(S_1 = S_{\min }\), \(S_2\), \(S_3\), \(\ldots \), \(S_{N+1}= S_{\max }\). Note that none of these points coincides with the strike price of with the barriers (\(S_{\min }\) and \(S_{\max }\) are chosen as in the previous section). For the sake of brevity, we only report the results obtained for Test Case 1, since the results experienced in Test Case 2 and Test Case 3 are substantially analogous. As we may observe in Table 4, the finite difference scheme with Richardson extrapolation yields satisfactory levels of computational efficiency, since, for example, the solution is computed with the error \(9.25 \times 10^{-7}\) in 0.27 s. Nevertheless, as shown in Table 1, if the finite difference scheme with Richardson extrapolation is used in conjunction with the mesh optimization procedure, the results obtained are considerably more accurate (in 0.27 s the barrier option price is computed with the error \(3.47 \times 10^{-11}\)). Therefore, the use of the mesh optimization procedure is crucial to obtain the excellent computational performances reported in the previous subsection.

Table 4 Test Case 1, results obtained using the finite difference scheme with Richardson extrapolation without the mesh optimization procedure

Finally, we employ again the mesh optimization procedure, but we solve problem (65)–(67) without applying the Richardson extrapolation. In particular, we focus on the space approximation, which we perform by using both the second-order accurate finite difference scheme (82) and the following discretization

$$\begin{aligned} \frac{\partial V(z_i,t_k)}{\partial z}\simeq & {} \frac{-V_{i+2}^{k} + 8 V_{i+1}^{k} - 8 V_{i-1}^{k} + V_{i-2}^{k}}{12 \Delta z},\nonumber \\ \frac{\partial ^2 V(z_i,t_k)}{\partial z^2}\simeq & {} \frac{-V_{i+2}^{k} +16 V_{i+1}^{k} -30V_{i}^{k} +16 V_{i-1}^{k} - V_{i-2}^{k}}{12 (\Delta z)^2}, \nonumber \\ i= & {} 3,4,\ldots ,N-1, \,\,\,\, k = 0,1,\ldots ,M-1. \end{aligned}$$
(84)

The above finite difference approximation is employed, for example, by Company et al. (2008), and, by Taylor polynomial expansion, it can be shown to be fourth-order accurate when the solution being computed is regular enough (see Company et al. 2008). Therefore, in the following the scheme (84) will be referred to as fourth-order consistent. Note that for \(i=2\) and \(i=N\) the approximation (84) is not defined and thus at the nodes \(z_2\) and \(z_N\) we shall use the second-order method (82). In this last numerical experiment, we are not concerned with the error due to the time discretization. Therefore, the time derivative in (65) is computed by applying the (implicit) Euler scheme (81) with a very large number of time discretization steps. In particular, we choose \(M = 100{,}000\), so that the error due to the time discretization is negligible with respect to the error due to the space discretization (we empirically checked that). Therefore, in summary, we are focusing on the space approximation of problem (65)–(67) alone, which we perform by using both a second-order and a fourth-order consistent finite difference method. We apply the mesh optimization procedure, but not the Richardson extrapolation.

Table 5 Test Case 1, results obtained using the fourth-order consistent and the second-order consistent schemes, with mesh optimization and without Richardson extrapolation

The results obtained are reported in table 5 (again we only consider Test Case 1). As we may observe, the fourth-order consistent scheme fails to reach fourth-order accuracy. In particular, when the mesh size parameters \(N_L\), \(N_M\) and \(N_U\) are doubled, the error is reduced by a factor that is approximately equal to four, showing that the fourth-order consistent algorithm is only second-order accurate. This is clearly due to the fact that the solution being approximated is not regular at the strike price and at the barriers, and thus the scheme (84), which is based on a fourth-order Taylor polynomial expansion, does not reach its optimal (fourth-order) convergence. In this respect, it is worth observing that, unlike the space discretization scheme (84), the Richardson extrapolation turns out to be very effective to reduce the error of the space approximation even in the presence of a non-smooth solution. To this fact we can give the following explanation: the discretization (84) is applied at every barrier date, when the solution is not a regular function, and thus it fails to achieve fourth-order accuracy. By contrast, the Richardson extrapolation is effective since it is used only at time \(t = 0\), when the solution (obtained by finite difference approximation) is smooth. Finally, the error obtained by using the second-order scheme is (approximately) from 1.3 to 2 times greater than the error achieved by applying the fourth-order consistent scheme.

7 Conclusions

When pricing double barrier options by lattice-based numerical methods, losses of convergence can occur due to the fact that the solution being computed is not a regular function (see Boyle and Lau 1994; Ndogmo and Ntwiga 2011, as well as the numerical simulations that we performed in Sect. 6.1). In the present paper, we show that extremely high levels of computational efficiency can be reach by employing a mesh optimization procedure coupled with Richardson extrapolation. In particular, first of all an aligned and uniform mesh is constructed by applying a suitable transformation of coordinates, which involves some implicitly defined parameters whose existence and uniqueness is theoretically established. Such a transformation of variables is thoroughly analyzed, both from the theoretical and the computational standpoint, and it is shown to be monotone, infinitely smooth, and also simple to compute. Then, we employ a finite difference scheme enhanced by repeated Richardson extrapolation in both space of time. The overall approach exhibits high efficacy: the price of double barrier options can be computed with an error (in the maximum norm) of the order \(10^{-11}\) or \(10^{-12}\) in less than 0.6 s. The numerical simulations reveal that the improvement over existing methods is due to the combination of the mesh optimization and the repeated Richardson extrapolation.