sde_test 12-Mar-2019 11:49:00 sde_test: MATLAB version. Test sde. BPATH Brownian path simulation {Error using rng (line 99) The current random number generator is the legacy generator. This is because you have executed a command such as rand('state',0), which activates MATLAB's legacy random number behavior. You may not use RNG to reseed the legacy random number generator. Use rng('default') to reinitialize the random number generator to its startup configuration, or call RNG using a specific generator type, such as rng(seed,'twister'). Error in bpath (line 46) rng ( seed ) Error in sde_test (line 29) bpath ( seed ); } sde_test 12-Mar-2019 11:49:25 sde_test: MATLAB version. Test sde. BPATH Brownian path simulation Elapsed time is 0.000992 seconds. Plot stored as "bpath.png" BPATH_VECTORIZED Brownian path simulation Elapsed time is 0.000347 seconds. Plot saved as "bpath_vectorized.png" BPATH_AVERAGE Average 1000 Brownian path simulations. Elapsed time is 0.016611 seconds. Plot saved as "bpath_average.png" Maximum error in averaged data is 0.024035 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.00656882 Plot saved as "chain.png" EM: Xem(Tfinal) - Xtrue(Tfinal) = 0.141851 Plot saved as "em.png" EMSTRONG: Least squares solution to Error = c * dt ^ q Expecting a value near 0.5 q = 0.527373 Residual is 0.0257188 Plot saved as "emstrong.png" EMWEAK: Using standard Euler-Maruyama method. Least squares solution to Error = c * dt ^ q Expecting a value near 1 q = 0.998868 Residual is 0.0588024 Plot saved as "emweak0.png" EMWEAK: Using weak Euler-Maruyama method. Least squares solution to Error = c * dt ^ q Expecting a value near 1 q = 0.983309 Residual is 0.145161 Plot saved as "emweak1.png" MILSTRONG: Least squares solution to Error = c * dt ^ q Expecting a value near 0.5 q = 1.00786 Residual is 0.0273506 Plot 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.465152 dt = 0.5 EM asymptotic test = 0.118434 dt = 0.25 EM asymptotic test = -0.0539516 Plot saved as "stab_asymptotic.png". STAB_MEANSQUARE: Plot 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 100 -0.48987217 -0.49996505 0.01 -0.021 400 -0.34407159 -0.29128579 0.053 -0.15 1600 0.31683709 0.32490331 0.0081 0.025 6400 0.30529586 0.30627903 0.00098 0.0032 25600 -0.47858807 -0.48260176 0.004 -0.0084 102400 -0.43080245 -0.43285652 0.0021 -0.0048 409600 -0.27636342 -0.27678558 0.00042 -0.0015 STOCHASTIC_INTEGRAL_STRAT_TEST: Estimate the Stratonovich integral of W(t) dW over [0,1]. Abs Rel N Exact Estimate Error Error 100 0.010127831 0.032717739 0.023 2.2 400 0.15592841 0.15359388 0.0023 0.015 1600 0.81683709 0.80703209 0.0098 0.012 6400 0.80529586 0.81134261 0.006 0.0075 25600 0.021411934 0.023602932 0.0022 0.1 102400 0.069197546 0.067654619 0.0015 0.022 409600 0.22363658 0.22313417 0.0005 0.0022 sde_test: Normal end of execution. 12-Mar-2019 11:50:26 diary off