Trait integrators::SymplecticIntegrator
source · [−]pub trait SymplecticIntegrator<F: Float> {
fn accelerations(&self, t: F, x: &[F]) -> Result<Vec<F>>;
fn integrate(
&self,
x: &[F],
t_0: F,
h: F,
n: usize,
integrator: Integrators
) -> Result<Result<F>> { ... }
fn leapfrog(
&self,
t_0: F,
h: F,
n: usize,
result: &mut Result<F>,
token: &Token
) -> Result<()> { ... }
fn leapfrog_once(
&self,
t: F,
x_prev: &[F],
h: F,
_: &Token
) -> Result<Vec<F>> { ... }
fn prepare(&self, x: Vec<F>, n: usize, _: &Token) -> Result<F> { ... }
fn yoshida_4th(
&self,
t_0: F,
h: F,
n: usize,
result: &mut Result<F>,
token: &Token
) -> Result<()> { ... }
}
Expand description
A symplectic integrator for a system of 1st-order ODEs
Required methods
fn accelerations(&self, t: F, x: &[F]) -> Result<Vec<F>>
fn accelerations(&self, t: F, x: &[F]) -> Result<Vec<F>>
Compute the current values of accelerations as defined by a system of 2nd-order ODEs, return the result
Arguments:
t
— Current time moment;x
— Current values of positions.
Provided methods
Integrate the system of 1st-order ODEs
Arguments:
x
— Vector of initial values;t_0
— Initial value of time;h
— Time step;n
— Number of iterations;integrator
— Integration method.
Integrate the system using the leapfrog method
Arguments:
t_0
— Initial value of time;h
— Time step;n
— Number of iterations;result
— Result matrix;token
— Private token.
Integrate the system once using the leapfrog method, return the current state of the system and new accelerations
Arguments:
i
— Current index of the state;t
— Current time moment;x
— Current state of the system;a
— Current vector of accelerations;h
— Time step;token
— Private token.
Prepare a matrix for the result and put the initial values in the first column
Arguments:
x
— Vector of initial values;n
— Number of iterations;token
— Private token.