Skip to main content

simulate

Function simulate 

Source
pub fn simulate<D, G, SC>(
    drift: &D,
    diffusion: &G,
    scheme: &SC,
    x0: f64,
    t0: f64,
    t1: f64,
    n_paths: usize,
    n_steps: usize,
    seed: u64,
) -> Result<Array2<f64>, PathwiseError>
where D: Drift<f64> + Sync, G: Diffusion<f64, f64> + Sync, SC: Scheme<f64, Noise = f64>,
Expand description

Simulate n_paths paths of a scalar SDE from t0 to t1 with n_steps steps.

Returns Array2 of shape (n_paths, n_steps + 1).

Generates both dw and dz per step; schemes that do not use dz ignore it. Non-finite values are stored as NaN.