Wed Apr 30 22:40:04 2025 sde_test(): python version: 3.10.12 matplotlib version: 3.5.1 numpy version: 1.26.4 Test sde(). bpath(): Brownian path simulation Computation required -0.0002703666687011719 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.029258237272114407 bpath_average(): Average 1000 Brownian path simulations. Computation required 0.01598191261291504 seconds. Graphics saved as "bpath_average.png" Maximum error in averaged data is 0.045447938779414 bpath_vectorized(): Brownian path simulation Computation required 0.00010156631469726562 seconds Graphics saved as "bpath_vectorized.png" 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.021033466003910317 Graphics saved as "chain.png" em(): Apply the Euler-Maruyama method to an SDE. Xem(Tfinal) - Xtrue(Tfinal) = 7.625759669964541 Graphics saved as "em.png" emstrong(): Test the strong convergence of the Euler-Maruyama method. Least squares solution to Error = c * dt ^ q Expecting a value near 0.5 q = 45.510951010857745 Residual is 0.3877521021831991 Graphics saved as "emstrong.png" emweak(): Test the weak convergence of the Euler-Maruyama method. Using standard Euler-Maruyama method. Least squares solution to Error = c * dt ^ q Expecting a q value near 1 q = 1.0089500414640569 Residual is 0.03365132561578807 Graphics saved as "emweak0.png" emweak(): Test the weak convergence of the Euler-Maruyama method. Using weak Euler-Maruyama method. Least squares solution to Error = c * dt ^ q Expecting a q value near 1 q = 0.9717449171659258 Residual is 0.045665891071889585 Graphics saved as "emweak1.png" milstrong(): Test the strong convergence of the Milstein method. Least squares solution to Error = c * dt ^ q Expecting a value near 0.5 q = 1.0264503304455188 Residual is 0.013910580363834588 Graphics saved as "milstrong.png" stab(): Check asymptotic and mean-square stability. Graphics saved as "stab1.png" Graphics saved as "stab2.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.449489742783178 SDE asymptotic test = -2.4999999999999996 Graphics saved as "stab_asymptotic.png" stabmeansquare(): Check mean-square stability. Graphics saved as "stab_meansquare.png" strint(): Approximate a stochastic integral. Abs Rel N Exact Estimate Error Error Ito 100000 -0.49704889 -0.50169634 0.0046 -0.0094 Strat 100000 0.0029511142 0.0024189048 0.00053 0.18 stochastic_integral_ito_test(): Estimate the Ito integral of W(t) dW over [0,1]. Abs Rel N Exact Estimate Error Error 100 -0.019303279 0.0017154541 0.021 -1.1 400 -0.49996658 -0.49000674 0.01 -0.02 1600 -0.48806956 -0.46878104 0.019 -0.04 6400 -0.092664852 -0.092921942 0.00026 -0.0028 25600 -0.41660019 -0.41730026 0.0007 -0.0017 102400 -0.27141849 -0.27055463 0.00086 -0.0032 409600 3.4224037 3.4228411 0.00044 0.00013 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 100 0.12989271 0.18790147 0.058 0.45 400 0.12068011 0.10257367 0.018 0.15 1600 0.40903571 0.41844121 0.0094 0.023 6400 1.3229228 1.3075181 0.015 0.012 25600 0.0016105814 0.00063667537 0.00097 0.6 102400 0.35048817 0.35276745 0.0023 0.0065 409600 0.23537708 0.23541654 3.9e-05 0.00017 sde_test(): Normal end of execution. Wed Apr 30 22:40:12 2025