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

Inverse of Interpolating Function?

  1. Jul 19, 2011 #1
    Hello All,

    I am working with an Interpolating Function of an oscillating solution (time series) to a differential equation. I am trying to find the period and pulse width of the oscillation. To do this I would like to have an inverse of my function y[t] (so I would have t[y]). I realize this function would be multivalued (that's in part what I want to find the period). I am not having success using Mathematica's InverseFunction[] or Reduce[] commands. Does anyone have any experience or suggestions with this sort of thing (either finding Inverse Interpolating Functions or another method for period and pulse width)? Thank you.

  2. jcsd
  3. Jul 19, 2011 #2
    I don't know of any way to do what you want without some programming. You can use FindRoot to Find a root near an estimate, but to get all the roots you're going to have to do some hunting. Something like Table[y[t], {t,tmin,tmax,dt}], where you choose dt small enough that you feel confident of not missing any roots, then search for places where the sign changes, then use FindRoot with Method->"Brent" to locate each root.

    A better way to do this would be to use the actual grid of values stored in the interpolating function. Needs["DifferentialEquations`InterpolatingFunctionAnatomy`"] will load some functions that will allow you to do this. This is documented in Mathematica under "tutorial/NDSolvePackages".
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook