Re: Integration of InterpolatingFunction
- To: mathgroup at smc.vnet.net
- Subject: [mg108408] Re: Integration of InterpolatingFunction
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Wed, 17 Mar 2010 04:37:08 -0500 (EST)
Because it is not an algebraic expression. Use NIntegrate
timevector = Range[0, 1, .1];
discretesolution = RandomReal[{0, 1}, 11];
spline = Interpolation[Thread[{timevector, discretesolution}],
InterpolationOrder -> 1];
NIntegrate[spline[t] + 2, {t, 0, 1}]
2.47205
Bob Hanlon
---- Benjamin Hell <hell at exoneon.de> wrote:
=============
Hi,
I would like to use Integrate with on an InterpolatingFunction, which is
a spline. As the Interpolating function is a spline this should be
possible. And indeed it is, as long as I do not combine the
Interpolating function with any other function. Here is a simple example:
Define
/timevector = Table[i*0.1, {i, 0, 10}];
discretesolution = Table[Random[], {i, 0, 10}];
spline = Interpolation[Thread[{timevector, discretesolution}],
InterpolationOrder -> 1];
/
Then the following works fine:
/Integrate[spline[t], {t, 0, 1}]/
But the following does not:
/Integrate[spline[t]+2, {t, 0, 1}]/
Why is that?
Thanks in advance,
Benjamin