| Crates.io | spawn-stochastic |
| lib.rs | spawn-stochastic |
| version | 0.1.0 |
| created_at | 2024-09-09 19:41:40.696911+00 |
| updated_at | 2024-09-09 19:41:40.696911+00 |
| description | A Rust library for simulating multiple stochastic processes including ABM, GBM, Ornstein-Uhlenbeck, Feller Square Root, and Brownian Bridge. |
| homepage | https://github.com/nzengi/spawn-stochastic |
| repository | https://github.com/nzengi/spawn-stochastic |
| max_upload_size | |
| id | 1369738 |
| size | 9,636 |
This Rust library provides implementations for multiple stochastic processes, including:
Each of these processes is commonly used in financial modeling, scientific simulations, and mathematical research.
This library includes:
OsRng.To include this library in your Rust project, add the following line to your Cargo.toml under [dependencies]:
[dependencies]
stochastic_processes = "0.1.0"
Arithmetic Brownian Motion (ABM)
use stochastic_processes::abm::ArithmeticBrownianMotion;
fn main() {
let abm = ArithmeticBrownianMotion::new(0.05, 0.4, 50, 200, 1.0, 200.0);
let paths = abm.simulate();
for path in paths {
println!("{:?}", path);
}
}
use stochastic_processes::gbm::GeometricBrownianMotion;
fn main() {
let gbm = GeometricBrownianMotion::new(0.2, 0.4, 50, 200, 1.0, 500.0);
let paths = gbm.simulate();
for path in paths {
println!("{:?}", path);
}
}
use stochastic_processes::ou::OrnsteinUhlenbeck;
fn main() {
let ou = OrnsteinUhlenbeck::new(10.0, 0.07, 0.1, 50, 200, 1.0, 0.05);
let paths = ou.simulate();
for path in paths {
println!("{:?}", path);
}
}
use stochastic_processes::feller::FellerSquareRoot;
fn main() {
let feller = FellerSquareRoot::new(5.0, 0.1, 0.2, 50, 200, 1.0, 0.05);
let paths = feller.simulate();
for path in paths {
println!("{:?}", path);
}
}
use stochastic_processes::bridge::BrownianBridge;
fn main() {
let bridge = BrownianBridge::new(0.0, 1.0, 0.2, 50, 200, 1.0);
let paths = bridge.simulate();
for path in paths {
println!("{:?}", path);
}
}