03 March 2022 06:17:40 PM SDE_TEST C version Test the SDE library. TEST01: BPATH generates a sample Brownian motion path. BPATH data stored in "bpath_data.txt". BPATH plot commands stored in "bpath_commands.txt". TEST02: BPATH_AVERAGE generates many Brownian paths and averages them. BPATH_AVERAGE data stored in "bpath_average_data.txt". BPATH_AVERAGE plot commands stored in "bpath_average_commands.txt". TEST03: CHAIN solves a stochastic differential equation for 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 | Sqrt(X) - V | = 0.0142923 CHAIN data stored in "chain_data.txt". CHAIN plot commands stored in "chain_commands.txt". TEST04: EM solves a stochastic differential equation using the Euler-Maruyama method. | Exact X(T) - EM X(T) | = 0.662559 EM data #1 stored in "em1_data.txt". EM data #2 stored in "em2_data.txt". EM plot commands stored in "em_commands.txt". TEST05: EMSTRONG investigates the strong convergence of the Euler-Maruyama method. EMSTRONG: Least squares solution to Error = c * dt ^ q (Expecting Q to be about 1/2.) Computed Q = 0.523444 Residual is 0.132182 EMSTRONG data stored in "emstrong_data.txt". EMSTRONG plot commands stored in "emstrong_commands.txt". TEST06: EMWEAK investigates the weak convergence of the Euler-Maruyama method. EMWEAK: Using standard Euler-Maruyama method. Least squares solution to Error = c * dt ^ q (Expecting Q to be about 1.) Computed Q = 1.01802 Residual is 0.150786 EMWEAK data stored in "emweak0_data.txt". EMWEAK plot commands stored in "emweak0_commands.txt". EMWEAK: Using weak Euler-Maruyama method. Least squares solution to Error = c * dt ^ q (Expecting Q to be about 1.) Computed Q = 1.00968 Residual is 0.184308 EMWEAK data stored in "emweak1_data.txt". EMWEAK plot commands stored in "emweak1_commands.txt". TEST07: MILSTRONG investigates the strong convergence of the Milstein method. MILSTEIN: Least squares solution to Error = c * dt ^ q Expecting Q to be about 1. Computed Q = 1.0172 Residual is 0.00449634 MILSTRONG data stored in "milstrong_data.txt". MILSTRONG plot commands stored in "milstrong_commands.txt". TEST08: STAB_ASYMPTOTIC investigates the asymptotic stability of the Euler-Maruyama method. For technical reasons, the plotting is done in the same routine as the computations. 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 stability test = -2.5 dt = 0.5 EM asymptotic test = 0.150451 Data for DT = 0.5 stored in 'stab_asymptotic1_data.txt' dt = 0.25 EM asymptotic test = -0.0378234 Data for DT = 0.25 stored in 'stab_asymptotic2_data.txt' dt = 0.125 EM asymptotic test = -0.14777 Data for DT = 0.125 stored in 'stab_asymptotic3_data.txt' STAB_ASYMPTOTIC plot commands stored in "stab_asymptotic_commands.txt". TEST09: STAB_MEANSQUARE investigates the mean square stability of the Euler-Maruyama method. For technical reasons, the plotting is done in the same routine as the computations. STAB_MEANSQUARE: Investigate mean square stability of Euler-Maruyama solution with stepsize DT and MU. SDE is mean square stable if Real ( lambda + 1/2 |mu|^2 ) < 0. EM with DT is mean square stable if |1+dt^2| + dt * |mu|^2 - 1.0 < 0. Lambda = -3 Mu = 1.73205 SDE mean square stability test = -1.5 dt = 1 EM mean square stability test = 6 Data for DT = 1 stored in 'stab_meansquare1_data.txt'. dt = 0.5 EM mean square stability test = 0.75 Data for DT = 0.5 stored in 'stab_meansquare2_data.txt'. dt = 0.25 EM mean square stability test = -0.1875 Data for DT = 0.25 stored in 'stab_meansquare3_data.txt'. STAB_MEANSQUARE plot commands stored in "stab_meansquare_commands.txt". TEST10: Estimate the Ito integral of W(t) dW over [0,1]. Abs Rel N Exact Estimate Error Error 100 -0.30114922 -0.35566608 0.055 -0.18 400 -0.17995973 -0.18591577 0.006 -0.033 1600 0.41074701 0.41902712 0.0083 0.02 6400 -0.49717412 -0.50117424 0.004 -0.008 25600 -0.49994574 -0.50567961 0.0057 -0.011 102400 -0.12558214 -0.12625784 0.00068 -0.0054 409600 -0.46687285 -0.46555045 0.0013 -0.0028 TEST11: Estimate the Stratonovich integral of W(t) dW over [0,1]. Abs Rel N Exact Estimate Error Error 100 0.16801093 0.25183686 0.084 0.5 400 0.031144274 0.017883905 0.013 0.43 1600 2.7648883 2.869913 0.11 0.038 6400 0.054520034 0.056285076 0.0018 0.032 25600 1.1192225 1.100534 0.019 0.017 102400 0.69741193 0.69694422 0.00047 0.00067 409600 0.32644418 0.32389391 0.0026 0.0078 SDE_TEST Normal end of execution. 03 March 2022 06:17:47 PM