Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #4179

Re: Integrating Interpolating function

From Robert Rosenbaum <robertr@math.uh.edu>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Integrating Interpolating function
Date 2011-08-03 23:56 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j1cn81$gmd$1@smc.vnet.net> (permalink)
References <201108031107.HAA10850@smc.vnet.net> <201108031139.HAA11409@smc.vnet.net>

Show all headers | View raw


> To integrate over an InterpolatingFunction, you need to use NIntegrate

You don't necessarily need to use NIntegrate.  Integrate will 
automatically use numerical schemes on InterpolatingFunctions.  But you 
have to apply the rule sol.  For example:

sol = NDSolve[{f'[t] == f[t], f[0] == 1}, f, {t, 0, 10}][[1]]

Integrate[f[t] /. sol, {t, 0, 5}]
NIntegrate[f[t] /. sol, {t, 0, 5}]


Best,
Robert


On Aug 3, 2011, at 6:39 AM, James Womack wrote:

>
> To integrate over an InterpolatingFunction, you need to use NIntegrate
> (numerical integration), rather than Integrate. Hope this helps!
>
> On 3 August 2011 12:07, math_new <dom.woe@gmail.com> 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
>>
>>






Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Integrating Interpolating function Robert Rosenbaum <robertr@math.uh.edu> - 2011-08-03 23:56 +0000

csiph-web