pub struct BrownianMotion;Expand description
Parameters and generators for Brownian motion processes.
Implementations§
Source§impl BrownianMotion
impl BrownianMotion
Sourcepub fn standard(t: f64, n_steps: usize, seed: u64) -> Vec<f64>
pub fn standard(t: f64, n_steps: usize, seed: u64) -> Vec<f64>
Simulate a standard Brownian motion path W(t) on [0, T] with n_steps steps.
Returns a vector of length n_steps + 1 starting at 0, where increments
are iid N(0, dt).
Sourcepub fn geometric(
s0: f64,
mu: f64,
sigma: f64,
t: f64,
n_steps: usize,
seed: u64,
) -> Vec<f64>
pub fn geometric( s0: f64, mu: f64, sigma: f64, t: f64, n_steps: usize, seed: u64, ) -> Vec<f64>
Simulate a Geometric Brownian Motion S(t) = S0 * exp((mu - 0.5*sigma^2)t + sigmaW(t)).
Returns the price path of length n_steps + 1.
Sourcepub fn fractional(hurst: f64, n_steps: usize, seed: u64) -> Vec<f64>
pub fn fractional(hurst: f64, n_steps: usize, seed: u64) -> Vec<f64>
Simulate a Fractional Brownian Motion (fBm) path with Hurst exponent H.
Uses the Davies-Harte (spectral) method via a circulant embedding. Valid for H in (0, 1); H = 0.5 recovers standard BM.
Sourcepub fn quadratic_variation(path: &[f64]) -> f64
pub fn quadratic_variation(path: &[f64]) -> f64
Compute the quadratic variation of a path (empirical check for BM).
For a standard BM of length T, the quadratic variation converges to 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.