MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Problems integrating InterpolatingFunction

  • To: mathgroup at smc.vnet.net
  • Subject: [mg116081] Re: Problems integrating InterpolatingFunction
  • From: Sergio Miguel Terrazas Porras <sterraza at uacj.mx>
  • Date: Tue, 1 Feb 2011 06:53:38 -0500 (EST)

Hi guys, thanks for all the help.

The solution finally was to solve (With NDSolve) a sistem of differential equations, which some of you suggested.

Thanks a lot,

Sergio

________________________________________
De: DrMajorBob [btreat1 at austin.rr.com]
Enviado el: lunes, 31 de enero de 2011 11:58 a.m.
Para: mathgroup at smc.vnet.net; Sergio Miguel Terrazas Porras
Asunto: Re: [mg116063] Re: Problems integrating InterpolatingFunction

Clear[y, t]
s = y /. NDSolve[{y'[x] == y[x] Cos[x + y[x]], y[0] == 1},
      y, {x, 0, 30}][[1]];
t = t /. First@NDSolve[{t'[x] == 1/s[x]^2, t[0] == 0}, t, {x, 0, 30}];

Plot[s@x, {x, 0, 30}]

Plot[t@x, {x, 0, 30}]

Bobby

On Mon, 31 Jan 2011 02:24:53 -0600, Sergio Miguel Terrazas Porras
<sterraza at uacj.mx> wrote:

> Hi again, the thing is that I need a function as a result of the
> integration, no a number.
> I can make a very long table of the results of NIntegrate, then try to
> fit the elements of Table, etc.
> I just needed to know if it was possible to obtain a function directly
> from the indefinite integral.
>
> In the documentation there is an example of an indefinte integral of an
> InterpolatinFuntion.
>
> Thanks to all who responded.
>
> Sergio
>
> ________________________________________
> De: Bob Hanlon [hanlonr at cox.net]
> Enviado el: domingo, 30 de enero de 2011 01:32 a.m.
> Para: mathgroup at smc.vnet.net
> Asunto: [mg116049] Re: Problems integrating InterpolatingFunction
>
> You must use NIntegrate
>
> s = y /. NDSolve[{y'[x] == y[x] Cos[x + y[x]], y[0] == 1},
>      y, {x, 0, 30}][[1]];
>
> NIntegrate[1/s[x]^2, {x, 0, 30}]
>
> 10325.5
>
>
> Bob Hanlon
>
> ---- Sergio Miguel Terrazas Porras <sterraza at uacj.mx> wrote:
>
> ====================================================
> 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
>


--
DrMajorBob at yahoo.com


  • Prev by Date: Re: Problems integrating InterpolatingFunction
  • Next by Date: Re: Repeatable ways to crash the MathKernel
  • Previous by thread: Re: Problems integrating InterpolatingFunction
  • Next by thread: Re: some demonstrations no longer work right in version 8