Re: Inverse of Interpolating Function?
- To: mathgroup at smc.vnet.net
- Subject: [mg120421] Re: Inverse of Interpolating Function?
- From: Gary Wardall <gwardall at gmail.com>
- Date: Thu, 21 Jul 2011 21:08:41 -0400 (EDT)
- References: <201107210945.FAA06489@smc.vnet.net>
Yes, that is so. I kind of thought that's what GR should do,
Gary
On Thu, Jul 21, 2011 at 5:17 AM, Oliver Ruebenkoenig
<ruebenko at wolfram.com>wrote:
> On Thu, 21 Jul 2011, Gary Wardall wrote:
>
> On Jul 20, 5:34 am, gonzorascal <dj... at duke.edu> wrote:
>>
>>> 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 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.
>>>
>>> -GR
>>>
>>
>> gonzorascal,
>>
>> First make sure the function you wish to have an inverse function is a
>> function that has an inverse function. A quick visual test is the
>> Horizontal Test for Inverse Functions. If any horizontal line
>> intersects the graph twice or more then the inverse is NOT an inverse
>> function. Graph the function you wish to create an inverse function
>> for. If it fails the horizontal test you may have ti restrict your
>> function like is done in Trigonometry. If it passes try something like
>> in my example.
>>
>>
>> points = {{0, -1}, {1, 1}, {2, 3}, {3, 4}, {4, 6}, {5, 10}}; ifun=
>> Interpolation[points]
>> Does the function pass the Horizontal Test?
>>
>> Plot[ifun[x], {x, 0, 5}]
>>
>> It does. Define:
>>
>> invifun[x_] := FindRoot[ifun[y] == x, {y, 0, 5}][[1]][[2]]
>>
>> Note that:
>>
>> ifun[invifun[4]]
>>
>> is 4.
>>
>> and
>>
>> invifun[ifun[3]]
>>
>> is 3.
>>
>> and look at the sketch.
>>
>> Plot[{invifun[x], ifun[x], x}, {x, 0, 5}, PlotRange -> {0, 5},
>> AspectRatio -> Automatic]
>>
>> We have an inverse function.
>>
>> I hope this will help.
>>
>> Good Luck
>>
>> Gary Wardall
>>
>>
>>
> You could also use NDSolve for that - that advantage would be that it will
> generate an interpolation function
>
> init = x /. FindRoot[ifun[x] == 0, {x, 0, 1}]
>
> inf = t /.
> First[NDSolve[{t'[a] == 1/(ifun'[t[a]]), t[0] == init},
> t, {a, 0, 5}]]
>
> Plot[{inf[x], ifun[x], x}, {x, 0, 5}, PlotRange -> {0, 5},
> AspectRatio -> Automatic]
>
> Oliver
>
- References:
- Re: Inverse of Interpolating Function?
- From: Gary Wardall <gwardall@gmail.com>
- Re: Inverse of Interpolating Function?