# Backward in time numerical integration with fixed time step

Consider simple use of NDSolve[] function used to solve an ODE backward in time

NDSolve[{x'[t] == x[t], x[0] == 1}, x, {t, -1, 0}]

With default settings one can obtain solution in domain $[-1,0]$. If I would like to use a fixed step integration with a priori choosen step size I would call

NDSolve[{x'[t] == x[t], x[0] == 1}, x, {t, -1, 0},
Method -> {"FixedStep", Method -> Automatic, "StepSize" -> 1/10}]

The above code fails to give a result and complains

NDSolve::sss: Unable to determine a starting step size for the method NDSolve`FixedStep. >>

Why is that the "FixedStep" method of NDSolve[] do not support backward in time integration?

– ciao
Sep 9, 2015 at 21:12
– mmal
Sep 10, 2015 at 7:46
• Oh, sorry, It was leg-pulling, as in I answered it before you posted it, as in... backward in time...
– ciao
Sep 10, 2015 at 7:53

Based on the documentation to "FixedStep" Method for NDSolve, I suggest

s = First@NDSolve[{x'[t] == x[t], x[0] == 1}, x, {t, -1, 0},
StartingStepSize -> 1/10, Method -> {"FixedStep", Method -> Automatic}];
Plot[x[t] /. s, {t, -1, -0}, AxesLabel -> {x, t}]

The key change is to use StartingStepSize as an option instead of "StepSize" as a method.

• Yes, I was aware of this solution. But, isn't it a little bit too odd... I mean changing direction of integration shouldn't change the precedence of options? It still doesn't work when one specify both StartingStepSize and StepSize options.
– mmal
Sep 10, 2015 at 19:53
• @mmal. Yes, it is strange. But, there are lots of strange things about Mathematica. Sep 10, 2015 at 20:18
• @mma It doesn't hurt to report it. Who knows if this can be added to the improvements list... Sep 10, 2015 at 21:10
• @mmal I agree. Please do report this. Sep 10, 2015 at 21:30
• @P.Fonseca I think it does not. The purpose of this question was to see if anyone has a working solution, probably someone may know more about the NDSolve machinery and be able to explain observed behavior...
– mmal
Sep 11, 2015 at 6:55