 Research
 Open access
 Published:
Numerical methods for simulation of stochastic differential equations
Advances in Difference Equations volume 2018, Article number: 17 (2018)
Abstract
In this paper we are concerned with numerical methods to solve stochastic differential equations (SDEs), namely the EulerMaruyama (EM) and Milstein methods. These methods are based on the truncated ItoTaylor expansion. In our study we deal 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.
1 Introduction
Until recently, many of the models ignored stochastic effects because of difficulty in solution. But now, stochastic differential equations (SDEs) play a significant role in many departments of science and industry because of their application for modeling stochastic 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 analytic 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 solutions 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 onedimensional SDE with
where f is the drift coefficient, while g is the diffusion coefficient and \(W(t,\omega)\) is the Wiener process. From now on, let \(X(t,\omega)=X(t)\) and \(W(t,\omega)=W(t)\) for simplicity. The Wiener process \(W(t)\) satisfies the following three conditions:

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

2.
\(W(t)W(s) \sim\sqrt{ts} N(0,1)\) for \(0\leq s < t\), where \(N(0,1)\) indicates a standard normal random variable;

3.
Increments \(W(t)W(s)\) and \(W(\tau) W(\upsilon)\) are independent on distinct time intervals for \(0\leq s< t<\tau< \upsilon\).
Integral form of (1) is as follows:
If \(f(t,X(t))=a_{1}(t)X(t)+a_{2}(t)\) and \(g(t,X(t))=b_{1}(t)X(t)+b_{2}(t)\) are linear, then the SDE is linear, and if they are nonlinear, the SDE is nonlinear, where \(a_{1}\), \(a_{2}\), \(b_{1}\), \(b_{2} \) 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 methods for SDE. First, we represent a stochastic Taylor expansion and we obtain the EulerMaruyama [11] and Milstein methods [12] from the truncated ItoTaylor 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 simulations 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 conduct 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 \([t_{0},T]\). Each simulation is equally likely, referred to as a realization of the system. For each realization, all of the uncertain parameters are sampled. For each sample, we produce a sample path solution to the SDE on \([t_{0},T]\). This is generally obtained from the stochastic Taylor formula, which was derived in [13], for the solution X of the SDE, on a small subinterval of \([t_{0},T]\) [5, 14]. From the ItoTaylor expansion, we can construct numerical schemes for (1) over the interval \([t_{i},t_{i+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 ItoTaylor expansion obtained via Ito’s formula [7].
3.1 ItoTaylor expansion
First we can obtain an ItoTaylor expansion for the stochastic case. Consider
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
Defining the following operators:
(4) becomes
and integral form of (7) is
Choosing \(F(x)=x\), \(F(x)=f(x)\) and \(F(x)=g(x)\), (4) becomes respectively
Substituting Eqs. (10) and (11) into (9), we obtain the following equation:
and therefore,
where \(\mathcal{R}\) is the remaining terms which include the double integral terms:
Selecting \(F=L^{1} g\) in (8), we obtain
and using \(L^{1} g =g g'\), we have
where our new remainder R̃ is
Therefore, we obtained the ItoTaylor expansion for process (3) as (16). Using Ito’s lemma again, we have
and writing (18) into (16), we obtain the stochastic Taylor expansion
Therefore, we can produce the numerical integration scheme for the SDE from ItoTaylor expansion (19) with a time discretization \(0=t_{0}< t_{1}<\cdots<t_{n}<\cdots<t_{N}=T\) of a time interval [0,T] as follows:
where \(\Delta t=t_{i+1}t_{i} \) and \(\Delta W_{i}=W(t_{i+1})W(t_{i})\) for \(i=0,1,2, \ldots,N1 \) with the initial condition \(X(t_{0})=X_{0}\). The random variables \(\Delta W_{i}\) are independent \(N(0,\Delta t)\) normally distributed random variables.
3.2 EulerMaruyama method
One of the simplest numerical approximations for the SDE is the EulerMaruyama method. If we truncate Ito’s formula of the stochastic Taylor series after the first order terms, we obtain the Euler method or EulerMaruyama method as follows:
for \(i=0,1,2,\ldots,N1\) with the initial value \(X(t_{0})=X_{0}\). EulerMaruyama approximation 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 EulerMaruyama approximation of an Ito process converges with weak order 1.0 under conditions of sufficient smoothness. It is clear that weak order of convergence is greater than strong order of convergence in the EulerMaruyama 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:
for \(i=0,1,2,\ldots,N1\) with the initial value \(X(t_{0})=X_{0}\). Milstein approximation converges with strong order 1.0 under the \(E[X(0)]^{2}<\infty\) assumption, where f and g are twice continuously differentiable, and f, \(f'\), g, \(g'\) satisfy a uniform Lipschitz condition.
Note that \(g'(X(t_{i}))\) is differentiation of \(g(X(t_{i}))\), and if the type of SDE is an additive noise SDE, then the Milstein method leads to the EulerMaruyama method.
4 Application
Let \(f(X(t))= \frac{2}{5}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:
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
and therefore the exact solution is found
Now we will apply the EulerMaruyama (EM) method and the Milstein method to the nonlinear SDE (23), where \(f(X(t))= \frac {2}{5}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:
and using the Milstein method, we get the scheme as follows:
where \(i=0,1,2,\ldots,N1\), \(X(0)=1\) and stepsize \(\Delta t=1/N\).
In Table 1, our EM and Milstein approximations of this example were evaluated for 10,000 sample paths for \(N=2^{9},2^{10},2^{11},2^{12}\) and 2^{13} over \([0,1]\) to estimate \(E[X(1)]\approx\frac{1}{10\text{,}000}\sum_{i=1}^{10\text{,}000}{X_{N}^{i}}\), where \({X_{N}^{i}}\) is the estimate of X at the end time \(T=1\) for the ith sample path using N subinterval.
In Table 2, the mean square error values
are calculated with the EM and Milstein methods for each value of N, where \({X_{N}^{i}}\) 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) \(X{\mathit{exact}}_{\mathit{mean}}\) holds average of exact solution which is plotted as blue asterisks connected with dashed lines. \(X_{\mathit{exact}}\) 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 sample paths along 50 individual paths on the interval \([0,1]\). \(X_{\mathit{mean}}\) holds average of the EM solution, which is plotted as blue asterisks connected with dashed lines; \(X_{EM}\) 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]\). \(X\mathit{milstein}_{\mathit{mean}}\) holds average 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=2^{9}\) subintervals, and the second one is plotted for \(N=2^{13}\) subintervals. \(X_{EM}\) denotes EM approximation, \(X_{\mathit{Milstein}}\) denotes Milstein approximation and \(X_{\mathit{exact}}\) 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 each stepsize. \(X\mathit{exact}X\mathit{EM}\), \(X\mathit{exact}X\mathit{milstein}\) denote error function of EM and Milstein approximations in each stepsize, which is plotted as aqua and blue straight lines, respectively. \(X\mathit{milstein}X\mathit{EM}\) means the difference between EM and Milstein approximations, 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 closed approximation to exact solution with the Milstein method compared with the EulerMaruyama method.
5 Conclusion
In this paper we have studied the Euler and Milstein schemes which are obtained from the truncated ItoTaylor 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 EulerMaruyama and Milstein methods so as to analyze similarities between the exact solution and numerical approximations. Then we investigated approximations for 2^{9}, 2^{10}, 2^{11}, 2^{12} and 2^{13} 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 increasing, numerical solutions achieved from EulerMaruyama and Milstein schemes are close to exact solution, and our results in the tables show that the Milstein method is more effective than the EulerMaruyama method.
References
Bayram, M: Automatic analysis of the control of metabolic networks. Comput. Biol. Med. 26(5), 401408 (1996)
Guzel, N, Bayram, M: Numerical solution of differentialalgebraic equations with index2. Appl. Math. Comput. 174(2), 12791289 (2006)
Allen, E: Modeling with Itô Stochastic Differential Equations. Mathematical Modelling: Theory and Applications, vol. 22 (2007)
Carletti, M, Burrage, K, Burrage, PM: Numerical simulation of stochastic ordinary differential equations in biomathematical modelling. Math. Comput. Simul. 64(2), 271277 (2004)
Tocino, A, Ardanuy, R: RungeKutta methods for numerical solution of stochastic differential equations. J. Comput. Appl. Math. 138(2), 219241 (2002)
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)
Kloeden, PE, Platen, E: Numerical Solution of Stochastic Differential Equations. Springer, New York (1992)
Farnoosh, R, Rezazadeh, H, Sobhani, A, Behboudi, M: Analytical solutions for stochastic differential equations via martingale processes. Math. Sci. 9(2), 8792 (2015)
Zhan, Q: Meansquare numerical approximations to random periodic solutions of stochastic differential equations. Adv. Differ. Equ. 2015(1), 292 (2015)
Yin, Z, Gan, S: An improved Milstein method for stiff stochastic differential equations. Adv. Differ. Equ. 2015(1), 369 (2015)
Maruyama, G: Continuous Markov processes and stochastic equations. Rend. Circ. Mat. Palermo 4(1), 4890 (1955)
Milstein, G: Approximate integration of stochastic differential equations. Theory Probab. Appl. 19(3), 557562 (1975)
Wagner, W, Platen, E: Approximation of Ito integral equations (1978)
Malham, SJ, Wiese, A: An introduction to sde simulation. arXiv preprint arXiv:1004.0646 (2010)
Gikhman, II, Skorokhod, AV: Stochastic differential equations (1972)
Mil’shtein, G: A method of secondorder accuracy integration of stochastic differential equations. Theory Probab. Appl. 23(2), 396401 (1979)
Talay, D: Efficient numerical schemes for the approximation of expectations of functionals of the solution of a sde, and applications, 294313 (1984)
Higham, DJ: An algorithmic introduction to numerical simulation of stochastic differential equations. SIAM Rev. 43(3), 525546 (2001)
Acknowledgements
The authors would like to thank the referee for his valuable comments and suggestions which improved the paper into its present form.
Author information
Authors and Affiliations
Contributions
The authors have made the same contribution. All authors read and approved the final manuscript.
Corresponding author
Ethics declarations
Competing interests
The authors declare that they have no competing interests.
Additional information
Publisher’s Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Open Access 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, provided 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.
About this article
Cite this article
Bayram, M., Partal, T. & Orucova Buyukoz, G. Numerical methods for simulation of stochastic differential equations. Adv Differ Equ 2018, 17 (2018). https://doi.org/10.1186/s1366201814665
Received:
Accepted:
Published:
DOI: https://doi.org/10.1186/s1366201814665