Skip to main content

BrownianMotion

Struct BrownianMotion 

Source
pub struct BrownianMotion {
    pub x_0: f64,
    pub drift: f64,
    pub volatility: f64,
    /* private fields */
}
Expand description

Standard Brownian motion dX = μ dt + σ dW, X(0) = x₀. Useful as a baseline simulator for testing the trait plumbing and as a building block for composite SDEs. Defaults: x₀ = 0, μ = 0, σ = 1.

§Papers

  • Brown, R. (1828) — A Brief Account of Microscopical Observations. The phenomenon.
  • Wiener, N. (1923) — Differential Space, Journal of Mathematics and Physics 2: 131–174. The mathematical construction.
  • Itô, K. (1944) — Stochastic Integral, Proceedings of the Imperial Academy 20(8): 519–524. Itô calculus underpinning every SDE in this crate.

Fields§

§x_0: f64§drift: f64§volatility: f64

Implementations§

Source§

impl BrownianMotion

Source

pub fn new(seed: u64) -> Self

Source

pub fn with_drift(self, mu: f64) -> Self

Source

pub fn with_volatility(self, sigma: f64) -> Self

Source

pub fn with_initial(self, x_0: f64) -> Self

Trait Implementations§

Source§

impl SimulationModel for BrownianMotion

Source§

type State = f64

Per-path state snapshot. Required to be Clone so the MC loop can keep a working copy per path while also capturing snapshots at each observation date. Small scalar states (HW, BM, GBM) stay Copy-derived and pay no runtime cost; variable-size states (the generalised FMM, which carries Vec<f64> per-rate buffers) satisfy Clone with a single heap copy per captured observation.
Source§

fn initial_state(&self) -> Self::State

State at the valuation date (t = 0).
Source§

fn step(&mut self, state: &Self::State, _t: f64, dt: f64) -> Self::State

Advance state by dt starting at year-fraction t. The implementation may consume draws from the model’s internal RNG.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

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

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V