NUMERICAL INVERSE LAPLACE TRANSFORM FOR CONVECTION-DIFFUSION EQUATIONS IN FINANCE
arXiv:1801.02849v1 [math.NA] 9 Jan 2018
† , AND GIANCARLO NINO‡ ´ ´ NICOLA GUGLIELMI∗ , MARIA LOPEZ-FERN ANDEZ
Abstract. In this paper a novel contour integral method is proposed for linear convection-diffusion equations. The method is based on the inversion of the Laplace transform and makes use of a contour given by an elliptic arc joined symmetrically to two half-lines. The trapezoidal rule is the chosen integration method for the numerical inversion of the Laplace transform, due to its well-known fast convergence properties when applied to analytic functions. Error estimates are provided as well as careful indications about the choice of several involved parameters. The choice of the elliptic arc in the integration contour is driven by the knowledge of pseudospectral sets of the discretized differential operator, which is a computationally expensive part of the algorithm. Numerical experiments performed on the Black–Scholes (1D) and Heston (2D) equations show that the method is competitive with other contour integral methods available in the literature. Key words. Contour integral methods, pseudospectra, Laplace transform, numerical inversion of Laplace transform, trapezoidal rule, quadrature for analytic functions. AMS subject classifications. 65L05, 65R10, 65J10,65M20, 91-08
1. Introduction. We consider the time discretization of Initial Value Problems for linear systems of ODEs: ∂u = Au + b(t), ∂t
u(0) = u0 ,
(1.1)
for t > 0, A a discrete version of an elliptic operator and b a source term including possibly boundary contributions. The solution u will thus be a time-dependent vector, of dimension equal to the number of degrees of freedom in the spatial semi-discretization of the reference problem. We are particularly interested in equations arising in mathematical finance, such as Black–Scholes, Heston or Heston-Hull-White equations [2, 5, 6]. Classical methods to approximate the solution u(t) to (1.1) include Runge-Kutta and multistep integrators. Also splitting schemes, like ADI methods have been proposed to solve the continuous reference problem, see for example [7, 8, 9, 10] for Heston equation. All these methods are of time-stepping type and thus, in order to approximate the solution at a certain time tn , approximations at certain smaller times 0 < t1 < t2 < . . . < tn must be previously computed. For large times or high accuracy requirements this procedure can be extremely demanding in terms of time and computational cost. An alternative to time-stepping methods to compute the solution at (few) given times, large or not, can be derived based on the Laplace transform and its numerical inversion. This approach has been successfully developed in [4, 13, 14, 16] for linear evolutionary problems governed by a sectorial operator, this is, assuming that A in (1.1) has bounded resolvent outside a certain acute sector in the left-half of the complex plane. This condition essentially requires in practice that A is a normal matrix [18]. However, typically the discretization of a convection-diffusion operator leads to a non normal matrix A, whose resolvent may have a large norm in a big region of the complex plane including the spectrum. This is the main observation in [9], where the pseudospectral behavior of A is taken into consideration for the numerical approximation of (1.1) by using the Laplace transform. In the present paper we propose a novel contour integral method for (1.1), which requires a preliminary studio of ∗ Dipartimento di Ingegneria Scienze Informatiche e Matematica, Universit` a degli Studi di L’ Aquila, Via Vetoio - Loc. Coppito, I-67010 L’ Aquila and Gran Sasso Science Institute, L’Aquila, Italy. Email:
[email protected] † Dipartimento di Matematica, Universit` a di Roma La Sapienza, Piazzale Aldo Moro 5, I-00185 Roma, Italy. Email:
[email protected] ‡ Gran Sasso Science Institute, via Crispi 7, L’Aquila, Italy. Email:
[email protected]
1
2
N. Guglielmi, M. L´ opez-Fern´ andez and G. Nino
the pseudospectral level curves of A, and allows us to deal with different time windows and round-off errors in a robust and sistematic way. In the present paper we assume that the Laplace transform of the source term b(t) exists, is easily available, and admits a bounded analytic extension to a big region of the complex plane outside the spectrum of A. The case of more general sources is out of the scope of the present manuscript. Under these hypotheses R +∞ we can apply the (unilateral) Laplace transform L : f 7→ fˆ(z) := 0 e−zt f (t) dt to both the sides of the system in (1.1), which leads to the following algebraic equation for u ˆ = L(u): u ˆ(z) = (zI − A)−1 u0 + ˆb(z) ,
(1.2)
where ˆb = L(b) and I stands for the identity matrix. The inversion formula for the Laplace transform provides the following representation of the unknown function u: Z 1 u(t) = ezt uˆ(z) dz, (1.3) 2πi G where G can be taken as an open regular curve running from −i∞ to +i∞ and such that all singularities of u ˆ are to its left. Thus, G must leave to its left the eigenvalues of A and all possible singularities of ˆb. The discretization of (1.3) by some quadrature rule will provide an approximation of u. Assuming that the Laplace transform can be analytically extended to the left half of the complex plane and that this extension is properly bounded with respect to z, several authors have proposed different contour profiles and parameterizations for G. Probably the first relevant related reference is [17], where the author analyzes a cotangent mapping with horizontal asymptotes and the classical trapezoidal rule for the inversion of scalar Laplace transforms. Much more recently, the cotangent contour have been investigated and improved [3]. Alternatively hyperbolic contours have been considered in [4, 13, 14, 16], with a focus on evolutionary problems governed by sectorial operators. And in [20] a parabolic profile for G is chosen. In all these references, the resulting scheme converges with spectral accuracy with different rates of convergence according to the particular application and the range of times at which the inverse Laplace transform is required. An application of the parabolic contour is studied in [11] to solve precisely Black–Scholes and Heston equations. The application of this approach to convection-diffusion equations such as Black–Scholes and Heston is though more delicate due to the more irregular behaviour of the resolvent norm of A. In the present paper we choose for G in (1.3) an open arc of an ellipse. The choice of an elliptic profile is motivated by the particular structure of the pseudospectral level sets associated to convection-diffusion operators and its discretizations [15]. Actually we will start from a certain infinite contour but after some error estimation, we will show that only an elliptical open arc is needed. From a practical point of view the selection of the profile of integration relies on the computation of some pseudospectral level curves associated to A and on a careful optimization of the error bounds which we derive for our quadrature. Our method is strongly based on the theoretical estimate of the error associated to the trapezoidal rule when applied to exponentially decaying analytic integrands [12, 1, 19]. The article is organized as follows. In Section 2 we review the error estimate for the trapezoidal rule when applied to exponentially decaying integrands. In Section 3 our new method is fully described and analyzed. In Section 4 we provide details about the practical implementation and the computational cost. In Section 5 we test the method on Black-Scholes and Heston equations. We compare our new method with the methods in [11] and [14] in Section 6. Finally, in Section 7 we extend our algorithm to approximate the solution u(t) for t in a time window [t0 , t1 ] by using a unique integration contour. The new integration contour. We propose a contour G in (1.3) which is the union of two semi lines connected with an open arc of an ellipse as shown in Figure 1.1.
Numerical inverse LT for convection-difussion equations
3
Integration profile
Fig. 1.1: Shape of the general integration profile G.
In particular G is defined as {z(φ) : φ ∈ (−∞, ∞)}, with π ℓ1 (φ) φ ∈ −∞, π− π2 ; Γ(φ), φ ∈ − 2 , 2 ; z(φ) = ℓ2 (φ) , φ ∈ π2 , +∞ ;
(1.4)
where, for constants A1 , A2 , A3 to be determined later,
Γ(φ) = A1 cos φ + iA2 sin φ + A3 parameterizes the elliptic arc and ℓ1,2 (φ) = A3 + φ +
π π − i A2 − d φ + , 2 2
ℓ2 (φ) = A3 − φ +
π π + i A2 + d φ − 2 2
parameterize the semi lines. We recall that the constants in the parameterization must be chosen so that the resulting contour G leaves to its left the spectrum of A and the singularities of ˆb. There is quite some freedom in the choice of the two half lines, as along as their real part goes to minus infinity as z → ∞. Actually, the contribution of the semi lines to the contour integral is expected to be small and will be neglected in practice, as we explain in Subsection 3.3. 2. Preliminaries about the trapezoidal rule. We will apply the classical trapezoidal rule to approximate (1.3), after parameterization by (1.4). The resulting integral will be of the form Z ξ I= F (φ) dφ, (2.1) −ξ
with F satisfying the properties listed in Assumption 1. Assumption 1. The integrand function F in (2.1) satisfies the following properties: 1. F is analytic and bounded inside the strip [−π/2, π/2] × [−ia, ia], for some a > 0;
4
N. Guglielmi, M. L´ opez-Fern´ andez and G. Nino
2. F (x + iy) = F (−x + iy) ,
∀x ∈ [−π/2, π/2] ,
∀y ∈ [−a, a];
3. ∃η0 > 0 (η0 < ξ) and ∃B± > 0 such that ∀η ≤ η0 one has that |F (φ ± ia)| ≤ B± ,
∀φ ∈ [−ξ + η, ξ − η] .
4. For the same η0 of the previous point, ∃S± > 0 such that ∀η ≤ η0 i h h π πi . |F (φ ± ia)| ≤ S± , ∀φ ∈ − , −ξ + η ∪ ξ − η, 2 2 5. ∀φ ∈ R such that |φ| ≥ ξ − η, η ≤ η0 , one has |F (φ)| ≤ θ, for a certain θ > 0. Under these hypotheses it is possible to prove the following Theorem Theorem 2.1. Consider the integral I in (2.1), N ≥ 1, and the discretization of I by the quadrature formula IN =
N −1 2ξ X F (φj ) N j=1
with φj = −ξ + j
2ξ , N
j = 1, . . . , N − 1.
Assume that F satisfies Assumption 1 and take η = ξ/N . Then |I − IN | ≤
2ξ (B+ + B− ) + 4 (π/2 − δ − ξ + η) (S+ + S− ) e +2
aπN ξ
−1
+4
π 2
− ξ + 2η θ +
ξ log 2 max |F (−π/2 + δ + iφ)| , N π φ∈[−a,a]
with δ = π/2 − (2k + 1)η − ξ ,
k=
π 2
−ξ
1 . 2η
(2.2)
Proof. The proof is a variant of the one in [1, Appendix]. We consider the rectangle R = [−ξ + η, ξ − η] × [−ia, ia] and call Γ1 the union of its horizontal sides, Γ2 and Γ3 its vertical left and right sides, respectively (see Figure 2.1). Consider the integral I˜ =
Z
ξ−η
F (φ) dφ .
−ξ+η
We have I − I˜ ≤ 2ηθ .
On the one hand, for
− 21 , Im(z) > 0 , 1 Im(z) ≤ 0 , 2 ,
g(φ) =
I˜ =
Z
it follows
∂R
g(φ)F (φ) dφ .
(2.3)
5
Numerical inverse LT for convection-difussion equations
a 4
5
1
RL
R
2 j
j
- /2+
3
-
- +
4
/2-
1 -a
Fig. 2.1: The rectangle R
On the other hand, the function (φ+ξ)N π
1 1 + e−i ξ m(φ) := π 2 1 − e−i (φ+ξ)N ξ satisfies by the residue Theorem IN =
Z
m(φ)F (φ) dφ .
∂R
Then errN
= I˜ − IN =
Z
(g(φ) − m(φ)) F (φ) dφ =
∂R
Z
Γ1
+
Z
Γ3
−
Z
[(g(φ) − m(φ)) F (φ)] dφ .
Γ2
We estimate Z
2(ξ − η) (B+ + B− ) (g(φ) − m(φ)) F (φ) dφ ≤ . aπN Γ1 e ξ −1
(2.4)
We estimate the integrals over Γ2 , Γ3 . Consider the one on Γ2 . Take the rectangle RL = [−π/2 + δ, −ξ + η]× [−ia, ia] and call Γ5 its left vertical side and Γ4 the union of its horizontal sides. We define δ as in the statement of the Theorem, so that [−π/2 + δ, π/2 − δ] is the biggest segment with length an even multiple of η. We have that Z Z −ξ+η k 2ξ X L (g(φ) − m(φ)) F (φ) dφ , F (ηj ) = errN := F (φ) dφ − N j=0 ∂RL −π 2 +δ L with ηj = −ξ − 2ξj N , j = 0, . . . , k. In other words errN is the error of the same trapezoidal quadrature rule applied on the integral on the interval [−π/2 + δ, −ξ + η] with the same spacing 2ξ/N . In this way, we get Z Z Z L [(g(φ) − m(φ)) F (φ) dφ] . + (g(φ) − m(φ)) F (φ) dφ = errN + − Γ2
Γ4
Γ5
6
N. Guglielmi, M. L´ opez-Fern´ andez and G. Nino
On the one hand, we estimate Z 2 (π/2 − δ − ξ + η) (S+ + S− ) (g(φ) − m(φ)) F (φ) dφ ≤ . aπN Γ4 e ξ −1 On the other hand, we estimate Z Z (g(φ) − m(φ)) F (φ) dφ ≤ Γ5
(2.5)
a
|(g(−π/2 + δ + iφ) − m(−π/2 + δ + iφ)))F (−π/2 + δ + iφ) dφ| ≤
−a
≤ max |F (−π/2 + δ + iφ)| φ∈[−a,a]
Z
a
|g(−π/2 + δ + iφ) − m(−π/2 + δ + iφ)| dφ
−a
and Z
a
2ξ |g(−π/2 + δ + iφ) − m(−π/2 + δ + iφ)| dφ ≤ N −a
Z
∞
−∞
1 1+e
2πφN ξ
dφ =
log 2 ξ , π N
so that Z
log 2 ξ . (g(φ) − m(φ)) F (φ) dφ ≤ max |F (−π/2 + δ + iφ)| π N φ∈[−a,a] Γ5
(2.6)
We finally obtain Z Z −ξ+η k k π X L −ξ+η 2ξ 2ξ X errN = ≤ F (φ) dφ − |F (φ)| dφ + F (η ) |F (η )| ≤ 2θ − ξ + η . (2.7) j j π N j=0 N j=0 2 −π − 2 +δ 2 +δ
The integral over Γ3 can be estimated in a analogous way. The combination of estimates (2.3), (2.4), (2.5), (2.6) and (2.7) yields the stated result.
3. A new method. The only portion of the integration contour G as defined in (1.4) that we are going to use in practice is the half ellipse. As already done in [13, 14, 11], this elliptical profile is selected through the construction of a suitable conformal mapping z : [−π, π] × [−ia, ia] → C. In particular we want it to map horizontal segments onto ellipses in the complex plane (we are going to use the right half of these ellipses). Thus we set z(x + iy) = A1 (y) cos x + iA2 (y) sin x + A3 (y) .
(3.1)
We ask (3.1) to be holomorphic and impose the Cauchy-Riemann equations, getting that A3 has to be constant and A1 (y) = a1 ey + a2 e−y A2 (y) = a2 e−y − a1 ey
(3.2)
where a1 , a2 are constants. The resulting mapping turns out to be entire, since the partial derivatives of the first order of both the real and the imaginary parts are everywhere continuous. It is thus invertible and the complex derivative cannot be zero. The core idea of using the mapping (3.1) is to let y vary in the segment [−a, a], for a suitable a, while the integrand function −1 G(φ) = ez(φ)t (z(φ)I − A) u0 + ˆb(z(φ)) z ′ (φ) (3.3)
7
Numerical inverse LT for convection-difussion equations
2
60
1.5
40
1 20
0.5 0
0
-0.5
-20
-1 -40
-1.5 -2 -4
-3
-2
-1
0
1
2
3
4
-60 -120
-100
-80
-60
-40
-20
0
20
40
Fig. 3.1: Action of the conformal mapping z(φ) : it transforms horizontal segments in the complex plane (left) into ellipses (right).
stays bounded for every φ = x + iy, x ∈ [−π/2, π/2]. In particular, we are going to use the mapping (3.1) −1 to efficiently bound the exponential term ez(φ)t and the norm of the resolvent (z(φ)I − A) . We are doing this by constructing two external half ellipses Γ+ , Γ− delimiting the part of the complex plane where the integrand is bounded. The mapping (3.1) is asked to map the segments [−π/2, π/2] × {±ia} onto this two curves. Then, we are going to use as integration profile Γ the one corresponding to the image of the segment [−π/2, π/2] × {0}. In formulas, the actual profile of integration that we use is parametrized as Γ : φ 7→ (a1 + a2 ) cos φ + i(a2 − a1 ) sin φ + A3 .
(3.4)
˜ in the complex plane such that Let us focus first on the resolvent. We are going to construct an ellipse Γ ˜ the resolvent norm is bounded on its right half. In particular, Γ satisfies the following properties ˜ of center zl ∈ R and right intersection with the real axis zr is Assumption 2. We assume that an ellipse Γ given in such a way that: 1. its right half, that from now on we call Γ+ lays to the right of the spectrum of A, σ(A), and of the set of the singuliarities of the function ˆb; 2. ezl t < ǫ, ǫ being the working precision;
−1 3. there exists R+ s. t. (zI − A) ≤ R+ for all z ∈ Γ+ ;
4. there exists W+ s. t. eRe(z)t (zI − A)−1 ≤ W+ , for all z ∈ Γ+ .
For a unique definition of Γ+ we will further need a control point p = d + ir, that will result from the construction of Γ+ explained in Subsection 3.1. For instance we can choose ezl t = 10−18 , R+ = 1013 and W+ = 109 . In general, an ellipse satisfying Assumption 2 for a given operator A and the function b given is not known a priori. A general algorithmic strategy for computing numerically Γ+ is proposed in Section 3.1, using approximations of the pseudospectrum provided by eigtool [21]. The construction is general and it does not require any theoretical information about the spectral behaviour of A. In the cases where such an ellipse is already known or more information about the pseudospectral behaviour is given, the construction of Subsection 3.1 can be simplified or even skipped. Once Γ+ is given, we want (3.1) to map the segment [−π/2, π/2] × {ia}, for an a to be fixed, onto Γ+ .
8
N. Guglielmi, M. L´ opez-Fern´ andez and G. Nino
Imposing the ellipse z(· + ia) to be centered at zl and to pass through the points zr , d + ir, we get a1 ea + a2 e−a = zr − zl ,
a2 e−a − a1 ea =
r sin φ˜
,
A3 = zl ,
(3.5)
where φ˜ = arccos
d − zl zr − zl
.
Solving (3.5) for a1 , a2 , A3 we get e−a r zr − zl − ; 2 sin φ˜ r ea zr − zl + ; a2 = 2 sin φ˜ A3 = zl ; a1 =
(3.6) (3.7)
3.1. Choice of the target accuracy of the approximation. Assume we are interested in approximating the unknown function u up to a certain precision that we call tol. Because of the presence of the exponential, we expect the integrand function G (3.3) to become smaller in modulus as z moves from the right to the left on the profile of integration. For this reason, we would like to truncate the integral once the function |G| reaches the value tol. The motivation for fixing zl as in point (2) of Assumption 2 is that we are assuming that the center of the half ellipse Γ+ (that is also the center of the integration ellipse Γ) is negative enough to make the integrand function close to the working precision at z(π/2). In this way, for every tol greater than the working precision, we can efficiently use the half ellipse of integration Γ in order to recover approximations of the solution of order tol. In practice, we assume that there exists a truncation parameter c ∈]0, 1/2[, defined as |G(cπ)| = tol .
(3.8)
The integrand we want to approximate is 1 I= 2πi
Z
cπ
G(φ) dφ = u(t) + O(tol)
−cπ
In other words, we are neglecting not only the two half-lines of profile (1.4), but also the contribution to the integral coming from the portions of ellipse parametrized in the intervals [−π/2, −cπ], [cπ, π/2] as on these intervals the modulus of the integrand function is expected to be lower than the precision tol, because of the rapidly decaying behavior of the exponential. Applying trapezoidal quadrature rule to I, we get the sum IN =
N −1 c X z(φj )t −1 u0 + ˆb(z(φj )) z ′ (φj ) e (z(φj )I − A) iN j=1
We remark that, since the profile of integration is symmetric w.r.t. the real axis, the quadrature sum can be simplified to N −1 X c −1 u0 + ˆb(z(φj )) z ′ (φj ) (3.9) ez(φj )t (z(φj )I − A) IN = Im N N j=⌈ 2 ⌉ From Theorem 2.1 we get the following result.
Numerical inverse LT for convection-difussion equations
9
Lemma 3.1. Assume that the function (3.3) is analytic and bounded on the rectangle − π2 , π2 × [−ia, ia] for a certain a > 0, with z(φ) = (a1 + a2 ) cos φ + i (a2 − a1 ) sin φ + A3 and a1 , a2 , A3 given by (3.6), (3.7), (3.8). Assume moreover that the ellipse of integration has foci on the real axis. Set z(φ+ia)t −1 u0 + ˆb (z(φ + ia)) z ′ (φ + ia) (3.10) (z(φ + ia)I − A) M+ = max e φ∈[−π/2,π/2] −1 u0 + ˆb (z(φ − ia)) z ′ (φ − ia) (3.11) M− = max ez(φ−ia)t (z(φ − ia)I − A) φ∈[−cπ,cπ] z(φ−ia)t −1 u0 + ˆb (z(φ − ia)) z ′ (φ − ia) (3.12) (z(φ − ia)I − A) S− = max e φ∈[−π/2,−cπ]∪[cπ,π/2]
Finally, we assume that the integrand function |G(φ)| ≤ tol for all φ ∈ [−π/2, cπ] ∪ [cπ, π/2]. Then the quadrature error can be estimated by 2πcM− + 4(π/2 − cπ + cπ/N )S− + 2π(1 − c + 2c/N )M+ errN := |I − IN | ≤ + a ecN − 1 π 4cπ log 2 ((a1 e−a +a2 ea ) cos(π/2−δ)+A3 )t 2cπ +4 tol + ∆ − cπ + e 2 N Nπ
(3.13)
with kˆ u (z(π − δ ± ia)z ′ (π/2 − δ ± ia))k ≤ ∆ and δ given by (2.2) with ξ = cπ. Proof. The result follows immediately from Theorem 1 with ξ = cπ. Following the notation of Theorem 2.1, we set B+ = S+ = M+ and B− = M− . In particular, we observe that F (φ) = ez(φ)t uˆ(z(φ))z ′ (φ) satisfies Assumptions 1. Now, let us estimate |F (π/2 − δ + iφ)| for φ ∈ [−a, a]. We have φ −φ z(π/2−δ+iφ)t u ˆ (z (π/2 − δ + iφ)) z ′ (π/2 − δ + iφ) ≤ ∆e((a1 e +a2 e ) cos(π/2−δ)+A3 )t e
We observe that, from the hypothesis that both the foci are real, the horizontal semi-axis of the ellipse is longer than the vertical one, and so a1 + a2 > a2 − a1 . Then a1 is positive and so is a2 (as from its definition in (3.7)). So, it is straightforward to prove that the maximum of the exponential is attained for φ = −a.
Remark 1. Let us focus on the term 4cπ log 2 ((a1 e−a +a2 ea ) cos(π/2−δ)+A3 )t B= . (3.14) e Nπ We have that δ ≤ cπ/N and then cos(π/2 − δ) → 0 for N growing. Moreover, as from equation (3.8), A3 is chosen in order to have eA3 t smaller than the working precision. In the end, we expect B to be much smaller than tol, at least for N big enough. In practice, B is very small (and negligible) also for very small values of N . To show this, we report in the following tables the size of the error B (3.14) that we observe in the numerical experiments we are going to treat in Section 5. The term B is computed for N = 5. We notice that it is much smaller than the accuracy tol in every case. Black-Scholes t=1 tol = 5e − 3 1.1431e − 18 tol = 5e − 2 tol = 5e − 6 4.8763e − 18 tol = 5e − 4 tol = 5e − 9 4.1133e − 14 tol = 5e − 6 tol = 5e − 11 1.6566e − 17 tol = 5e − 9
t = 10 1.5555e − 17 3.8418e − 17 3.4109e − 14 2.0858e − 14
Heston t=1 1.5409e − 16 tol = 5e − 2 3.3070e − 16 tol = 5e − 4 2.0416e − 16 tol = 5e − 5 1.5943e − 14 tol = 5e − 6
t = 10 2.8627e − 16 5.7855e − 14 1.3791e − 16 3.7098e − 12
tol tol tol tol
= 5e − 2 = 5e − 4 = 5e − 6 = 5e − 8
10
N. Guglielmi, M. L´ opez-Fern´ andez and G. Nino
Remark 2. It is possible to select a positive ν and consider the trapezoidal rule with a quadrature step (π + 2ν)/M for M a natural number, and to change the proof of Theorem 1 in order to make B as defined in (3.14) the evaluation of the modulus of the integrand function along the segments {±π/2} × [−ia, ia]. In this way, the double exponential appearing in (3.14) vanishes because of the multiplication by cos(π/2) and the term B is even smaller. By the way, this change will made the length of the interval used to select the quadrature step dependent on the number of the nodes and so, it won’t be possible anymore to double this number saving the information computed on the old nodes. 3.2. The choice of the contour parameters. Once a is fixed, the profile of integration Γ is uniquely defined through equations (3.6), (3.7), (3.8). To complete our construction, we need to ask the exponential part in the integrand G to be bounded on the external half ellipse Γ− = z ([−π/2, π/2] × {−ia}). We have eRe(ζ)t ≤ eRe(z(−ia)) ,
∀ζ ∈ Γ− .
Then, setting z(−ia) = D, being D > 0, we get that ezt ≤ eDt ,
∀z ∈ Γ− .
Using (3.1), (3.2), (3.3), we get a1 e−a + a2 ea + A3 = D and, recalling equations (3.6), (3.7), (3.8), we get y y e2a e−2a zr − zl − zr − zl + + + zl . D= 2 2 sin φ˜ sin φ˜
(3.15)
(3.16)
D is made dependent on a and then it won’t be fixed a priori but it will result from the optimization process of the parameters. The construction summarized by the equations (3.6), (3.7), (3.8), (3.16) is still theoretical. In order to have it working, we need to find a parameter a (and consequently the truncation parameter c as defined in (3.8)) giving us the actual rate of convergence of the quadrature rule. In other words, we need to find a strategy of selection of this parameter. We notice that the profile of integration z is given once a is fixed through formulas (3.6), (3.7). The tool we are going to use to make the selection is the estimate (3.13). We now, simplify this estimate, identifying a leading term and neglecting all the remaining ones, whose contribution is expected to be smaller. First of all, we notice that we expect M+ < M− (defined in (3.10), (3.11)): this is due to the rapid decaying property of the exponential part in the integrand function and, in practice, it holds in most cases. Moreover, we assume S− ≪ M− (where S− is the one in (3.12)), since the exponential ezt is bigger for z parametrized in [−cπ, cπ] than the one in [−π/2, −cπ] ∪ [cπ, π/2]. In the end, we disregard the contribution of the term of order tol (2 π2 − cπ + 2cπ tol), and the one of the N term B (3.14) that is expected to be small (see Remark 1). Finally we simplify the error estimate (3.13) to errN ≈
2πcM− . a ecN − 1
(3.17)
Recalling (3.11), we roughly estimate M− ≈ eDt . Since we are interested in the order of magnitude of M− the estimate is enough precise for our purposes. In the end, within the accuracy, the quadrature error is a
errN ≈ 2πceDt− c N .
(3.18)
Assuming we seek approximation of u(t) with a prescribed precision, say tol, we impose (3.18) to equal the precision. Solving for N , we compute c tol N= Dt − log a 2πc
11
Numerical inverse LT for convection-difussion equations
as the (theoretical) minimum number of quadrature nodes letting us reach the fixed accuracy. We aim to minimize N in order to make the convergence as fast as possible. To do this efficiently, we recall that, from (3.16), the value D can be seen as a function of a to be determined in the minimization process. In particular, we define c tol f (a, c) = D(a)t − log . a 2πc The minimization problem we want to solve, then, is min f (a, c)
(a,c)∈Ω
(3.19)
with G as in (3.3) and Ω = {(a, c) ∈ [am , aM ] × [cm , 1/2] : |G(cπ)| = tol}. In practice we choose am , aM as lower and upper bound respectively for a and cm as a lower bound for c in order to ensure the existence of a unique solution to the problem (3.19) (that we infer from the compactness of Ω). We can choose am , cm ≈ 0 and aM large enough. In our experiments, safe bounds for a and c are found to be am = cm = 0.01 and aM = 1. The optimal values of a and c are never attained at the boundaries of these intervals. The optimal pair of parameters (˜ a, c˜) solving (3.19) will define a profile of integration z : − π2 , π2 → C expressed by (3.4), (3.6), (3.7), (3.8). Using this profile, the quadrature rule (3.9) will converge to the exact solution u(t), within the accuracy tol, with the rate (3.13). The nonlinear constraint of problem (3.19) appears quite difficult to handle, even numerically. Indeed, the inversion of the matrix (zI − A) can be extremely expensive if A is large sized (as we expect it to be). For this reason, we simplify the constraint approximating
1
−1 u0 + ˆb(z(cπ)) z ′ (cπ)h . (3.20) K ≈ (z(cπ)I − A) π
where h is the quadrature step. Indeed, looking at the quadrature formula (3.9), we want to get reed of all the terms in the quadrature sum whose contribution is smaller than tol. The truncation of the quadrature formula (more than the integral) ensures a better performance in the numerical examples: the approximation of the solution increases up to the prescribed precision tol while, when truncating the integrand function as it is estimated to reach the value tol, the error still decreases after reaching the fixed precision. In this sense, a truncation of the quadrature sum better fits the goals of our algorithm. We are going to discuss how to approximate the constant K in section 4. The final minimization problem is min f (a, c),
˜ (a,c)∈Ω
(3.21)
˜ = (a, c) ∈ [am , aM ] × [cm , 1/2] : KeRe(z)t = tol . As for (3.19), a solution of (3.21) always exists. with Ω
3.3. Truncation error. The profile (1.4) that we use to apply the Bromwich inversion formula is never used in practice: we just use a ”small” portion of the ellipse contained in it. How much this portion is ”small” depends on the fixed precision tol. In practice, we disregard all the points of (1.4) whose contribution is estimated to be smaller than tol. We resume the global error analysis in the following Theorem 3.2. Consider the integration profile defined in (1.4) where the elliptical part Γ is constructed as in Section (3). Calling ℓ1 , ℓ2 the two lines of G, choose their slope such that G encloses all the singularities of the integrand function. Moreover, assume that kˆ u(z)z ′ k ≤ Kℓ ,
z ∈ ℓ1 ,2
In the end, we assume that all the hypothesis of Lemma 1 are satisfied. Then, the final error is given by |u(t) − IN | ≤ errN + errT
12
N. Guglielmi, M. L´ opez-Fern´ andez and G. Nino
where errN is given by (3.13), while the truncation error errT = 2Kℓ
ezl t + π(1 − 2c)tol t
does not depend on N . Proof. The integral we need to treat is Z Z Z Z ezt uˆ(z) dz ezt uˆ(z) dz = + + ℓ1
G
ℓ2
Γ
First of all, we estimate the contribution of the two half-lines ℓ1 , ℓ2 . Parametrizing ℓ1 as in (1.4), we have Z π Z 0 −2 π e A3 t A3 +φ+ π t −i A −d φ+ ′ ))) ( ( ( 2 2 2 . (3.22) e uˆ(z(φ))z (φ) dφ ≤ Kℓ eA3 t+φt dφ = Kℓ −∞ t −∞
In our setting, we get
Z zl t ezt u ≤ Kℓ e ˆ (z) dz t ℓ1
and the same holds for ℓ2 . We notice that the same estimate is not valid if we choose the two halflines vertical. Now, the only portion of the ellipse that we approximate through the quadrature formula (3.9) is the one parametrized on the interval [−cπ, cπ]. Let us estimate the contribution of the other two intervals [−π/2, −cπ], [cπ, π/2]. Recalling that we assume |G(cπ)| = tol and |G(φ)| ≤ tol for all φ ∈ [−π/2, −cπ] ∪ [cπ, π/2] as in Lemma 1, we have Z −cπ 1 z(φ)t ′ e uˆ(z(φ))z (φ) dφ ≤ π − c tol −π 2 2 and the analogous estimate holds for the integral on [cπ, π/2]. In the end the error Z cπ z(φ)t ′ e u ˆ(z(φ))z (φ) dφ − IN , −cπ
where IN is defined in (3.9), is estimated by Lemma 1. The thesis follows straightforwardly. 3.4. Stability of the method. One of the most attractive features of the method is its stability. In particular, we are able to compute the stability constant of the method. We notice that the main source of numerical errors is the inversion of the system (zI − A) u ˆ = u0 + ˆb(z)
(3.23)
at the quadrature nodes. In practice, we are going to approximate the exact solution u(t) by the quadrature N −1 c X z(φj )t ˜ e uˆj z ′ (φj ) IN = N i j=1
(3.24)
where u ˆj = u ˆ(z(φj )) + ρj and ρj is the numerical error coming from the numerical solution of (3.23). We assume that the quadrature nodes φj and the integration profile z (and its derivative z ′ ) are computed exactly. We state the following result. Proposition 1. The described method is numerically stable and the stability constant is given by 2a2 c e(a1 +a2 +zl )t .
(3.25)
Numerical inverse LT for convection-difussion equations
13
with a1 , a2 given by formulas (3.6), (3.7). Proof. The effective error arising in our computation is given by err ˜ N = u(t) − I˜N .
We can estimate it in the following way N −1 N −1 X X c c z(φj )t ′ z(φj )t ′ err ˜ N = u(t) − e uˆj z (φj ) ≤ errN + errT + e (ˆ u(z(φj )) − u ˆj ) z (φj ) = N i j=1 N i j=1 num = errN + errT + errN
with errN and errT as in Lemma 1. Recalling that the integration contour Γ is parametrized as z(φ) = A1 cos φ + iA2 sin φ + A3 , with A1 = a1 + a2 , A2 = a2 − a1 positive and A3 = zl we have num errN ≤
≤
N −1 c X (A1 cos φj +A3 )t e |ρj | |−A1 sin φj + A2 i cos φj | ≤ N j=1
c (|A1 | + |A2 |) e(A1 +A3 )t ρN = c (A1 + A2 ) e(A1 +A3 )t ρ N
where ρ = maxj |ρj |. Remark 3. Given an integration contour Γ coming from the solution to (3.21), depending on the working precision, it is possible to compute the maximal precision we can get along Γ. First we compute the condition number of the matrix z(φj )I − A, for a set of φj ∈ [−cπ, cπ]. Then we use this information to estimate the numerical error ρ introduced when solving (3.23). At this point the computation of (3.25) is straightforward. We can incorporate this feasibility check in our algorithm, asking the user, in case the required precision is too high, to adjust the parameter tol, choosing a bigger value. 4. Practical implementation. 4.1. Construction of the inner ellipse Γ+ . In the described method, to construct
it is crucial
−1 properly the inner ellipse Γ+ . It is conceived to bound the resolvent norm (zI − A) and it must be adjusted in order to leave at its left all the possible singularities of the vector ˆb. Let us focus, for the moment, on the resolvent norm: Γ+ should be far enough from the spectrum of A but, if it’s too far, it will produce a slowdown of the rate of convergence of the numerical scheme. For this reason, we decided to construct the ellipse through a procedure based on the computation of some pseudospectral level curve associated to the matrix A. First of all, we define the region were we need to ”place” our ellipse. This region is defined as {z ∈ C | zl ≤ Re(z) ≤ zr }, where zl , zr are real parameters to be chosen. This choice is partially heuristic and we ask the user to make a selection of these two values. In particular, once the time t is fixed, we need to have ezl t smaller than the working precision. This is due to the fact that we are going to use zl as the center of the ellipse and, having in mind formula (3.22), we need to be sure that the contribution of the two lines of the profile (1.4) is negligible. In our experiments we choose zl = 1t log(1e − 18). As regards zr , it is going to be the right intersection of our half ellipse with the real axis. We choose it positive and as close as possible to the origin. Several values are tested in the numerical examples. Moreover, we have to take into account the singuliarities of ˆb: if needed, we need to move zr to the right in order to leave at its left all the singuliarities of ˆb. Now we need to estimate the resolvent norm in the strip zl < Re(z) < zr . We do this
14
N. Guglielmi, M. L´ opez-Fern´ andez and G. Nino
by computing some suitable pseudospectral level curve ofnthe matrix that,
A. We recall
o given ε > 0, the
−1 1 ε−pseudospectral level curve of A is defined as σε (A) = z ∈ C : (zI − A) = ε . Moreover, we call weighted ε−pseudospectral level curve the set of points
1 −1 Re(z)t σε,ω (A) := z ∈ C : e .
(zI − A) = ε
−1 Let us fix two positive values ε1 , ε2 (we are going to use ε−1 1 , ε2 as bounding constants). We define C1 as the weighted ε1 −pseudospectral level curve and C2 the ε2 −pseudospectral level curve. We compute C1 , C2 in the strip zl < Re(z) < zr . We notice that both C1 , C2 are symmetric w.r.t. the real axis (and then we can just compute the two curves in the upper complex plane). For using our algorithm, we need the two level curves to be defined in the whole strip {z ∈ C : zl ≤ Re(z) ≤ zr }. For this reason, if it happens that for some x ∈ [zl , zr ] there is no y ∈ R such that x + iy is on the curve, we set y = 0 and we add the point x to the curve. After that, we define
C = {x + iy ∈ C | x + iy1 ∈ C1 , x + iy2 ∈ C2 and |y| = max (|y1 |, |y2 |)} .
(4.1)
We call C critical curve. The meaning
of the computation of C is the following: we approximate C1 in order
zt −1 to have a bound of e (zI − A) and then of the integrand function (3.3), while on C2 we require that
the norm of the resolvent is not too high in order to ensure that the condition number of the system (1.2) on the points of the curve Γ+ (and then of the ellipse Γ) is not too big to cause a loss of accuracy. Defining C as in (4.1) will ensure that both the conditions are satisfied. From a practical point of view, we computed the value of the resolvent norm on a grid in the strip zl < Re(z) < zr using the Matlab code eigtool, [21]. It is straightforward to compute an approximation of C1 , C2 , and then C from it. In particular we end up with a set of points PC := {xi + iyi | yi ≥ 0 , i = 1 . . . , mC } approximating the upper part of the critical curve C. The ellipse Γ+ should be chosen in order to approximate in the sharpest way the curve C. Moreover, since it may happen that the grid chosen by eigtool is too course, the critical curve may not capture some of the eigenvalues of A (in the case where the pseudospectral level curve near those ones are very small closed curves surrounding the eigenvalues). In adddtion, we have to consider also the possible singularities of ˆb (that we assume to be a finite set). We call λk + iηk , k = 1, . . . , mA , the eigenvalues of A and sj + irj , j = 1, . . . , mb , the singularities of ˆb. Now define Φ = {ρn + iσn | n = 1 . . . m} = PC ∪ σ(A) ∪ {sj + irj | j = 1, . . . , mb } . The ellipse Γ+ has to be chosen in order to enclose all the points of Φ. In this way, the two conditions (3), (4) −1 of Assumption 2 will be satisfied with W+ = ε−1 1 and R+ = ε2 . We recall that, the ellipse Γ+ is completely defined by its center (that we choose as zl ), and two other points: the point zr and the point d + ir, that we used in the equations (3.5), (3.15). We can always take r > 0 since the curve is symmetric w.r.t. the real axis. The construction we suggest is the following: (i) We start considering a circle centered at zl with radius zr − zl . (ii) If all the points of Φ are inside the circle, we try to shrink the curve. To do this, we consider a partition of the interval [zl , zr ], say {xr }r=1,...,mℓ with x1 = zl , xmℓ = zr . We consider the ellipse γ centered at zl , passing through the point zr and having right focus at x2 . Then, we check, from the right to the left if all the points of Φ are enclosed by γ. If there is a point ρj + iσj that is outside γ, we go back to the circle of the previous case and we choose it as Γ+ . In particular we set d = ρj and r as the corresponding imaginary part on the circle. In our experiments we set mℓ = 1000. (iii) If, on the contrary, all the points of Φ are inside γ, we go on choosing a more elliptical curve having right focus at x3 and then we check the position of Φ w.r.t. the new γ. We stop when the curve γ excepts some points of Φ, choosing the previously computed γ as Γ+ and the point d + ir on it as we did in the previous case.
15
Numerical inverse LT for convection-difussion equations
(iv) If the last computed ellipse γ, the one with right focus at xmℓ −1 is still large enough to enclose Φ, we set d + ir as the point on γ corresponding to d = zl . (v) If in the very first point the circle already excepts some points of Φ, we choose among them the point with higher (in modulus), imaginary part, say it is the point ρj +iσj and we set d+ir = ρj +i(σj +ε) for a small ε > 0. The curve Γ+ is the one centered at zl , and passing through d + iy. We can adjust the value of ε in order to ensure that Φ is all inside Γ+ .
40
40
30
30
20
20
10
10
0 -40
-30
-20
-10
0
0 -40
40
40
30
30
20
20
10
10
0 -40
-30
-20
-10
0
0 -40
-30
-20
-10
0
-30
-20
-10
0
Fig. 4.1: Algorithm behavior when applied to a matrix arising in the discretization of Heston operator.
In Figure 4.1, we show how the algorithm works on a particular matrix A coming from the spatial discretization of the Heston operator (that we are going to use in Section 5)). The green line is a 100 points approximation of the critical curve C in the region defined by zl = −40 , zr = 0.09, while the blue dots are the eigenvalues of the matrix A in the same strip of the complex plane. Top left : the blue line is the first guess for the ellipse Γ+ (a circle). Top right : the guesses for i = 1, 20, 40, 60, 80 are plotted in blue (where each ellipse has right focus x(i), a point of the partition of the interval [−40, 0.09]). Bottom left : in addition to the previous guesses, also the first ellipse excepting some of the eigenvalues of A and crossing the curve C is plotted (it corresponds to the index i = 97). Bottom right : Γ+ is drown in red (and it is chosen as the ellipse corresponding to i = 96) and the point d + ir is marked with a black cross 4.2. On the approximation of the integrand tail. In the problem (3.21), we substituted the nonlinear constraint of (3.19), with the simpler condition KeRe(z(cπ))t = tol .
(4.2)
16
N. Guglielmi, M. L´ opez-Fern´ andez and G. Nino
Condition (4.2) let us define the truncation parameter c. The constant K is an approximation of (3.20). We have h = 2cπ N , where N is the number of quadrature nodes. We can fix N relatively large, for example N = 30, as we are just interested in the order of magnitude of K. It is clear that K depends on the value of c that will be known only when the optimization procedure is done. At the same time, this procedure can be carried out only if K is given. For this reason, we suggest an iterative scheme to approximate both c and K. The scheme is the following where prec is the precision we ask the constant K to be computed with. Algorithm 1: Data: K1 given, K0 = K1 − 2prec, j = 0 while |Kj+1 − Kj | ≥ prec do cj solution of Kj eRe(z(cj π))t = tol ; π kˆ u (z(cj π)) z ′ (cj π)cj k ; Kj+1 = 15 j = j +1; The following convergence result holds Theorem 4.1. Consider Algorithm 1 and let αj = cj π; assume that a pair (α, K) exists such that KeRe(z(α))t = tol K= Assume moreover that, calling F (x) :=
1 15
eA3 t tol−1 15
kˆ u (z(α)) z ′ (α)αk . kˆ u(z(x))z ′ (x)xk, F is differentiable and it happens that
F ′ (α) A1 t sin ξe−A1 t cos ξ ≤ C < 1
∀j ≥ 1 , ∀ξ ∈ I[αj , α] .
where I[αj , α] is the interval between αj and α. We also assume that all the second order contributions 2 O(|α − αj | ) are negligible. Then both the sequences {Kj }, {αj } converge and in particular Kj → K ,
αj → α .
The proof of the theorem is a modification of the standard convergence proof for the method of Newton for the approximation of solution of nonlinear equations. In practice, we are solving the optimization problem (3.21) starting with a guess for K, for example K = 100, getting an approximation of c and we are refining the value of K after that. Numerical experiments show that few iterations (3 or 4 iterations) are suffcient to compute K with a precision of 10−1 . 4.3. Computational cost. The method is made of two main parts: the precomputing part, where we construct the ellipse Γ+ , see Subsection 4.1, and compute the actual ellipse of integration Γ (Subsection 3.1) and the computing part, where the quadrature formula (3.9) is applied to get the final approximation of the unknown function u(t). The precomputing part is essential in order to make the algorithm general, since thorugh it all the pseudospectral information about the discreete operator A is approximated and, then, used to set the optimal profile of integration. In particular, in this part the software eigtool is employed. This software allows to compute an approximation of the resolvent norm at the points of a rectangular grid in the complex plane. In the following table, we report the time employed by eigtool in order to make the approximations for both Black-Scholes and Heston operator (the software is run on a laptop with a 2,4 GHz Intel Core i5 processor, using Matlab R2016b). In each case, we report the region of the complex plane (Box ) where we seek the approximation. For Black-Scholes, the number of points defining the rectangular
Numerical inverse LT for convection-difussion equations
17
grid is set to 200, while it is set to 50 in the case of Heston equation.
Black-Scholes t=1 Box = [−40, 0.05] × [−10, 10] 15.251361 sec t = 10 Box = [−4, 0.01] × [−6, 6] 15.523646 sec
Heston t=1 Box = [−40, 0.09] × [−10, 10] 53.806976 sec t = 10 Box = [−4, 0.06] × [−6, 6] 41.270690 sec
The computation of the pseudospectral information is used to compute the critical curve C (4.1). The ellipse Γ+ is selected through the algorithm exposed in Subsection 4.1. In all the examples, this construction is made in less than 0.5 seconds. As regards the selection of the optimal profile Γ, this ellipse is computed by solving the optimization problem (3.21), while approximating the constant K, as explained in Subsection 4.2. The cost of this iterative procedure depends on the number of evaluations of the integrand function (3.3) which is connected, on one hand, with the number of iterations needed to reach a good approximation of K and, on the other, the number of evaluations of the function to be optimized by the Matlab function fmincon, used to solve problem (3.21). In general, this part is quite fast (for example, in the case of Heston equation, for t = 1 and tol = 10−6 , it is done in 2.271847 seconds). Concerning the integration part, i.e., the computation of the quadrature sum (3.9), the execution time depends on the size of the matrix A and the number of quadrature nodes that are used to get the desired accuracy. In order to save time, it is possible to compute in parallel the integrand function at the quadrature nodes. As an explicative example, we report in the following table the time needed to evaluate the quadrature sum (3.9) for n = 5, . . . , 30, for the cases of Black-Scholes and Heston. In both cases the inversion of the system (3.23) is done using the backslash command of Matlab.
Black-Scholes t = 1, tol = 5e − 6 zl = −40, zr = 0.05 t = 10, tol = 5e − 6 zl = −4, zr = 0.01
1.176755 sec 0.897645 sec
Heston t = 1, tol = 5e − 6 zl = −40, zr = 0.09 404.606815 sec t = 10, tol = 5e − 6 zl = −4, zr = 0.06 439.518893 sec
We notice that it is possible to save the computation done for n when approximating the solution on 2n nodes (taking an extra node between each pair of consecutive points). In this way the execution time is halved. An extra computational cost is needed for the feasibility check : it is possible, indeed, to approximate the stability constant of the method by computing the condition number of the system (3.23) for a set of points on the integration ellipse Γ, as explained in Subsection 3.4. By the way, this feasibility check can be skipped and it is not necessary in order to run the algorithm even if it is useful to make a forecast on the maximal precision attainable on the computed Γ and to check whether the chosen tolerance is too sharp to the working precision. It is worth to notice that the execution time needed to run eigtool strongly depends on the fixed number n of grid points. How to set this number? Numerical experiments suggest that we need a very low resolution of the computed pseudospectral level curves and the algorithm is robust w.r.t. the choice of n. As an explicative example, we consider the case of Black-Scholes for t = 1, tol = 5 · 10−6 , and we seek approximation of the resolvent norm in the box [−40, 0.05]×[−10, 10]. Then, we compute a reference solution corresponding to n = 1000 and we measure the error w.r.t. this approximation of the solutions computed
18
N. Guglielmi, M. L´ opez-Fern´ andez and G. Nino
using n = 500, 250, 100, 50, 25. We also report the time employed by eigtool to perform the approximation: Points Execution time 1000 247.435454 sec 500 60.914193 sec 250 18.149750 sec 100 4.917106 sec 50 2.684333 sec 25 2.675066 sec
Error w.r.t. reference solution 0 1.3927e − 12 0 0 9.7751e − 07 9.6867e − 07
5. Numerical results. In this section, we collect some numerical results related to Black-Scholes and Heston equations. The case of Black-Scholes is the same as considered in [11], while for Heston we consider a slightly different boundary condition (that is the same taken in [7]). The minimization problem (3.21) is solved numerically by means of the built-in Matlab function fmincon. In all the examples, we construct the inner ellipse Γ+ as explained in Subsection 4.1 taking ε1 = 10−9 , ε2 = 10−13 . 5.1. Black-Scholes equation. The well known (deterministic) Black-Scholes equation has the following form ∂u ∂u 1 ∂2u = σ 2 s2 2 + rs − ru ∂τ 2 ∂s ∂s
(5.1)
where the unknown function u(s, t) stands for the fair price of the option when the corresponding asset price at time t− τ is s. Moreover, r ≥ 0, σ > 0 are given constants (representing the interest rate and the volatility respectively). The domain in which we consider the equation is s > L,
0 0, σ > 0 and ρ ∈ [−1, 1] are given. Moreover, equation (5.2) is usually considered under the condition 2κη > σ 2 that is known as Feller condition. We take equation (5.2) together with the boundary conditions u(s, v, 0) = max(0, s − K) where K > 0 is fixed a priori (and represents the strike price of the option), and u(0, v, τ ) = 0 ,
0 ≤ τ ≤ t.
For the numerical solution of (5.2), we need to choose a bounded domain of integration. In particular we fix two positive constants S, V and we let the two variables s, v vary in the set 0≤s≤S,
0≤v≤V .
20
N. Guglielmi, M. L´ opez-Fern´ andez and G. Nino
tol=5e-2 0.06
10
2
10
0
tol=5e-4
0.05
err
err
0.04 0.03
0.02 5
10
15
20 N tol=5e-6
25
10
-2
10
-4
30
5
10
15
5
10
15
105
10
25
30
25
30
0
err
err
100
20 N tol=5e-9
10-5 10
-5
5
10
15
20
25
30
10-10
N
20 N
Fig. 5.2: Error vs number of nodes for Black-Scholes, t = 10 (zl = −4, zr = 0.01). Top left: tol = 5 · 10−2 (maximal precision attainable ≈ 10−12 ). Top right: tol = 5 · 10−4 (max. prec. ≈ 10−11 ). Bottom left: tol = 5 · 10−6 (max. prec. ≈ 10−11 ). Bottom right: tol = 5 · 10−9 (max. prec. ≈ 10−10 ).
On the new boundary, we need to add two more conditions (specific for the European call option) ∂u (S, v, τ ) = e−rf τ , ∂s u(s, V, τ ) = se−rf τ .
0≤τ ≤t
(5.3)
The spatial discretization we adopted is the one introduced in [7]. We take κ = 1.5, η = 0.04, σ = 0.3, ρ = 0.9, r = 0.025, K = 100, L = 0, S = 8K, V = 5. We plot the error for a selection of tolerances for the cases t = 1 (Fig. 5.3) and t = 10 (Fig. 5.4). 6. Comparison with other methods. 6.1. Comparison with parabolic contours. A direct comparison with the method in [11] is not possible, since our algorithm works with the goal of a fixed accuracy while the one reported in [11] aims to reduce the error as N grows. Anyway, for the sake of comparison, we can run our algorithm as follows: - for a set of target precisions (tol = 10−1 , 10−2 , . . . for example), we run our algorithm; - for each tolerance we save the smallest number of quadrature nodes N for which tol is reached; - for each tolerance we save the corresponding error err(N ).
21
Numerical inverse LT for convection-difussion equations
10
tol=5e-2
1
10
5
10
0
tol=5e-4
10
err
err
100 -1
10-2
10
-3
5
10
20
25
10
30
-5
5
10
15
5
10
15
N tol=5e-6
105
20 N tol=5e-8
25
30
25
30
105
100
10
0
err
err
15
10-5 10
-5
5
10
15
20 N
25
30
20 N
Fig. 5.3: Error vs number of nodes for Heston, t = 1 (zl = −40, zr = 0.09). Top left: tol = 5 · 10−2 (maximal precision attainable ≈ 10−9 ). Top right: tol = 5 · 10−4 (max. prec. ≈ 10−9 ). Bottom left: tol = 5 · 10−6 (max. prec. ≈ 10−8 ). Bottom right: tol = 5 · 10−8 (max. prec. ≈ 10−7 , but in practice we are still able to reach a sharper precision).
Once we get the array [N, err(N )], we can compare it with the corresponding error coming from the method of [11]. We make our experiments both for Black-Sholes and for Heston equation, for a selection of times t. In Figure 6.1 the comparison for Black-Scholes is depicted For the comparison in the case of Heston equation, we recall that the boundary condition considered in [11] is slightly different from (5.3). However the spectrum of the discrete operator A is quite similar, and thus we implement the method in [11] using the same inner parabola. Qualitatively, the numerical results we get for t = 1 are the same as the one in [11]. The comparison is showed in Figure 6.2 6.2. Comparison with hyperbolic contours. By using the same startegy as the previous subsection, we build the array [N, err(N )]. We compare these results with the method in [14] for both the cases of BlackScholes and Heston equations. We set α = 0.4, d = 0.4 as geometric parameters to bound the resolvent norm, as explained in [14]. Since [14] works on time intervals of the form [t0 , Λt0 ], we provide a comparison for a selection of time ratios Λ and for the times t = 1, 10. The results are reported in Figures 6.3, 6.4, 6.5 and 6.6
22
N. Guglielmi, M. L´ opez-Fern´ andez and G. Nino
tol=5e-2
tol=5e-4
105
err
err
105
10
100
10 5
10
0
15
20 N tol=5e-5
25
-5
30
5
10
15
20 N tol=5e-6
5
10
15
25
30
25
30
105 err
5
err
10
10
0
100
10-5
10-5 5
10
15
20
25
30
N
20 N
Fig. 5.4: Error vs number of nodes for Heston, t = 10 (zl = −4, zr = 0.06). Top left: tol = 5 · 10−2 (maximal precision attainable ≈ 10−8 ). Top right: tol = 5 · 10−4 (max. prec. ≈ 10−6 ). Bottom left: tol = 5 · 10−5 (max. prec. ≈ 10−5 ). Bottom right: tol = 5 · 10−6 (max. prec. ≈ 10−4 , but the real accuracy we can get is sharper).
7. Extension to the case of time intervals. We notice that the most expensive computation when evaluating (3.3) is the inversion of the matrix zI − A at the quadrature nodes. This inversion does not involve the time t that appears only in the exponential part. For this reason, a great improvement to the efficiency for the method comes from the possibility of using a unique integration contour for a whole time interval [t0 , t1 ]. We would like to get an uniform error estimate like (3.17) for the whole interval [t0 , t1 ]. We remark that, when t decreases, we expect the truncation parameter c to increase (as we need to cover a larger portion of the integration contour to reach the prescribed precision). For this reason, we estimate sup kIN − Ik ≈ 2πc(t0 )eD(a)t1 e
− c(ta)N 0
.
t∈[t0 ,t1 ]
Using this estimate, we can recover the value of quadrature nodes sufficient to reach a prescribed precision tol. In particular, we get tol c(t0 ) Dt1 − log . (7.1) N= a 2πc(t0 ) Asking (7.1) to be minimal, we compute the optimal pair (˜ a, c˜(t0 )) defining the profile of integration and the truncation parameter for the smaller time t0 . When we need to use this profile for t > t0 , we have to
23
Numerical inverse LT for convection-difussion equations
t=1
t=10 Our method Method of [15]
10
10-5
10
err
err
100
10
Our method Method of [15]
0
-5
-10
4
6
8
10
12
14
16
10-10
18
4
6
8
10
N
12
14
16
18
N t=100
0
err
10
Our method Method of [15]
10
-5
8
10
12
14
16
18
20
22
N
Fig. 6.1: Balck-Scholes equation, comparison between [11] and our method. Top left: t = 1, zl = −40, zr = 0.05. Top right: t = 10, zl = −4, zr = 0.01. Bottom: t = 100, zl = −0.5, zr = 0.001.
10
10
t=1
0
t=10 Our method Method of [15]
-5
100
10
-10
4
6
8
10
12 N
14
16
Our method Method of [15]
105
err
err
10
18
-5
8
10
12
14
16
18
20
22
N
Fig. 6.2: Heston equation, comparison between [11] and our method. Left: t = 1, zl = −40, zr = 0.09. Right: t = 10, zl = −4, zr = 0.06.
24
N. Guglielmi, M. L´ opez-Fern´ andez and G. Nino
=1 Our method Method of [6]
10
err
err
10
=1.5
0
10-5
10-10
Our method Method of [6]
0
10-5
10-10 4
6
8
10
12
14
16
18
4
6
8
10
N
12
14
16
18
N
Fig. 6.3: Black-Scholes equation, comparison between [14] and our method for t = 1 zl = −40, zr = 0.05. Left: Λ = 1. Right: Λ = 1.5.
=1
=1.5 Our method Method of [6]
10
err
err
100
10-5
10-10
4
6
8
10
12
14
16
18
10
Our method Method of [6]
0
-5
10-10
4
6
8
N
10
12
14
16
18
N
Fig. 6.4: Black-Scholes equation, comparison between [14] and our method for t = 10 zl = −4, zr = 0.01. Left: Λ = 1. Right: Λ = 1.5.
compute again the truncation parameter c(t). It is clear from its definition (3.8) that, when truncating the integration at a different point of the integration contour, we also need to compute again the constant K defined in (3.20). We express this dependence on time by writing K(t). We already explained how to make a simultaneous approximation of c and K in Subsection 4.2. We also remark that if the integration profile is fixed and K is given, c can be computed thorugh the formula c=
1 arccos π
1 log A1 t
tol K
−
A3 A1
(7.2)
where tol is the given precision and the profile of integration is z(φ) = A1 cos φ+iA2 sin φ+A3 . Computing the constant K(t) for the general time t together with c(t) is quite expensive, because the computation involves the evaluation of resolvent function associated to the matrix A. We suggest to make this computation just for the two extremal times t0 and t1 . Let us call K1 the constant computed for the time t1 and K0 the one
25
Numerical inverse LT for convection-difussion equations
=1 10
Our method Method of [6]
0
err
0
err
10
=1.5 Our method Method of [6]
10
10
-5
10
-10
4
6
8
10
12
14
16
18
10
-5
-10
4
6
8
10
N
12
14
16
18
N
Fig. 6.5: Heston equation, comparison between [14] and our method for t = 1 zl = −40, zr = 0.09. Left: Λ = 1. Right: Λ = 1.5.
10
=1
0
10
Our method Method of [6]
Our method Method of [6]
err
10-2
err
10-2
=1.5
0
10
-4
10-6
10
8
10
12
14
16 N
18
20
22
24
-4
10-6
8
10
12
14
16 N
18
20
22
24
Fig. 6.6: Heston equation, comparison between [14] and our method for t = 10 zl = −4, zr = 0.06. Left: Λ = 1. Right: Λ = 1.5.
computed for t0 . For all the other times, we approximate K through linear interpolation, that is K(t) = K0 + (K1 − K0 )
t − t0 t1 − t0
(7.3)
while c is given by (7.2). In the end, we summarize the strategy we adopt on time intervals as follows: • fix a time interval [t0 , t1 ]; • compute the inner profile Γ+ for the smaller time t0 as explained in (4.1); • minimize the function (7.1). This minimization is carried on using the iterative scheme of Subsection 4.2 in order to compute both K0 and c0 corresponding to the time t0 ; • using the formula (7.2), compute iteratively the constants K1 and c1 corresponding to the time t1 ; • define, for the general t ∈]t0 , t1 [ the constant K as in (7.3) (while c is always given by (7.2)); • now apply the quadrature at the desired time t to get the approximation of u(t). We show some numerical experiments for both Black-Scholes and Heston equation. Since the case of very
26
N. Guglielmi, M. L´ opez-Fern´ andez and G. Nino
large times is not really interesting (because the solution rapidly becomes stationary), we consider the case of intervals of the form [t0 , Λt0 ] with Λ = 10. In particular, we make the experiments on the intervals [0.1, 1], [1, 10]. In this way, we approximate the solution on the whole time interval [0.1, 10] and the computation is competitive with respect to the classical PDEs integrators. In the plots 7.1, 7.2, we show the numerical results for Black-Scholes and Heston equations. The target tolerance we choose is tol = 5 · 10−8 . We also fix zr = 0.01. A slowdown of the convergence rate as t decreases is observed. This is due to the fact Time interval [0.1,1]
5
t=0.1 t=0.2 t=0.4 t=0.6 t=0.8 t=1
err
100
10
t=1 t=2 t=4 t=6 t=8 t=10
100
10-5
10
Time interval [1,10]
5
err
10
10-5
-10
10 0
20
40
60
80
-10
100
0
20
40
N
60
80
100
N
10
5
10
0
Time interval [0.1,1] t=0.1 t=0.2 t=0.4 t=0.6 t=0.8 t=1
10-5
err
err
Fig. 7.1: Black-Scholes equation, tol = 10−8 . Left: time interval [0.1, 1], zl = −400, zr = 0.01. Right: time interval [1, 10], zl = −40, zr = 0.01.
10
5
10
0
Time interval [1,10] t=1 t=2 t=4 t=6 t=8 t=10
10-5 5
10
15
20
25
30
5
10
N
15
20
25
30
N
Fig. 7.2: Heston equation, tol = 10−4 . Left: time interval [0.1, 1], zl = −400, zr = 0.06. Right: time interval [1, 10], zl = −40, zr = 0.06. a
that c is decreasing w.r.t. time and the rate of convergence is O(e− c N ). It is interesting to compare those performances with the one obtained by [14] since this method is also conceived to work on time intervals. In Figures 7.3, 7.4 the results are plotted (in both cases we take α = 0.4 , d = 0.4) 8. Conclusions. In this paper we have proposed a new method for the numerical inversion of the Laplace transform of functions with specific properties arising in the space-time approximation of linear convection-diffusion equations. In the end, we recap the advantages of our method:
27
Numerical inverse LT for convection-difussion equations
Time interval [0.1,1] 10
10
Time interval [1,10]
0
t=0.1 t=0.2 t=0.4 t=0.6 t=0.8 t=1
-5
10-10
10
10
0
t=1 t=2 t=4 t=6 t=8 t=10
-5
10-10
0
20
40
60
80
100
0
20
40
60
80
100
Fig. 7.3: Black-Scholes equation using [14]. Left: time interval [0.1, 1]. Right: time interval [1, 10].
Time interval [0.1,1]
10
10
Time interval [1,10] t=0.1 t=0.2 t=0.4 t=0.6 t=0.8 t=1
0
-5
10
10
10
20
30
40
50
t=1 t=2 t=4 t=6 t=8 t=10
0
-5
10
20
30
40
50
Fig. 7.4: Heston equation using [14]. Left: time interval [0.1, 1]. Right: time interval [1, 10].
• The new method is designed in order to achieve a prescribed precision as fast as possible. • The method is stable: adding quadrature nodes never deteriorates the quality of the final approximation. This is not always the case in [14] and [20, 11]. • The stability constant of the method can be computed to carry out an a priori feasibility check to detect if the prescribed accuracy is too high but is not essential to run the method. • Once the target accuracy tol and the time t are fixed, our algorithm selects the profile of integration independently of the number of quadrature nodes. Thus, the cost of adding a few quadrature nodes to reach the target accuracy is low. In [14, 11] the integration contour does depend on the number of quadrature nodes. • Our strategy is based on the approximation of the pseudospectral level curves associated to the discrete operator A in (1.1) by using eigtool. This construction is quite general and does not require a priori knowledge about the spectrum of A. The computational cost of the approximation made by using eigtool is reported in Subsection 4.3, where we also show that a low resolution in this approximation might be enough to construct a good integration contour. • Our method is easily adapted to approximate the solution to (1.1) on relatively large time intervals of the form [t0 , Λt0 ], with Λ > 1.
28
N. Guglielmi, M. L´ opez-Fern´ andez and G. Nino
Future research will be devoted to reduce the dependance on eigtool, which can be prohibitively expensive for large matrices arising from the spatial discretization of 2D and, specially, 3D convection-diffusion equations. The resolution of the linear systems with non-normal matrices zI − A should also be more carefully studied. Acknowledgments. The authors thank K.J. in ’t Hout for providing the codes implementing the method in [11]. NG and MLF thank INdAM GNCS for financial support. REFERENCES [1] L. Banjai, M. L´ opez-F´ ernandez, A. Sch¨ adle, Fast and oblivious algorithms for dissipative and two-dimensional wave equations, Siam J. Numer. Anal., Vol. 55, pp. 621-639, 2017. [2] F. Black, M. Scholes, The pricing of options and corporate liabilities, J. Polit. Econ., Vol. 81, pp. 637-654, 1973. [3] B. Dingfelder, J. A. C. Weideman, An improved Talbot method for numerical Laplace transform inversion, Numer. Algorithms, Vol. 68, pp. 167-183, 2015. [4] I. P. Gavrilyuk, V. L. Makarov, Exponentially convergent parallel discretization methods for the first order evolution equations, Comput. Methods Appl. Math., Vol. 1, Number 4, pp. 333-355, 2001. [5] S. L. Heston, A closed-form solution for options with stochastic volatility with applications to bond and currency options, Rev. Finan. Stud., Vol. 6, pp. 327-343, 1993. [6] J. C. Hull, Options, Futures and Other Derivatives, 6th ed., Prentice Hall, New Jersey, 2006. [7] K. J. in ’T Hout, S. Foulon, ADI diference schemes for option pricing in the Heston model with correlation, Int. J. Numer. Anal. Model., Vol. 7, Number 2, pp. 303-320, 2010. [8] K. J. in ’t Hout, ADI schemes in the numerical solution of the Heston PDE, Numerical Analysis and Applied Mathematics, eds. T. E. Simos et.al., AIP Conf. Proc: 936, 2007. [9] K. J. in ’t Hout, B. D. Welfert, Stability of ADI schemes applied to convection-diffusion equations with mixed derivative terms, Appl. Numer. Math. Vol. 57, pp. 19-35, 2007. [10] K. J. in ’t Hout, B. D. Welfert, Unconditional stability of second -order ADI schemes applied to multi-dimensional diffusion equations with mixed derivative terms, Appl. Numer. Math., Vol. 59, pp. 677-692, 2009. [11] K. J. in ’t Hout, J. A. C. Weideman, A contour integral method for the Black&Scholes and Heston Equations, SIAM J. Sci. Comput., Vol. 33, Num. 2, pp. 763-785, 2011. [12] M. Javed, L. N. Trefethen. A trapezoidal rule error bound unifying the Euler-Maclaurin formula and geometric convergence for periodic functions. Proc. R. Soc. Lond. Ser. A Math. Phys. Eng. Sci., 470(2161):20130571, 9, 2014. [13] M. L´ opez-F´ ernandez, C. Palencia, On the numerical inversion of the Laplace transform of certain holomorphic mappings, Appl. Numer. Math., Vol. 51, pp. 289-303, 2004. [14] M. L´ opez-F´ ernandez, C.Palencia, A. Sch¨ adle, A spectral order method for inverting sectorial Laplace transform, SIAM J. Numer. Anal., Vol. 44, Num. 3, pp. 13321350, 2006. [15] S. C. Reddy, L. N. Trefethen, Pseudospectra of the convection-diffusion operator, SIAM J. Appl. Math., Vol. 54, pp. 1634-1649, 1994. [16] D. Sheen, I. Sloan, V. Thom´ ee, A parallel method for time discretization of parabolic equations based on Laplace transformation and quadrature, IMA J. Numer. Anal., Vol. 23, pp. 269-299, 2003. [17] A. Talbot, The Accurate Numerical Inversion of Laplace Transforms, IMA J. Appl. Math., Vol. 23, pp. 97-120, 1979. [18] L. N. Trefethen, M. Embree, Spectra and Pseudospectra: The Behavior of Nonnormal Matrices and Operators. Princeton, NJ: Princeton University Press, 2005. [19] L. N. Trefethen, J. A. C. Weideman, The Exponentially Convergent Trapezoidal Rule, SIAM Rev., Vol. 56, Number 3, pp. 385-458, 2014. [20] J. A. C. Weideman, Improved contour integral methods for parabolic PDEs, IMA J. Numer. Anal., Vol. 30, pp. 334-350, 2010. [21] Thomas G. Wright. EigTool. http://www.comlab.ox.ac.uk/pseudospectra/eigtool/, 2002.