Introduction to numerical simulations for Stochastic ODEs Xingye Kan Illinois Institute of Technology Department of Applied Mathematics Chicago, IL 60616 August 9, 2010
Outline 1 Preliminaries 2 Numerical scheme for solving SODEs Euler-Maruyama scheme Milstein scheme 3 MATLAB simulation
Brownian Motion(Wiener Process) Definition[1] B 0 (ω) = 0 a.s.; the sample paths t B t (ω) are a.s. continuous; B t (ω) has stationary independent increments; the increments B t (ω) B s (ω) has the normal distribution with mean 0 and variance t s, i.e. B t (ω) B s (ω) N(0, t s) for any 0 s < t. 2 A Scalar Brownian Motion 1.5 1 0.5 B t 0 0.5 1 1.5 2 0 5 10 15 20 25 30 t
SODE driven by Brownian motion Definition[1] An equation of the form dx t = a(t, X t )dt + b(t, X t )db t where functions a(t, x), b(t, x) are given, B t is a Brownian motion process and X t is the unknown process is called a stochastic ordinary differential equation(sode) driven by Brownian motion. Integral form t t X t = X t0 + a(s, X s )ds + b(s, X s )db s t 0 t 0
Itô formula t t U(t, X t ) = U(t 0, X t0 ) + L 0 U(s, X s )ds + L 1 U(s, X s )db s t 0 t 0 where L 0 = t + a x + 1 2 2b2, L 1 = b x 2 x
Examples of SODEs Black-Scholes model ds t = µs t dt + σs t db t Logistic equation(perturbed by multiplicative noise) ẋ = rx(1 x) + ɛx B t Harmonic Oscillator(perturbed by additive noise) ẋ = y + ɛ B 1 t ẏ = x + ɛ B 2 t
Examples of SODEs(cont d) Simple Pendulum(perturbed by additive noise) ẋ = y + ɛ B 1 t ẏ = sin(x) + ɛ B 2 t Lorenz equations(perturbed by additive noise) ẋ = σ(y x) + ɛ B 1 t ẏ = x(τ z) y + ɛ B 2 t ż = xy βz + ɛ B 3 t
Euler-Maruyama scheme for SDE t t X t = X t0 + a(s, X s )ds + b(s, X s )dw s t 0 t 0 Applying Itô formula on the integrands over the time interval [, +1 ] a(s, X s ) =a(, X tn ) + L 0 a(u, X u )du + b(s, X s ) =b(, X tn ) + L 0 b(u, X u )du + t n s L 1 a(u, X u )dw u L 1 b(u, X u )dw u
X tn+1 = X tn + + [a(, X tn )+ [b(, X tn )+ = X tn + a(, X tn ) L 0 a(u, X u )du + Euler-Maruyama scheme L 0 b(u, X u )du + ds + b(, X tn ) L 1 a(u, X u )dw u ]ds L 1 b(u, X u )dw u ]dw s dw s +R 1 (+1, ) X tn+1 = X tn + a(, X tn ) ds + b(, X tn ) dw s
Milstein scheme for SDE t t X t = X t0 + a(s, X s )ds + b(s, X s )dw s t 0 t 0 Applying Itô formula on a(s, X s ), b(s, X s ) over the time interval [, +1 ] Applying Itô formula again on L 1 b(u, X u ) over the time interval [, +1 ]
X tn+1 = X tn + + + [a(, X tn )+ [b(, X tn )+ { u + L 0 a(u, X u )du + [L 1 b(, X tn ) L 0 L 1 b(v, X v )dv + = X tn + a(, X tn ) +L 1 b(, X tn ) L 0 b(u, X u )du]dw s u L 1 a(u, X u )dw u ]ds L 1 L 1 b(v, X v )dw v ]dw u }dw s ds + b(, X tn ) dw u dw s + R 2 (+1, ) dw s
Milstein scheme X tn+1 = X tn + a(, X tn ) +L 1 b(, X tn ) = X tn + a(, X tn ) ds + b(, X tn ) +b(, X tn ) b x (, X tn ) dw u dw s ds + b(, X tn ) dw u dw s dw s dw s
MATLAB GUI is short for Graphic User Interface Simulate Brownian motion sample paths Simulate Itô SDEs Specify different integration method to be used between Euler-Maruyama and Milstein schemes Set the time interval to be considered Set stepsize
Example 1: GUI for Brownian motion sample paths B j = B j 1 + db j B 0 = 0 j = 1, 2,, N N = T /h 2 A Scalar Brownian Motion stepsize = 0.1 final time = 20.0 Scalar Planar 3D B t 1 0-1 -2 Quit Plot -3-4 -5 0 5 10 15 20 25 t
Example 2: GUI for sample paths of solutions of SDEs 1 Stochastic differential equation 2 Stochastic differential equations 3 Stochastic differential equations Euler scheme: blue Milstein scheme: red 0.9 dx_t = -x^2 dy_t = 2*x-y^2 dz_t = sin(x) dt + x/100 dt + y/100 dt + z/100 dw_t dw_t dw_t Z(t) 0.8 0.7 0.6 0.5 0.4 stepsize = 0.01 0.3 final time = 10 0.2 X_0= 0.1 Y_0= 0.1 Z_0= 0.1 Euler Milstein both Quit Proceed 0.1 Y(t) 0.04 0.1 0.5 0.4 0.3 0.2 0.05 0.06 X(t) 0.07 0.08 0.09 0.1
Using MATLAB GUI to solve 1D, 2D and 3D SODE Black-Scholes model ds t = µs t dt + σs t db t with S 0 = 40, µ = 0.08, σ = 0.3 120 numerical solution using Euler scheme 100 80 X(t) 60 40 20 0 0 1 2 3 4 5 6 7 8 9 10 t
Logistic equation(perturbed by multiplicative noise) with x 0 = 10, r = 0.4, ɛ = 0.1 ẋ = rx(1 x)dt + ɛxdb t 10 numerical solution using Milstein scheme 9 8 7 6 X(t) 5 4 3 2 1 0 0 1 2 3 4 5 6 7 8 9 10 t
Harmonic Oscillator(perturbed by additive noise) with x 0 = 1, y 0 = 0.1, ɛ = 0.1 ẋ = y + ɛ B 1 t ẏ = x + ɛ B 2 t 1.5 numerical solution using Euler scheme 1 0.5 0 Y(t) -0.5-1 -1.5-2 -2-1.5-1 -0.5 0 0.5 1 1.5 2 X(t)
Simple pendulum(perturbed by additive noise) with x 0 = 0.1, y 0 = 2, ɛ = 0.1 ẋ = y + ɛ B 1 t ẏ = sin(x) + ɛ B 2 t 2 numerical solution using Milstein scheme 1.5 1 0.5 Y(t) 0-0.5-1 -1.5-2 -2-1.5-1 -0.5 0 0.5 1 1.5 2 2.5 X(t)
Lorenz equations(perturbed by additive noise) ẋ = σ(y x) + ɛ B 1 t ẏ = x(τ z) y + ɛ B 2 t ż = xy βz + ɛ B 3 t with x 0 = 0.1, y 0 = 2, z 0 = 1.2, σ = 0.2, τ = 0.6, β = 0.7, ɛ = 0.1 Euler scheme: blue Milstein scheme: red 1.4 1.2 1 0.8 Z(t) 0.6 0.4 0.2 0-0.2 2 1.5 1 0.5 0.4 0.6 0.8 0 0.2 Y(t) -0.5 0 X(t)
Fima C Klebaner Introduction to Stochastic Calculus with Applications 2nd Ed. Imperial College Press, London, 2005.