Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #4182 > unrolled thread
| Started by | DrMajorBob <btreat1@austin.rr.com> |
|---|---|
| First post | 2011-08-04 06:53 +0000 |
| Last post | 2011-08-04 06:53 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Integrating Interpolating function DrMajorBob <btreat1@austin.rr.com> - 2011-08-04 06:53 +0000
| From | DrMajorBob <btreat1@austin.rr.com> |
|---|---|
| Date | 2011-08-04 06:53 +0000 |
| Subject | Re: Integrating Interpolating function |
| Message-ID | <j1dfm7$m37$1@smc.vnet.net> |
> 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@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@yahoo.com
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web