DifferentialEquations.jl icon indicating copy to clipboard operation
DifferentialEquations.jl copied to clipboard

Solving ODE in reverse time requires negative dt for saveat

Open rvignolo opened this issue 6 years ago • 6 comments

Hi!

Is it possible to solve ODEs using terminal conditions instead of initial conditions? I know I can make a change of variable to transform the problem from terminal conditions to initial ones, but I would like to solve it directly using something like:

tspan = (1.0, 0.0)
uT = [0.0]
ode = ODEProblem(rhs, uT, tspan, p)
...

Thanks!

rvignolo avatar Oct 03 '19 20:10 rvignolo

Yes, it works. Give it a try!

ChrisRackauckas avatar Oct 03 '19 20:10 ChrisRackauckas

Are you using positive or negative solf.dt?

ChrisRackauckas avatar Oct 03 '19 21:10 ChrisRackauckas

positive

rvignolo avatar Oct 03 '19 21:10 rvignolo

What happens if you make it negative?

ChrisRackauckas avatar Oct 03 '19 21:10 ChrisRackauckas

It seems that it worked correctly when using a negative dt. Sorry for the delay, I was out!

maybe you should accept either a negative or positive dt and change it accordingly in the source code.

Thanks!

rvignolo avatar Oct 03 '19 22:10 rvignolo

Yup, good suggestion! Reopened and re-titled along the lines of that.

ChrisRackauckas avatar Oct 04 '19 15:10 ChrisRackauckas