pub struct BrownianMotion {
pub dt: f64,
pub sigma: f64,
/* private fields */
}Expand description
Standard Wiener process (Brownian motion) W(t).
Generates paths where increments dW ~ N(0, dt). This is the foundation of most continuous-time stochastic models.
Fields§
§dt: f64Time step for path simulation.
sigma: f64Diffusion coefficient (sigma). Default is 1.0 for standard BM.
Implementations§
Source§impl BrownianMotion
impl BrownianMotion
Sourcepub fn new(dt: f64, seed: u64) -> Self
pub fn new(dt: f64, seed: u64) -> Self
Creates a new standard Brownian motion with given time step and seed.
Sourcepub fn with_sigma(dt: f64, sigma: f64, seed: u64) -> Self
pub fn with_sigma(dt: f64, sigma: f64, seed: u64) -> Self
Creates a scaled Brownian motion with diffusion coefficient sigma.
Sourcepub fn path(&self, n_steps: usize) -> Vec<f64>
pub fn path(&self, n_steps: usize) -> Vec<f64>
Generate a path of n_steps from W(0) = 0.
Returns n_steps + 1 values (including initial W = 0).
Sourcepub fn variance_at(&self, t: f64) -> f64
pub fn variance_at(&self, t: f64) -> f64
Compute theoretical variance at time t = n_steps * dt.
For standard BM, Var[W(t)] = sigma^2 * t.
Sourcepub fn multi_path(&self, n_paths: usize, n_steps: usize) -> Vec<Vec<f64>>
pub fn multi_path(&self, n_paths: usize, n_steps: usize) -> Vec<Vec<f64>>
Generate multiple paths for Monte Carlo. Returns matrix [path_idx][step].
Sourcepub fn quadratic_variation(path: &[f64]) -> f64
pub fn quadratic_variation(path: &[f64]) -> f64
Quadratic variation estimate for a path (should converge to sigma^2 * T).
Auto Trait Implementations§
impl Freeze for BrownianMotion
impl RefUnwindSafe for BrownianMotion
impl Send for BrownianMotion
impl Sync for BrownianMotion
impl Unpin for BrownianMotion
impl UnsafeUnpin for BrownianMotion
impl UnwindSafe for BrownianMotion
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.