Re: Integrating Interpolating function
- To: mathgroup at smc.vnet.net
- Subject: [mg120701] Re: Integrating Interpolating function
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Thu, 4 Aug 2011 02:53:16 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201108031107.HAA10850@smc.vnet.net>
- Reply-to: drmajorbob at yahoo.com
> s = NDSolve[{y'[x] == y[x] Cos[x + y[x]], y[0] == 1}, y, {x, 0, 30}] > NIntegrate[t*s[t], {t, 0, 30}] > > does what you are looking for. No, it doesn't. Instead, you need something like s = y /. First@ NDSolve[{y'[x] == y[x] Cos[x + y[x]], y[0] == 1}, y, {x, 0, 30}]; NIntegrate[t*s[t], {t, 0, 30}] 46.9655 Bobby On Wed, 03 Aug 2011 18:20:37 -0500, Oliver Ruebenkoenig <ruebenko at wolfram.com> wrote: > On Wed, 3 Aug 2011, math_new wrote: > >> Hi, >> >> I solve a system of differential equations using NDSolve up to time >> t_end. which gives me something like >> >> sol = {f->InterpolatingFunction} >> >> Now I want to do an integral like that >> >> Integrate[t*f[t],{t,0,tend}] >> >> but it won't be computed. What am I doing wrong? >> >> Cheers >> >> > > Hi > > s = NDSolve[{y'[x] == y[x] Cos[x + y[x]], y[0] == 1}, y, {x, 0, 30}] > NIntegrate[t*s[t], {t, 0, 30}] > > does what you are looking for. > > Hth, > Oliver > -- DrMajorBob at yahoo.com
- References:
- Integrating Interpolating function
- From: math_new <dom.woe@gmail.com>
- Integrating Interpolating function