Class xlifepp::EulerTP#

template<class T, class P>
class EulerTP : public xlifepp::OdeSolverTP<T, P>#

Euler method for solving ODEs with function depending on parameters.

This class implements the Euler method for solving ODEs of the form y’=f(t,y,params). The method computes the solution by iteratively updating the state y at each time step dt, using the formula: y(t+dt) = y(t) + dt * f(t,y(t),params) where f(t,y(t),params) is the derivative of y at time t. The compute method fills the tys_ list with pairs of (time, state) at each time step. The class also provides methods to access the computed states and times, and to save the results to a file.

Template Parameters:
Param f:

function of the ODE y’=f(t,y,params) with prototype T& f(real_t t, const T& y, T& fty, P& params)

Param t0:

initial time

Param tf:

final time

Param dt:

initial time step

Param y0:

initial state

Param pars:

parameters for the function f

Param na:

name of the method (default is “Euler”)

Note

This class is not meant to be used directly, but as a base class for specific ODE solvers like Euler.