Would anyone please explain me what is the mathematical algorithm to solve a IVP system of ODE with a time-dependent parameter. e.g.

   dy1/dt = a1(t) * y2 -b1(t)* y3 -c1(t) y1;
   dy2/dt = a2(t) * y1 -b2(t)* y1 -c2(t) y3;
   dy3/dt = a3(t) * y2 -b3(t)* y3 -c3(t) y1;

y(0)=c; My idea so far is that for fixed time-step I should form a vector of a,b,c and assume a,b,c to be constant over that time-period. what about if the system is stiff? Would anyone plaese give me an idea how to solve it using c++ boost library? Thank you in advance.


1 Answer 1


Given an ODE $\dot{y}(t) = f(y(t), t)$, most -- if not all -- algorithms reduce to function evaluations and Jacobian evaluations at specified points in $t$ and $y$. To illustrate, a step of explicit Euler is

\begin{align} y_{n + 1} = y_{n} + (t_{n + 1} - t_{n}) \cdot f(y_{n}, t_{n}). \end{align}

If you have a time-dependent parameter, treat it as part of $f$, the function evaluation (respectively, for implicit methods, also treat it as part of the Jacobian evaluation). A similar strategy applies to more complicated methods for solving ODEs (multistage methods such as Runge-Kutta, implicit methods for stiff systems, etc.). This strategy is different than assuming your parameters are constant over a time step -- for a multistage method, assuming your parameters are constant over a time step will result in inaccurate function evaluations in intermediate stages and reduce the order of your method.

As for solving it using a C++ Boost library, you might try looking at the Boost odeint documentation.

  • $\begingroup$ Further to Geoff's answer, if you have a stiff system, and don't want to use a fully-implicit solver, you might want to consider these explicit solvers that are suited to stiff systems: dumkaland.org $\endgroup$
    – Damien
    Jan 14, 2014 at 4:42
  • $\begingroup$ Thanks for contributing! This answer is better posed as a comment, since it does not address the original question. In addition, if you are the author of those solvers, you should state that, per site policy. $\endgroup$ Jan 14, 2014 at 6:52
  • $\begingroup$ @ Geoff Oxberry Thank you a lot. if it is possible would you please tell me a reference or a web link discussing this topic in detail. I searched several books on numerical solution of ODE but nobody explicitly addressed this issue. I want to study this in more detail- specially stiff equations. @user1533076 Thank you for your comment too. I will check that. Thanks a lot. $\endgroup$ Jan 14, 2014 at 14:26
  • $\begingroup$ @ArijitHazra I doubt any book I recommend (texts like Hairer/Norsett/Wanner, Petzold, Butcher, Lambert) will explicitly address the issue either. Treating parameters as part of the function evaluation is a standard treatment for nonlinear ODEs. A specialized treatment for linear ODEs with variable coefficients could exist; I'm not aware of one. The comment about order reduction comes from my own experience writing and testing ODE solvers. $\endgroup$ Jan 14, 2014 at 19:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.