pub fn ou(
theta: f64,
mu: f64,
sigma: f64,
) -> SDE<f64, impl Drift<f64>, impl Diffusion<f64, f64>>Expand description
Ornstein-Uhlenbeck: dX = theta*(mu - X) dt + sigma dW
ยงExample
use pathwise_core::{simulate, ou, euler};
// Mean-reverting process: theta=2.0, long-run mean=1.0, vol=0.3
let o = ou(2.0, 1.0, 0.3);
let scheme = euler();
let paths = simulate(&o.drift, &o.diffusion, &scheme, 0.0, 0.0, 1.0, 5, 100, 0).expect("simulate failed");
assert_eq!(paths.shape(), &[5, 101]);