08-Jan-2022 09:27:49 sde_test(): MATLAB/Octave version 9.8.0.1380330 (R2020a) Update 2 Test sde(). BPATH Brownian path simulation Elapsed time is 0.003094 seconds. Graphics saved as "bpath.png" BPATH_VECTORIZED Brownian path simulation Elapsed time is 0.000986 seconds. Graphics saved as "bpath_vectorized.png" BPATH_AVERAGE Average 1000 Brownian path simulations. Elapsed time is 0.039470 seconds. Graphics saved as "bpath_average.png" Maximum error in averaged data is 0.027278 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, we can apply the stochastic chain rule to derive an an SDE for V, and solve that. Maximum difference = 0.00480098 Graphics saved as "chain.png" em() applies the Euler-Maruyama method to an SDE. EM: Xem(Tfinal) - Xtrue(Tfinal) = 0.119163 Graphics saved as "em.png" emstrong() tests 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.535065 Residual is 0.020036 Graphics saved as "emstrong.png" emweak() tests 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 = 1.00404 Residual is 0.105014 Graphics saved as "emweak0.png" emweak() tests 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.941048 Residual is 0.0341653 Graphics saved as "emweak1.png" milstrong() tests the strong convergence of the Milstein method. MILSTRONG: Least squares solution to Error = c * dt ^ q Expecting a value near 0.5 q = 1.0328 Residual is 0.0129414 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 dt = 1 EM asymptotic test = 0.418118 dt = 0.5 EM asymptotic test = 0.167537 dt = 0.25 EM asymptotic test = -0.122654 Graphics saved as "stab_asymptotic.png". stabmeansquare() checks 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() approximates an Ito integral. 100 0.050502081 -0.065101999 0.12 2.3 stochastic_integral_ito() approximates an Ito integral. 400 -0.2940163 -0.25533496 0.039 -0.13 stochastic_integral_ito() approximates an Ito integral. 1600 -0.4902263 -0.48900014 0.0012 -0.0025 stochastic_integral_ito() approximates an Ito integral. 6400 -0.050810943 -0.062394504 0.012 -0.23 stochastic_integral_ito() approximates an Ito integral. 25600 0.52077235 0.52012375 0.00065 0.0012 stochastic_integral_ito() approximates an Ito integral. 102400 -0.16014824 -0.15791005 0.0022 -0.014 stochastic_integral_ito() approximates an Ito integral. 409600 -0.45330208 -0.45417355 0.00087 -0.0019 STOCHASTIC_INTEGRAL_STRAT_TEST: Estimate the Stratonovich integral of W(t) dW over [0,1]. Abs Rel N Exact Estimate Error Error stochastic_integral_strat() approximates a Stratonovich integral. 100 1.7569096 1.7194951 0.037 0.021 stochastic_integral_strat() approximates a Stratonovich integral. 400 0.48749578 0.4866482 0.00085 0.0017 stochastic_integral_strat() approximates a Stratonovich integral. 1600 1.4806852 1.5008999 0.02 0.014 stochastic_integral_strat() approximates a Stratonovich integral. 6400 0.051390831 0.047949909 0.0034 0.067 stochastic_integral_strat() approximates a Stratonovich integral. 25600 0.1893866 0.18928291 0.0001 0.00055 stochastic_integral_strat() approximates a Stratonovich integral. 102400 0.35142323 0.352795 0.0014 0.0039 stochastic_integral_strat() approximates a Stratonovich integral. 409600 0.028277635 0.028461763 0.00018 0.0065 sde_test(): Normal end of execution. 08-Jan-2022 09:28:55