0% found this document useful (0 votes)
64 views10 pages

Numerical Methods For Simulation of Stochastic Differential Equations

Uploaded by

Jese Madrid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views10 pages

Numerical Methods For Simulation of Stochastic Differential Equations

Uploaded by

Jese Madrid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Bayram et al.

Advances in Difference Equations (2018) 2018:17


https://doi.org/10.1186/s13662-018-1466-5

RESEARCH Open Access

Numerical methods for simulation of


stochastic differential equations
Mustafa Bayram1* , Tugcem Partal2 and Gulsen Orucova Buyukoz3
*
Correspondence:
[email protected] Abstract
1
Department of Computer
Engineering, Istanbul Gelisim In this paper we are concerned with numerical methods to solve stochastic
University, Istanbul, 34315, Turkey differential equations (SDEs), namely the Euler-Maruyama (EM) and Milstein methods.
Full list of author information is These methods are based on the truncated Ito-Taylor expansion. In our study we deal
available at the end of the article
with a nonlinear SDE. We approximate to numerical solution using Monte Carlo
simulation for each method. Also exact solution is obtained from Ito’s formula. To
show the effectiveness of the numerical methods, approximation solutions are
compared with exact solution for different sample paths. And finally the results of
numerical experiments are supported with graphs and error tables.
Keywords: stochastic differential equations; Monte Carlo methods; Euler-Maruyama
method; Milstein method

1 Introduction
Until recently, many of the models ignored stochastic effects because of difficulty in so-
lution. But now, stochastic differential equations (SDEs) play a significant role in many
departments of science and industry because of their application for modeling stochas-
tic phenomena, e.g., finance, population dynamics, biology, medicine and mechanics. If
we add a random element or elements to the deterministic differential equation, we have
transition from an ordinary differential equation to SDE. Unfortunately, in many cases an-
alytic solutions are not available for these equations, so we are required to use numerical
methods [1, 2] to approximate the solution. [3–6] discussed the numerical solutions of
SDEs. [7] presented many numerical experiments. Some analytical and numerical solu-
tions were proposed in [8]. [9] considered numerical approximations of random periodic
solutions for SDEs. On the other hand, [10] constructed a Milstein scheme by adding an
error correction term for solving stiff SDEs.
In this paper we consider the general form of one-dimensional SDE with

   
dX(t, ω) = f t, X(t, ω) dt + g t, X(t, ω) dW (t, ω), t0 ≤ t ≤ T,
(1)
X(t0 , ω) = X0 (ω),

where f is the drift coefficient, while g is the diffusion coefficient and W (t, ω) is the Wiener
process. From now on, let X(t, ω) = X(t) and W (t, ω) = W (t) for simplicity. The Wiener
process W (t) satisfies the following three conditions:

