Home License -- for personal use only. Not for government, academic, research, commercial, or other organizational use. 13-May-2025 17:27:50 sde_test(): MATLAB/Octave version 9.11.0.2358333 (R2021b) Update 7 Test sde(). bpath(): Brownian path simulation Elapsed time is 0.001471 seconds. Graphics saved as "bpath.png" bpath1(): Brownian path simulation Graphics saved as bpath1.png bpath2(): Brownian path simulation Graphics saved as bpath2.png bpath3(): Average 1000 Brownian path simulations. Graphics saved as bpath3.png Maximum error in averaged data is 0.034254 bpath_vectorized(): Brownian path simulation Elapsed time is 0.000166 seconds. Graphics saved as "bpath_vectorized.png" bpath_average(): Average 1000 Brownian path simulations. Elapsed time is 0.008866 seconds. Graphics saved as "bpath_average.png" Maximum error in averaged data is 0.029474 chain(): Solve a stochastic differential equation involving a function of a stochastic variable X. We can solve for X(t), and then evaluate V(X(t)). Or, apply the stochastic chain rule to derive an an SDE for V, and solve that. Maximum difference = 0.00517923 Graphics saved as "chain.png" em(): Apply the Euler-Maruyama method to an SDE. EM: Xem(Tfinal) - Xtrue(Tfinal) = 0.414262 Graphics saved as "em.png" emstrong(): Test the strong convergence of the Euler-Maruyama method. EMSTRONG: Least squares solution to Error = c * dt ^ q Expecting a value near 0.5 q = 0.52342 Residual is 0.050042 Graphics saved as "emstrong.png" emweak(): Test the weak convergence of the Euler-Maruyama method. EMWEAK: Using standard Euler-Maruyama method. Least squares solution to Error = c * dt ^ q Expecting a value near 1 q = 0.997185 Residual is 0.0523563 Graphics saved as "emweak0.png" emweak(): Test the weak convergence of the Euler-Maruyama method. EMWEAK: Using weak Euler-Maruyama method. Least squares solution to Error = c * dt ^ q Expecting a value near 1 q = 0.946417 Residual is 0.0628648 Graphics saved as "emweak1.png" milstrong(): Test the strong convergence of the Milstein method. MILSTRONG: Least squares solution to Error = c * dt ^ q Expecting a value near 0.5 q = 1.01879 Residual is 0.0251643 Graphics saved as "milstrong.png". stab_asymptotic(): Investigate asymptotic stability of Euler-Maruyama solution with stepsize DT and MU. SDE is asymptotically stable if Real ( lambda - 1/2 mu^2 ) < 0. EM with DT is asymptotically stable if E log ( 1 + lambda dt - sqrt(dt) mu n(0,1) ) < 0. where n(0,1) is a normal random value. Lambda = 0.5 Mu = 2.44949 SDE asymptotic test = -2.5 Graphics saved as "stab_asymptotic.png". stabmeansquare(): Check mean-square stability. Graphics saved as "stab_meansquare.png". stochastic_integral_ito_test(): Estimate the Ito integral of W(t) dW over [0,1]. Abs Rel N Exact Estimate Error Error stochastic_integral_ito(): Approximate an Ito integral. 100 -0.24427711 -0.20052111 0.044 -0.18 stochastic_integral_ito(): Approximate an Ito integral. 400 -0.47570981 -0.45056317 0.025 -0.053 stochastic_integral_ito(): Approximate an Ito integral. 1600 -0.27401097 -0.27578035 0.0018 -0.0065 stochastic_integral_ito(): Approximate an Ito integral. 6400 -0.17555849 -0.17506378 0.00049 -0.0028 stochastic_integral_ito(): Approximate an Ito integral. 25600 2.1490739 2.143929 0.0051 0.0024 stochastic_integral_ito(): Approximate an Ito integral. 102400 1.820913 1.8214757 0.00056 0.00031 stochastic_integral_ito(): Approximate an Ito integral. 409600 -0.45712393 -0.45753142 0.00041 -0.00089 stochastic_integral_strat_test(): stochastic_integral_strat() estimates the Stratonovich integral of W(t) dW over [0,1]. Abs Rel N Exact Estimate Error Error stochastic_integral_strat(): Approximate a Stratonovich integral. 100 0.054035197 0.12828743 0.074 1.4 stochastic_integral_strat(): Approximate a Stratonovich integral. 400 0.018922851 0.033294236 0.014 0.76 stochastic_integral_strat(): Approximate a Stratonovich integral. 1600 0.0036419399 0.010065358 0.0064 1.8 stochastic_integral_strat(): Approximate a Stratonovich integral. 6400 0.22499733 0.22774499 0.0027 0.012 stochastic_integral_strat(): Approximate a Stratonovich integral. 25600 2.770749 2.7701527 0.0006 0.00022 stochastic_integral_strat(): Approximate a Stratonovich integral. 102400 0.031073406 0.032703747 0.0016 0.052 stochastic_integral_strat(): Approximate a Stratonovich integral. 409600 0.028154107 0.028244884 9.1e-05 0.0032 sde_test(): Normal end of execution. 13-May-2025 17:28:03