Consider an initial value problem (IVP) $y'=f(t,y)$ with the initial value given by $y(t=0) = 0$.

If I need to find $y(t^*)$, hence finding the path for $y$ in $t \in [0,t^*]$ and $t^*<0$; is the problem then still an initial value problem? In other words can you go back in time in IVP.

The reason I ask is that I have an algorithm where in each step I need to solve for different $t^*$. I intend to use solve_ivp in Python which is based on Runge-Kutta 45 method and I want to know if there are any theoretical contradictions when I apply RK45.

I know that if I will use Eulers method then there is no problem. But what about RK45. Will I get the desired result.


2 Answers 2


This is technically still an IVP if you do an appropriate change of variables. Given your time is between $t \in [t^*, 0]$, make a new time variable $\tau = -t$ so that $\tau \in [0, -t^*]$ and you can modify the time derivatives accordingly. This means that you should have the differential equation $\frac{dy}{d\tau} = -f(-\tau, y)$ with $y(\tau = 0) = 0$ as your new IVP. This implies that you should be able to use Runge-Kutta approaches just fine.

  • 3
    $\begingroup$ Some time stepping methods have a property called "reversibility". This means, essentially, that you will end up where you started if you go forward and then backward again. Depending on what you want to achieve, this might be an important thing to look at! I am pretty sure that RK45 is not reversible, for example. $\endgroup$
    – Daniel
    Commented Jun 19, 2019 at 11:40

There is no direction prescribed in the solution of an initial-value problem. A function $y:(\alpha,\beta)\to\Bbb R^n$ solves an IVP if $α<t_0<β$ and $y(t_0)=y_0$, and of course $y'(t)=f(t,y(t))$ for all $t\in (α,β)$.

While numerical solvers have directionality built-in, publicized solvers usually treat negative step sizes as well as positive step sizes. Only switching the direction during the integration is usually not supported. So calling

res = solve_ivp(f,[0,ts],y0)

will work equally well for positive and negative ts$=t^*$.


Your Answer

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

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