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

Mathematica: ODE's

  1. Feb 20, 2012 #1

    I have a system of ODEs of the form

    dx/dt = v
    dv/dt = a = C*f(x),

    where C denotes a constant and f(x) is some function of x. This system is easy to solve using (e.g.)
    Code (Text):

    NDSolve[x''[t] == C*f(x), x[0] == 0, x'[0] == 0}, x, {t, 0, tMax}];
    I need to use the derivative of the solution x[t], x'[t], in the following expression: B(x) = A + v(x), where A denotes a constant. But please note that the derivative is needed as a function of x, not t. I've been trying to figure out a smart way to do this, but I can't wrap my head around this. What should I do to achieve this?

    Best regards,
    Last edited: Feb 20, 2012
  2. jcsd
  3. Feb 20, 2012 #2


    User Avatar
    Science Advisor

    Since you have x[t], you need to invert this to find t[x], then, since you know v[t], your v[x] is given by v[t[x]]. If you have an analytic solution, you can do this analytically, but if you have a numerical solution, the easiest way to invert it is probably with FindRoot. See the attached notebook.

    Attached Files:

  4. Feb 21, 2012 #3
    Thanks, that is very kind of you.

Share this great discussion with others via Reddit, Google+, Twitter, or Facebook