A polynomial decomposition of Brownian motion (Corollary 4.1.4, Theorem 4.1.6, Theorem 4.1.9, Theorem 4.1.10, Foster. 2020)
Let
where
where
and where for any
Consider the following Ito SDE:
Its Stratonovich counterpart is
where
Consider the following Stratonovich SDE:
Let
where
and for each
where
Same numerical scheme as the previous one but we replace
by
The Log-ODE numerical scheme stems from applying Euler scheme to the following sequence of ODEs, for
Consider the following Stratonovich SDE:
It is known that it admits a unique strong solution satisfying:
The parabola ODE method gives
The Log-ODE method gives
Please see http://ocamlverse.net/content/optimizing_performance.html
ocamlopt -g -O3 utils.ml rand.ml polynomial.ml polynomialKarhunenLoeveBrownian.ml parabola_method.ml log_method.ml igbm.ml gbm.ml main.ml -o main
perf record --call-graph=dwarf -- ./main
perf report
hyperfine './main 1000 10' './main 10000 100' './main 100000 100' './main 1000000 1000' './main 10000000 1000' './main 10000000 100'
Benchmark 1: ./main 1000 10
Time (mean ± σ): 6.3 ms ± 0.4 ms [User: 4.6 ms, System: 2.0 ms]
Range (min … max): 5.7 ms … 8.2 ms 286 runs
Benchmark 2: ./main 10000 100
Time (mean ± σ): 43.4 ms ± 2.2 ms [User: 40.5 ms, System: 2.7 ms]
Range (min … max): 40.6 ms … 51.8 ms 66 runs
Benchmark 3: ./main 100000 100
Time (mean ± σ): 399.5 ms ± 9.1 ms [User: 392.5 ms, System: 4.4 ms]
Range (min … max): 386.4 ms … 416.2 ms 10 runs
Benchmark 4: ./main 1000000 1000
Time (mean ± σ): 3.954 s ± 0.062 s [User: 3.909 s, System: 0.020 s]
Range (min … max): 3.843 s … 4.036 s 10 runs
Benchmark 5: ./main 10000000 1000
Time (mean ± σ): 41.077 s ± 2.743 s [User: 40.583 s, System: 0.155 s]
Range (min … max): 38.234 s … 47.733 s 10 runs
Benchmark 6: ./main 10000000 100
Time (mean ± σ): 48.495 s ± 5.526 s [User: 47.326 s, System: 0.381 s]
Range (min … max): 42.192 s … 57.308 s 10 runs
Summary
'./main 1000 10' ran
6.85 ± 0.56 times faster than './main 10000 100'
62.98 ± 4.26 times faster than './main 100000 100'
623.31 ± 40.89 times faster than './main 1000000 1000'
6475.67 ± 597.51 times faster than './main 10000000 1000'
7645.08 ± 997.98 times faster than './main 10000000 100'
Foster, JM. 2020. “Numerical Approximations for Stochastic Differential Equations.” PhD thesis, University of Oxford. Foster, JM. Lyons, T. H. Oberhauser. 2019. "An optimal polynomial approximation of Brownian motion."