#stochastic #simulation

stochastic-processes

Stochastic processes simulation toolkit

3 releases

0.1.2 Jul 25, 2022
0.1.1 Jul 21, 2022
0.1.0 Jul 21, 2022

#21 in #stochastic

46 downloads per month

MIT license

14KB
213 lines

Stochastic Processes

This crate provides utilities for simulating various stochastic processes.

TODO:

The following features will by implemented in the near future:

  • Wiener process (Brownian motion).
  • Brownian bridge.
  • Poisson process.
  • Milstein method.

lib.rs:

Stochastic processes simluation toolkit.

This crate provides utilities for simulating various stochastic processes.

Quick Start

To create a process, call the new constructor for the desired process, and supply the constructor with the required parameters. To simulate a process, simply call simulate on the process.

In the following example, a Geometric Brownian motion is created with $\mu = \sigma = 1$. The processes is simluated using the Euler-Maruyama method. The path is stored inside of a SimulatedPath. Finally, the path is exported to a pickle file (for use in Python).

use stochastic_processes::prelude::*;

let proc = GeometricBrownianMotion {
    mu: 1.0,
    sigma: 1.0,
};

let sim = proc.run_euler_maruyama(1.0, 0.0, 1.0, 20);
let _ = export_to_pickle(sim, "/tmp/test.pickle").unwrap();

Dependencies

~7MB
~133K SLoC