Home License -- for personal use only. Not for government, academic, research, commercial, or other organizational use. 08-Oct-2025 00:25:13 sde_test(): MATLAB/Octave version 9.11.0.2358333 (R2021b) Update 7 Test sde(). bpath(): Brownian path simulation Elapsed time is 0.001262 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.042222 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.008785 seconds. Graphics saved as "bpath_average.png" Maximum error in averaged data is 0.020009 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.009541 Graphics saved as "chain.png" em(): Apply the Euler-Maruyama method to an SDE. EM: Xem(Tfinal) - Xtrue(Tfinal) = 0.905154 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.52539 Residual is 0.0363483 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.994906 Residual is 0.0405151 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.966318 Residual is 0.0446525 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.03189 Residual is 0.0185899 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.7983281 0.81888718 0.021 0.026 stochastic_integral_ito(): Approximate an Ito integral. 400 -0.43876328 -0.39618096 0.043 -0.097 stochastic_integral_ito(): Approximate an Ito integral. 1600 -0.4999248 -0.51235666 0.012 -0.025 stochastic_integral_ito(): Approximate an Ito integral. 6400 0.10202292 0.092991463 0.009 0.089 stochastic_integral_ito(): Approximate an Ito integral. 25600 -0.49996454 -0.50164592 0.0017 -0.0034 stochastic_integral_ito(): Approximate an Ito integral. 102400 -0.4795178 -0.47984949 0.00033 -0.00069 stochastic_integral_ito(): Approximate an Ito integral. 409600 -0.48572133 -0.485865 0.00014 -0.0003 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.21280928 0.20446563 0.0083 0.039 stochastic_integral_strat(): Approximate a Stratonovich integral. 400 0.65703283 0.64663931 0.01 0.016 stochastic_integral_strat(): Approximate a Stratonovich integral. 1600 0.002366621 0.014682057 0.012 5.2 stochastic_integral_strat(): Approximate a Stratonovich integral. 6400 0.032183765 0.027180082 0.005 0.16 stochastic_integral_strat(): Approximate a Stratonovich integral. 25600 0.93499493 0.93318567 0.0018 0.0019 stochastic_integral_strat(): Approximate a Stratonovich integral. 102400 3.027782 3.0306685 0.0029 0.00095 stochastic_integral_strat(): Approximate a Stratonovich integral. 409600 0.85741889 0.85897004 0.0016 0.0018 sde_test(): Normal end of execution. 08-Oct-2025 00:25:27