Re: Problems integrating InterpolatingFunction
- To: mathgroup at smc.vnet.net
- Subject: [mg116074] Re: Problems integrating InterpolatingFunction
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Tue, 1 Feb 2011 06:52:19 -0500 (EST)
Oops, I had fixed it, but sent a bad version anyway! This works:
Clear[x, y, t]
x[t_] = x[t] /.
First@NDSolve[{x''[t] == -x[t]^3 + x[t], x'[0] == 0, x[0] == 1.42},
x[t], {t, 0, 100}];
y[t_] = Derivative[-1][x][t];
Plot[{x@t, y@t}, {t, 0, 100}]
Bobby
On Mon, 31 Jan 2011 13:08:24 -0600, Roland Franzius
<roland.franzius at uos.de> wrote:
> Am 31.01.2011 19:42, schrieb DrMajorBob:
>> You wrote Y as its own integral, which causes $RecursionLimit errors.
>>
>> You probably meant something like
>>
>> Clear[x, y]
>> x[t_] = x[t] /.
>> NDSolve[{x''[t] == -x[t]^3 + x[t], x'[0] == 0, x[0] == 1.42},
>> x[t], {t, 0, 100}] // First
>> y[t_] = Derivative[-1][y][t]
>>
>> Bobby
>
> which is not really a better approach :-(
>
>
> Roland
>
>> On Mon, 31 Jan 2011 02:23:31 -0600, Roland Franzius
>> <roland.franzius at uos.de> wrote:
>>
>>> Am 30.01.2011 01:43, schrieb Sergio Miguel Terrazas Porras:
>>>> Hello group,
>>>>
>>>> I use NDSolve for a nonlinear differential equation, and I get an
>>>> InterpolatingFunction, as expected.
>>>>
>>>> I can plot it, evaluate it, etc.
>>>>
>>>> The problem I have is that now I need to integrate 1/(the square of
>>>> the InterpolatingFunction), and I get nothing but the input back.
>>>>
>>>> Any ideas?
>>>>
>>>> Thanks in advance.
>>>>
>>>> Sergio Terrazas
>>>>
>>>
>>> Yoy can integrate InterpolatingFunction explitely using Derivative of
>>> negative order
>>>
>>> eg the critical soltion to the equations of motion of an anharmonic
>>> pendulum
>>>
>>> X[t_] = x[t] /.
>>> NDSolve[{x''[t] == -x[t]^3 + x[t], x'[0] == 0, x[0] == 1.42},
>>> x[t], {t, 0, 100}] // First
>>>
>>> Y[t_]=Derivative[-1][Y][t]
>>>
>>
>>
>
--
DrMajorBob at yahoo.com