Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

NDSolve Quirkiness - Updating the initial conditions after each step?

  1. Aug 6, 2010 #1
    I'm modeling a physical system described by a second-order ODE with LOTS of parameters.

    Using SciLab, I sucessfully implimented the model using a while loop with time. Because of the loop structure, every time I called the DE solver (ode), I updated the intial conditions for the current solution with the output from the previous iteration of ode. For example, my original initial conditions, theta[0] = 0 and theta'[0] = 0, would be updated with the solution after the first step.

    Now, due to the usefulness (and downright awesomeness) of the Manipulate function, I would like to acheive the same setup in Mathematica. In the process of checking the continuity between Mathematica and SciLab, I ran the ode solver in SciLab without the loop and simply using the original initial conditions. The problem I'm having in both Mathematica and SciLab is that, without updating the intial conditions after each iteration, both solvers fail to return the values that I achieved in Scilab with the loop.

    Normally, I would be inclined to trust the solution found without updating the intial conditions. However, I have verified the correctness of the SciLab-looped solution with an analytic solution. The SciLab-looped numerical solution does exactly what I would expect, it converges on the analytic steady-state solution in a predictable fashion.

    Should I write a loop in mathematica that updates the initial conditions for NDSolve or is it as simple as changing the solution method?
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted