This may sound really weird...

Consider the following Cauchy problem:

Find $y(t)$ for all $t \geq 0$ such that: $$\begin{cases} \dot{y} & = f(t, y)\\ y(T) &= Y \end{cases},$$ for some $T > 0$.

I know that, under suitable conditions, this Cauchy problem has exactly one solution.

Anyway, all numerical tools that I know are meant (or I believe so!) to solve problems like:

Find $y(t)$ for all $t \geq 0$ such that: $$\begin{cases} \dot{y} & = f(t, y)\\ y(0) &= Y \end{cases},$$

How can I solve the first problem?


You can follow the suggestion by @LutzLehmann or you can just perform a change of variables, $\tau = T - t$ and get something like $$ \begin{cases}y'(\tau) = - f(\tau, y(\tau)) \\[0.7em] y(0)= Y \end{cases}. $$


Ancient trade secret: You can apply the numerical methods also with a negative step size.

Most numerical tools also support this, the sequence of evaluation points, if given, just has to be monotonous. This makes two calls to the ODE solver routine, one for the interval $[0,T]$ and one for $[T,T_{end}]$

Test of concept: Plot solutions of $y'(x)=\frac{x-y}{x+y}$ with value $y(2)$ around $2$ for $x\in[-1,5]$.

f=lambda y,x: (x-y)/(x+y)
x1 = np.linspace(2,-1,150)
x2 = np.linspace(2,5,150)
for y0 in 2+np.linspace(-0.5,0.5,6):
    y1,y2 = (odeint(f,y0,x) for x in (x1,x2))
    l, = plt.plot(x1,y1)
    c = l.get_color()
plt.grid(); plt.legend()

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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