pub struct Langevin<D, G, T: FloatExt = f64>{ /* private fields */ }Expand description
Langevin equation.
$$dX(t) = f(X(t), t),dt + g(X(t), t),dW(t),\qquad X(0)=x_0.$$
where (W(t)) is the Wiener process, also called Brownian motion.
Implementations§
Source§impl<D, G, T: FloatExt> Langevin<D, G, T>
impl<D, G, T: FloatExt> Langevin<D, G, T>
Sourcepub fn new(drift_func: D, diffusion_func: G, start_position: T) -> XResult<Self>
pub fn new(drift_func: D, diffusion_func: G, start_position: T) -> XResult<Self>
Create a new Langevin
§Arguments
drift_func- The drift function.diffusion_func- The diffusion function.start_position- The starting position.
§Example
use diffusionx::simulation::continuous::Langevin;
let drift = |x: f64, _t: f64| x;
let diffusion = |_x: f64, _t: f64| 1.0;
let start_position = 0.0;
let langevin = Langevin::new(drift, diffusion, start_position).unwrap();Sourcepub fn get_start_position(&self) -> T
pub fn get_start_position(&self) -> T
Get the starting position
Sourcepub fn get_drift_func(&self) -> &D
pub fn get_drift_func(&self) -> &D
Get the drift function
Sourcepub fn get_diffusion_func(&self) -> &G
pub fn get_diffusion_func(&self) -> &G
Get the diffusion function
Trait Implementations§
Source§impl<D, G, T: FloatExt> ContinuousProcess<T> for Langevin<D, G, T>where
D: Fn(T, T) -> T + Clone + Send + Sync,
G: Fn(T, T) -> T + Clone + Send + Sync,
StandardNormal: Distribution<T>,
impl<D, G, T: FloatExt> ContinuousProcess<T> for Langevin<D, G, T>where
D: Fn(T, T) -> T + Clone + Send + Sync,
G: Fn(T, T) -> T + Clone + Send + Sync,
StandardNormal: Distribution<T>,
Source§fn simulate(&self, duration: T, time_step: T) -> XResult<(Vec<T>, Vec<T>)>
fn simulate(&self, duration: T, time_step: T) -> XResult<(Vec<T>, Vec<T>)>
Simulate the continuous process Read more
Source§fn displacement(&self, duration: T, time_step: T) -> XResult<T>
fn displacement(&self, duration: T, time_step: T) -> XResult<T>
Get the displacement of the continuous process. Read more
Source§fn end(&self, duration: T, time_step: T) -> XResult<T>
fn end(&self, duration: T, time_step: T) -> XResult<T>
Get the ending position at the requested duration.
Source§fn mean(&self, duration: T, particles: usize, time_step: T) -> XResult<T>where
Self: ContinuousTrajectoryTrait<T>,
fn mean(&self, duration: T, particles: usize, time_step: T) -> XResult<T>where
Self: ContinuousTrajectoryTrait<T>,
Get the mean of the continuous process Read more
Source§fn msd(&self, duration: T, particles: usize, time_step: T) -> XResult<T>where
Self: ContinuousTrajectoryTrait<T>,
fn msd(&self, duration: T, particles: usize, time_step: T) -> XResult<T>where
Self: ContinuousTrajectoryTrait<T>,
Get the mean square displacement of the continuous process Read more
Source§fn raw_moment(
&self,
duration: T,
order: i32,
particles: usize,
time_step: T,
) -> XResult<T>where
Self: ContinuousTrajectoryTrait<T>,
fn raw_moment(
&self,
duration: T,
order: i32,
particles: usize,
time_step: T,
) -> XResult<T>where
Self: ContinuousTrajectoryTrait<T>,
Get the raw moment of the continuous process Read more
Source§fn central_moment(
&self,
duration: T,
order: i32,
particles: usize,
time_step: T,
) -> XResult<T>where
Self: ContinuousTrajectoryTrait<T>,
fn central_moment(
&self,
duration: T,
order: i32,
particles: usize,
time_step: T,
) -> XResult<T>where
Self: ContinuousTrajectoryTrait<T>,
Get the central moment of the continuous process Read more
Source§fn frac_raw_moment(
&self,
duration: T,
order: T,
particles: usize,
time_step: T,
) -> XResult<T>where
Self: ContinuousTrajectoryTrait<T>,
fn frac_raw_moment(
&self,
duration: T,
order: T,
particles: usize,
time_step: T,
) -> XResult<T>where
Self: ContinuousTrajectoryTrait<T>,
Get the fractional raw moment of the continuous process Read more
Source§fn frac_central_moment(
&self,
duration: T,
order: T,
particles: usize,
time_step: T,
) -> XResult<T>where
Self: ContinuousTrajectoryTrait<T>,
fn frac_central_moment(
&self,
duration: T,
order: T,
particles: usize,
time_step: T,
) -> XResult<T>where
Self: ContinuousTrajectoryTrait<T>,
Get the fractional central moment of the continuous process Read more
Source§fn fpt(
&self,
domain: (T, T),
max_duration: T,
time_step: T,
) -> XResult<Option<T>>where
Self: Sized,
fn fpt(
&self,
domain: (T, T),
max_duration: T,
time_step: T,
) -> XResult<Option<T>>where
Self: Sized,
Get the first passage time of the continuous process Read more
Source§fn occupation_time(
&self,
domain: (T, T),
duration: T,
time_step: T,
) -> XResult<T>where
Self: Sized,
fn occupation_time(
&self,
domain: (T, T),
duration: T,
time_step: T,
) -> XResult<T>where
Self: Sized,
Get the occupation time of the continuous process Read more
Auto Trait Implementations§
impl<D, G, T> Freeze for Langevin<D, G, T>
impl<D, G, T> RefUnwindSafe for Langevin<D, G, T>
impl<D, G, T> Send for Langevin<D, G, T>
impl<D, G, T> Sync for Langevin<D, G, T>
impl<D, G, T> Unpin for Langevin<D, G, T>
impl<D, G, T> UnsafeUnpin for Langevin<D, G, T>
impl<D, G, T> UnwindSafe for Langevin<D, G, T>
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, SP> ContinuousTrajectoryTrait<T> for SP
impl<T, SP> ContinuousTrajectoryTrait<T> for SP
Source§fn duration(&self, duration_arg: T) -> XResult<ContinuousTrajectory<Self, T>>
fn duration(&self, duration_arg: T) -> XResult<ContinuousTrajectory<Self, T>>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
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.