Stan Math Library
4.9.0
Automatic Differentiation
|
std::vector< Eigen::Matrix< stan::return_type_t< T_y0, T_t0, T_ts, Args... >, Eigen::Dynamic, 1 > > stan::math::ode_rk45_tol | ( | const F & | f, |
const T_y0 & | y0_arg, | ||
T_t0 | t0, | ||
const std::vector< T_ts > & | ts, | ||
double | relative_tolerance, | ||
double | absolute_tolerance, | ||
long int | max_num_steps, | ||
std::ostream * | msgs, | ||
const Args &... | args | ||
) |
Solve the ODE initial value problem y' = f(t, y), y(t0) = y0 at a set of times, { t1, t2, t3, ... } using the non-stiff Runge-Kutta 45 solver in Boost.
If the system of equations is stiff, ode_bdf
will likely be faster.
f
must define an operator() with the signature as: template<typename T_t, typename T_y, typename... T_Args> Eigen::Matrix<stan::return_type_t<T_t, T_y, T_Args...>, Eigen::Dynamic, 1> operator()(const T_t& t, const Eigen::Matrix<T_y, Eigen::Dynamic, 1>& y,
std::ostream* msgs, const T_Args&... args);
t is the time, y is the vector-valued state, msgs is a stream for error messages, and args are optional arguments passed to the ODE solve function (which are passed through to f
without modification).
F | Type of ODE right hand side |
T_0 | Type of initial time |
T_ts | Type of output times |
T_Args | Types of pass-through parameters |
f | Right hand side of the ODE | |
y0_arg | Initial state | |
t0 | Initial time | |
ts | Times at which to solve the ODE at. All values must be sorted and greater than t0. | |
relative_tolerance | Relative tolerance passed to Boost | |
absolute_tolerance | Absolute tolerance passed to Boost | |
max_num_steps | Upper limit on the number of integration steps to take between each output (error if exceeded) | |
[in,out] | msgs | the print stream for warning messages |
args | Extra arguments passed unmodified through to ODE right hand side |
ts
Definition at line 201 of file ode_rk45.hpp.