© The Author(s) 2018. This article is distributed under the terms of the Creative Commons Attribution 4.0 International License
(http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, pro-
vided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and
indicate if changes were made.
Bayram et al. Advances in Difference Equations (2018) 2018:17 Page 2 of 10

1. W (0) = 0 (w.p.1);

2. W (t) – W (s) ∼ t – sN(0, 1) for 0 ≤ s < t, where N(0, 1) indicates a standard
normal random variable;
3. Increments W (t) – W (s) and W (τ ) – W (υ) are independent on distinct time
intervals for 0 ≤ s < t < τ < υ.
Integral form of (1) is as follows:

 
t   t  
X(t) = X(t0 ) + f s, X(s) ds + g s, X(s) dW (s). (2)
t0 t0

If f (t, X(t)) = a1 (t)X(t) + a2 (t) and g(t, X(t)) = b1 (t)X(t) + b2 (t) are linear, then the SDE is
linear, and if they are nonlinear, the SDE is nonlinear, where a1 , a2 , b1 , b2 are specified
functions of time t or constants. In the next section we give the Monte Carlo simulation,
the method we will use for our experiments. In Section 3 we denote the numerical meth-
ods for SDE. First, we represent a stochastic Taylor expansion and we obtain the Euler-
Maruyama [11] and Milstein methods [12] from the truncated Ito-Taylor expansion. In
Section 4 we consider a nonlinear SDE, and we solve and explicate our equation for two
different methods, namely the EM and Milstein methods. We use MATLAB for our sim-
ulations and support our results with graphs and tables. And the last section consists of
conclusion, which gives our suggestions.

2 Monte Carlo simulations


Monte Carlo methods are numerical methods, where random numbers are used to con-
duct a computational experiment. Numerical solution of stochastic differential equations
can be viewed as a type of Monte Carlo calculation. Monte Carlo simulation is perchance
the most common technique for propagating the incertitude in the various aspects of a
system to the predicted performance.
In Monte Carlo simulation, the entire system is simulated a large number of times. So,
a set of suitable sample paths is produced on [t0 , T]. Each simulation is equally likely,
referred to as a realization of the system. For each realization, all of the uncertain pa-
rameters are sampled. For each sample, we produce a sample path solution to the SDE
on [t0 , T]. This is generally obtained from the stochastic Taylor formula, which was de-
rived in [13], for the solution X of the SDE, on a small subinterval of [t0 , T] [5, 14]. From
the Ito-Taylor expansion, we can construct numerical schemes for (1) over the interval
[ti , ti+1 ].

3 Stochastic Taylor series expansion


The Taylor formula plays a very significant role in numerical analysis. We can obtain the
approximation of a sufficiently smooth function in a neighborhood of a given point to any
desired order of accuracy with the Taylor formula.
Enlarging the increments of smooth functions of Ito processes, it is beneficial to have a
stochastic expansion formula with correspondent specialities to the deterministic Taylor
formula. Such a stochastic Taylor formula has some possibilities. One of these possibilities
is an Ito-Taylor expansion obtained via Ito’s formula [7].
Bayram et al. Advances in Difference Equations (2018) 2018:17 Page 3 of 10

3.1 Ito-Taylor expansion


First we can obtain an Ito-Taylor expansion for the stochastic case. Consider
   
dX(t) = f X(t) dt + g X(t) dW (t), (3)

where f and g satisfy a linear growth bound and are sufficiently smooth.
Let F be a twice continuously differentiable function of X(t), then from Ito’s lemma we
hav
 
    ∂F[X(t)] 1 2   ∂ 2 F[X(t)]
dF X(t) = f X(t) + g X(t) dt
∂X 2 ∂X 2
  ∂F[X(t)]
+ g X(t) dW (t). (4)
∂X

Defining the following operators:

  ∂ 1   ∂2
L0 ≡ f X(t) + g 2 X(t) , (5)
∂X 2 ∂X 2
  ∂
L1 ≡ g X(t) , (6)
∂X

(4) becomes
     
dF X(t) = L0 F X(t) dt + L1 F X(t) dW (t), (7)

and integral form of (7) is


 
   t
0
  t  
F X(t) = F X(t0 ) + L F X(τ ) dτ + L1 F X(τ ) dW (τ ). (8)
t0 t0

Choosing F(x) = x, F(x) = f (x) and F(x) = g(x), (4) becomes respectively
 
t   t  
X(t) = X(t0 ) + f X(τ ) dτ + g X(τ ) dW (τ ), (9)
t0 t0
 
    t   t  
f X(t) = f X(t0 ) + L0 f X(τ ) dτ + L1 f X(τ ) dW (τ ), (10)
t0 t0
 
    t   t  
g X(t) = g X(t0 ) + L0 g X(τ ) ds + L1 g X(τ ) dW (τ ). (11)
t0 t0

Substituting Eqs. (10) and (11) into (9), we obtain the following equation:
 t 
  τ1  
X(t) = X(t0 ) + f X(t0 ) + L0 f X(τ2 ) dτ2
t0 t0


τ1  
+ L1 f X(τ2 ) dW (τ2 ) dτ1
t0
 t 
  τ1  
+ g X(t0 ) + L0 g X(τ2 ) dτ2
t0 t0


τ1  
+ L1 g X(τ2 ) dW (τ2 ) dW (τ1 ); (12)
t0
Bayram et al. Advances in Difference Equations (2018) 2018:17 Page 4 of 10

and therefore,

 
  t   t
X(t) = X(t0 ) + f X(t0 ) dτ1 + g X(t0 ) dW (τ1 ) + R, (13)
t0 t0

where R is the remaining terms which include the double integral terms:

 t  t
τ1   τ1  
R≡ 0
L f X(τ2 ) dτ2 dτ1 + L1 f X(τ2 ) dW (τ2 ) dτ1
t0 t0 t0 t0
 t  t
τ1   τ1  
+ L0 g X(τ2 ) dτ2 dW (τ1 ) + L1 g X(τ2 ) dW (τ2 ) dW (τ1 ). (14)
t0 t0 t0 t0

Selecting F = L1 g in (8), we obtain

 t τ1  
L1 g X(τ2 ) dW (τ2 ) dW (τ1 )
t0 t0
 t τ1  
= L1 g X(t0 )
t0 t0
 

τ2   τ2  
+ L0 L1 g X(τ3 ) dτ3 + L1 L1 g X(τ3 ) dW (τ3 ) dW (τ2 ) dW (τ1 ), (15)
t0 t0

and using L1 g = gg  , we have


  t
X(t) = X(t0 ) + f X(t0 ) dτ1
t0
  t
  t  
  τ1
+ g X(t0 ) dW (τ1 ) + g X(t0 ) g  X(t0 ) ,
dW (τ2 ) dW (τ1 ) + R (16)
t0 t0 t0

where our new remainder


R is

 t  t
τ1   τ1  

R 0
L f X(τ2 ) dτ2 dτ1 + L1 f X(τ2 ) dW (τ2 ) dτ1
t0 t0 t0 t0
 t τ1  
+ L0 g X(τ2 ) dτ2 dW (τ1 )
t0 t0
 t 
τ1 τ2  
+ L0 L1 g X(τ3 ) d(τ3 ) dW (τ2 ) dW (τ1 )
t0 t0 t0
 t 
τ1 τ2  
+ L1 L1 g X(τ3 ) dW (τ3 ) dW (τ2 ) dW (τ1 ). (17)
t0 t0 t0

Therefore, we obtained the Ito-Taylor expansion for process (3) as (16). Using Ito’s lemma
again, we have

 t τ1
1 2 1
dW (τ2 ) dW (τ1 ) = W (t) – W (t0 ) – (t – t0 ), (18)
t0 t0 2 2
Bayram et al. Advances in Difference Equations (2018) 2018:17 Page 5 of 10

and writing (18) into (16), we obtain the stochastic Taylor expansion
 
  t   t
X(t) = X(t0 ) + f X(t0 ) dτ1 + g X(t0 ) dW (τ1 )
t0 t0
 
    1 2 1
+ g X(t0 ) g X(t0 ) .
W (t) – W (t0 ) – (t – t0 ) + R (19)
2 2

Therefore, we can produce the numerical integration scheme for the SDE from Ito-Taylor
expansion (19) with a time discretization 0 = t0 < t1 < · · · < tn < · · · < tN = T of a time inter-
val [0,T] as follows:
   
X(ti+1 ) = X(ti ) + f X(ti ) t + g X(ti ) Wi
1     
,
+ g X(ti ) g  X(ti ) (Wi )2 – t + R (20)
2

where t = ti+1 – ti and Wi = W (ti+1 ) – W (ti ) for i = 0, 1, 2, . . . , N – 1 with the initial condi-
tion X(t0 ) = X0 . The random variables Wi are independent N(0, t) normally distributed
random variables.

3.2 Euler-Maruyama method


One of the simplest numerical approximations for the SDE is the Euler-Maruyama
method. If we truncate Ito’s formula of the stochastic Taylor series after the first order
terms, we obtain the Euler method or Euler-Maruyama method as follows:

   
X(ti+1 ) = X(ti ) + f X(ti ) t + g X(ti ) Wi (21)

for i = 0, 1, 2, . . . , N – 1 with the initial value X(t0 ) = X0 . Euler-Maruyama approxima-


tion converges with strong order 0.5 under Lipschitz and bounded growth conditions on
the coefficients f and g, which were shown in [15]. [16] and [17] showed that an Euler-
Maruyama approximation of an Ito process converges with weak order 1.0 under condi-
tions of sufficient smoothness. It is clear that weak order of convergence is greater than
strong order of convergence in the Euler-Maruyama method.

3.3 Milstein method


The other numerical approximation method for the SDE is Milstein method. If we truncate
the stochastic Taylor series after second order terms, we obtain the Milstein method as
follows:
   
X(ti+1 ) = X(ti ) + f X(ti ) t + g X(ti ) Wi
1     
+ g X(ti ) g  X(ti ) (Wi )2 – t (22)
2

for i = 0, 1, 2, . . . , N – 1 with the initial value X(t0 ) = X0 . Milstein approximation converges


with strong order 1.0 under the E[X(0)]2 < ∞ assumption, where f and g are twice con-
tinuously differentiable, and f , f  , g, g  satisfy a uniform Lipschitz condition.
Note that g  (X(ti )) is differentiation of g(X(ti )), and if the type of SDE is an additive noise
SDE, then the Milstein method leads to the Euler-Maruyama method.
Bayram et al. Advances in Difference Equations (2018) 2018:17 Page 6 of 10

4 Application
Let f (X(t)) = 25 X 3/5 (t) + 5X 4/5 (t), g(X(t)) = X 4/5 (t) and the initial condition X(0) = 1 in (1),
we obtain the following nonlinear stochastic differential equation:

2 3/5
dX(t) = X (t) + 5X (t) dt + X 4/5 (t) dW (t),
4/5
0 ≤ t ≤ 1,
5 (23)
X(0) = 1.

So, clearly, our nonlinear SDE is said to have multiplicative noise as the diffusion vector
field depends multiplicatively on the solution [18]. Now, we find the exact solution of this
nonlinear SDE using Ito’s formula. Let F(t, X(t)) = [X(t)]1/5 . Then

  2 –1/5 4 1
dF t, X(t) = X (t) + 1 – X –1/5 (t) dt + dW (t), (24)
25 50 5
 1/5  1
d X(t) = dt + dW (t); (25)
5

and therefore the exact solution is found


5
1
X(t) = 1 + t + W (t) . (26)
5

Now we will apply the Euler-Maruyama (EM) method and the Milstein method to the
nonlinear SDE (23), where f (X(t)) = 25 X 3/5 (t) + 5X 4/5 (t) and g(X(t)) = X 4/5 (t).
Using the EM method, we get the following scheme:

2 3/5
X(ti+1 ) = X(ti ) + X (ti ) + 5X 4/5 (ti ) t + X 4/5 (ti )W (ti ), (27)
5

and using the Milstein method, we get the scheme as follows:


2 3/5
X(ti+1 ) = X(ti ) + X (ti ) + 5X 4/5 (ti ) t + X 4/5 (ti )W (ti )
5
2  
+ X 3/5 (ti ) (Wi )2 – t , (28)
5

where i = 0, 1, 2, . . . , N – 1, X(0) = 1 and stepsize t = 1/N .


In Table 1, our EM and Milstein approximations of this example were evaluated for
10,000 sample paths for N = 29 , 210 , 211 , 212 and 213 over [0, 1] to estimate E[X(1)] ≈
1 10,000 i
10,000 i=1 XN , where XNi is the estimate of X at the end time T = 1 for the ith sample
path using N subinterval.

Table 1 Estimation values for Euler-Maruyama and Milstein methods


N Euler-Maruyama estimation Milstein estimation
29 35.0213 35.0531
210 35.1408 35.0277
211 35.2520 35.2222
212 35.3850 35.4594
213 5.3261 35.5083
Bayram et al. Advances in Difference Equations (2018) 2018:17 Page 7 of 10

Table 2 Calculated mean square errors for Euler-Maruyama and Milstein methods
N Euler-Maruyama estimation Milstein estimation
29 1.80e–01 8.26e–02
210 7.01e–02 2.04e–02
211 2.98e–02 5.30e–03
212 1.40e–02 1.30e–03
213 6.80e–03 3.34e–04

Figure 1 Exact solution and EM simulation averaged over 10,000 discretized sample paths along 50
individual paths for N = 210 .

In Table 2, the mean square error values

 2 1 
10,000

EX(1) – XN  ≈ X i (1) – X i 2
N
10,000 i=1

are calculated with the EM and Milstein methods for each value of N, where XNi is the
estimate of X at the end time T = 1 for the ith sample path using N subinterval.
Upper left and lower left graphs show that the exact solution of (23) Xexact mean holds
average of exact solution which is plotted as blue asterisks connected with dashed lines.
Xexact keeps exact solutions of (23) along individual paths on the interval [0, 1].
In Figure 1, the exact solution and the EM approximation are plotted for 10,000 sam-
ple paths along 50 individual paths on the interval [0, 1]. Xmean holds average of the EM
solution, which is plotted as blue asterisks connected with dashed lines; XEM keeps EM
approximations, which is plotted as red straight lines.
In Figure 2, the exact solution and the Milstein approximation are plotted for 10,000
sample paths and along 50 individual paths on the interval [0, 1]. Xmilsteinmean holds av-
erage of the Milstein solution, which is plotted as blue asterisks connected with dashed
lines. Xmilstein keeps Milstein approximations, which is plotted as red straight lines.
In Figure 3, exact solution, EM and Milstein approximations are plotted on the same
graph. The first graph is plotted for N = 29 subintervals, and the second one is plotted for
N = 213 subintervals. XEM denotes EM approximation, XMilstein denotes Milstein approxi-
mation and Xexact denotes exact solution, which are plotted as blue, yellow and red straight
lines, respectively.
In Figure 4, the error functions are plotted on the same graph, for EM approximations,
Milstein approximations and difference between EM and Milstein approximations for
Bayram et al. Advances in Difference Equations (2018) 2018:17 Page 8 of 10

Figure 2 Exact solution and Milstein simulation averaged over 10,000 discretized sample paths along
50 individual paths for N = 210 .

Figure 3 EM, Milstein approximation and exact solution for one sample paths and 29 , 213
discretization, respectively.

Figure 4 Error function between EM, Milstein approximation and exact solution for one sample paths
and 29 , 213 discretization, respectively.

each stepsize. Xexact – XEM, Xexact – Xmilstein denote error function of EM and Mil-
stein approximations in each stepsize, which is plotted as aqua and blue straight lines,
respectively. Xmilstein – XEM means the difference between EM and Milstein approx-
imations, which is plotted as red straight lines. Finally, we say from our graphs that, if
we minimize the stepsize dt (thus maximize N ) because of dt = 1/N , we obtain more
Bayram et al. Advances in Difference Equations (2018) 2018:17 Page 9 of 10

closed approximation to exact solution with the Milstein method compared with the
Euler-Maruyama method.

5 Conclusion
In this paper we have studied the Euler and Milstein schemes which are obtained from
the truncated Ito-Taylor expansion already proposed in [7]. Then we implemented these
schemes to a nonlinear stochastic differential equation for comparing the EM and Milstein
methods to each other while illustrating efficiency. Moreover, we calculated estimation
values for Euler-Maruyama and Milstein methods so as to analyze similarities between
the exact solution and numerical approximations. Then we investigated approximations
for 29 , 210 , 211 , 212 and 213 discretization in the interval [0, 1] with 10,000 different sample
paths. According to our results, we can say that when the discretization value N is in-
creasing, numerical solutions achieved from Euler-Maruyama and Milstein schemes are
close to exact solution, and our results in the tables show that the Milstein method is more
effective than the Euler-Maruyama method.

Acknowledgements
The authors would like to thank the referee for his valuable comments and suggestions which improved the paper into
its present form.

Competing interests
The authors declare that they have no competing interests.

Authors’ contributions
The authors have made the same contribution. All authors read and approved the final manuscript.

Author details
1
Department of Computer Engineering, Istanbul Gelisim University, Istanbul, 34315, Turkey. 2 Department of
Mathematical Engineering, Yildiz Technical University, Istanbul, 34210, Turkey. 3 Department of Mathematics, Yildiz
Technical University, Istanbul, 34210, Turkey.

Publisher’s Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Received: 23 May 2017 Accepted: 2 January 2018

References
1. Bayram, M: Automatic analysis of the control of metabolic networks. Comput. Biol. Med. 26(5), 401-408 (1996)
2. Guzel, N, Bayram, M: Numerical solution of differential-algebraic equations with index-2. Appl. Math. Comput. 174(2),
1279-1289 (2006)
3. Allen, E: Modeling with Itô Stochastic Differential Equations. Mathematical Modelling: Theory and Applications,
vol. 22 (2007)
4. Carletti, M, Burrage, K, Burrage, PM: Numerical simulation of stochastic ordinary differential equations in
biomathematical modelling. Math. Comput. Simul. 64(2), 271-277 (2004)
5. Tocino, A, Ardanuy, R: Runge-Kutta methods for numerical solution of stochastic differential equations. J. Comput.
Appl. Math. 138(2), 219-241 (2002)
6. Song, M, Yu, H: Convergence and stability of implicit compensated Euler method for stochastic differential equations
with Poisson random measure. Adv. Differ. Equ. 2012(1), 214 (2012)
7. Kloeden, PE, Platen, E: Numerical Solution of Stochastic Differential Equations. Springer, New York (1992)
8. Farnoosh, R, Rezazadeh, H, Sobhani, A, Behboudi, M: Analytical solutions for stochastic differential equations via
martingale processes. Math. Sci. 9(2), 87-92 (2015)
9. Zhan, Q: Mean-square numerical approximations to random periodic solutions of stochastic differential equations.
Adv. Differ. Equ. 2015(1), 292 (2015)
10. Yin, Z, Gan, S: An improved Milstein method for stiff stochastic differential equations. Adv. Differ. Equ. 2015(1), 369
(2015)
11. Maruyama, G: Continuous Markov processes and stochastic equations. Rend. Circ. Mat. Palermo 4(1), 48-90 (1955)
12. Milstein, G: Approximate integration of stochastic differential equations. Theory Probab. Appl. 19(3), 557-562 (1975)
13. Wagner, W, Platen, E: Approximation of Ito integral equations (1978)
14. Malham, SJ, Wiese, A: An introduction to sde simulation. arXiv preprint arXiv:1004.0646 (2010)
15. Gikhman, II, Skorokhod, AV: Stochastic differential equations (1972)
16. Mil’shtein, G: A method of second-order accuracy integration of stochastic differential equations. Theory Probab.
Appl. 23(2), 396-401 (1979)
Bayram et al. Advances in Difference Equations (2018) 2018:17 Page 10 of 10

17. Talay, D: Efficient numerical schemes for the approximation of expectations of functionals of the solution of a sde,
and applications, 294-313 (1984)
18. Higham, DJ: An algorithmic introduction to numerical simulation of stochastic differential equations. SIAM Rev. 43(3),
525-546 (2001)

You might also like