18-Jun-2023 08:58:03 sde_test(): MATLAB/Octave version 5.2.0 Test sde(). bpath(): Brownian path simulation Elapsed time is 0.004565 seconds. Graphics saved as "bpath.png" bpath_vectorized(): Brownian path simulation Elapsed time is 8.79765e-05 seconds. Graphics saved as "bpath_vectorized.png" bpath_average() Average 1000 Brownian path simulations. Elapsed time is 0.0216219 seconds. Graphics saved as "bpath_average.png" Maximum error in averaged data is 0.029095 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.00836347 Graphics saved as "chain.png" em() applies the Euler-Maruyama method to an SDE. EM: Xem(Tfinal) - Xtrue(Tfinal) = 0.236012 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.527929 Residual is 0.0137309 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 = 0.953218 Residual is 0.0905497 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.963571 Residual is 0.0650395 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.04379 Residual is 0.020589 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.44471 dt = 0.5 EM asymptotic test = 0.114679 dt = 0.25 EM asymptotic test = -0.0943688 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.10596285 -0.12630468 0.02 -0.19 stochastic_integral_ito() approximates an Ito integral. 400 -0.38353012 -0.37481511 0.0087 -0.023 stochastic_integral_ito() approximates an Ito integral. 1600 -0.49978914 -0.52277554 0.023 -0.046 stochastic_integral_ito() approximates an Ito integral. 6400 -0.069911968 -0.075886632 0.006 -0.085 stochastic_integral_ito() approximates an Ito integral. 25600 -0.13166983 -0.13159223 7.8e-05 -0.00059 stochastic_integral_ito() approximates an Ito integral. 102400 -0.45502565 -0.4565369 0.0015 -0.0033 stochastic_integral_ito() approximates an Ito integral. 409600 0.013855888 0.014765204 0.00091 0.066 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() approximates a Stratonovich integral. 100 0.031189692 0.018957407 0.012 0.39 stochastic_integral_strat() approximates a Stratonovich integral. 400 0.14856278 0.14271509 0.0058 0.039 stochastic_integral_strat() approximates a Stratonovich integral. 1600 1.5900703 1.5897263 0.00034 0.00022 stochastic_integral_strat() approximates a Stratonovich integral. 6400 0.13984083 0.14339502 0.0036 0.025 stochastic_integral_strat() approximates a Stratonovich integral. 25600 0.232725 0.2386596 0.0059 0.026 stochastic_integral_strat() approximates a Stratonovich integral. 102400 0.52705585 0.52771619 0.00066 0.0013 stochastic_integral_strat() approximates a Stratonovich integral. 409600 0.56235532 0.5611869 0.0012 0.0021 sde_test(): Normal end of execution. 18-Jun-2023 08:58:27