Implementation:Avhz RustQuant BrownianMotion
| Knowledge Sources | |
|---|---|
| Domains | Stochastic_Processes, Quantitative_Finance |
| Last Updated | 2026-02-07 19:00 GMT |
Overview
Concrete implementation of standard Brownian Motion (Wiener process) provided by the RustQuant library.
Description
Brownian Motion (also known as the Wiener process) is the fundamental continuous-time stochastic process defined by the SDE:
dX(t) = dW(t)
It has zero drift and unit diffusion. The process has independent, normally distributed increments with mean 0 and variance equal to the time increment. At any time t, X(t) ~ N(0, t) when starting from X(0) = 0.
This is a parameterless process -- no drift or volatility parameters are needed.
Usage
Use this process as the fundamental building block for more complex stochastic models. Standard Brownian Motion is used to generate random noise for simulating other SDEs, or directly when modeling phenomena with zero drift and unit variance rate.
Code Reference
Source Location
- Repository: RustQuant
- File: crates/RustQuant_stochastics/src/brownian_motion.rs
- Lines: 1-114
Signature
#[derive(Debug)]
pub struct BrownianMotion {}
impl BrownianMotion {
pub fn new() -> Self
}
impl Default for BrownianMotion {
fn default() -> Self
}
impl StochasticProcess for BrownianMotion {
fn drift(&self, _x: f64, _t: f64) -> f64 // returns 0.0
fn diffusion(&self, _x: f64, _t: f64) -> f64 // returns 1.0
fn jump(&self, _x: f64, _t: f64) -> Option<f64>
fn parameters(&self) -> Vec<f64>
}
Import
use RustQuant::stochastics::BrownianMotion;
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| (none) | -- | -- | No parameters required; constructed via BrownianMotion::new() |
Outputs
| Name | Type | Description |
|---|---|---|
| drift() | f64 | Always returns 0.0 |
| diffusion() | f64 | Always returns 1.0 |
| jump() | Option<f64> | Always returns None (no jump component) |
| parameters() | Vec<f64> | Returns an empty vector |
Usage Examples
use RustQuant::stochastics::BrownianMotion;
use RustQuant::stochastics::{StochasticProcessConfig, StochasticScheme};
// Create a standard Brownian Motion
let bm = BrownianMotion::new();
// Configure simulation: x0=0.0, t_start=0.0, t_end=0.5, n_steps=100, 1000 paths
let config = StochasticProcessConfig::new(
0.0, 0.0, 0.5, 100, StochasticScheme::EulerMaruyama, 1000, false, None
);
let output = bm.generate(&config);
// Access simulated paths
let paths = &output.paths;