[Date Index]
[Thread Index]
[Author Index]
Re: analytic integration of InterpolatingFunction compositions
*To*: mathgroup at smc.vnet.net
*Subject*: [mg74065] Re: [mg74046] analytic integration of InterpolatingFunction compositions
*From*: "Chris Chiasson" <chris at chiasson.name>
*Date*: Thu, 8 Mar 2007 04:37:48 -0500 (EST)
*References*: <200703070815.DAA26693@smc.vnet.net>
It is interesting that the result of Integrate on the
InterpolatingFunction is just unevaluated (heh, after the smoke of a
bunch of burning rule conditions clears) because the documentation for
NIntegrateInterpolatingFunction specifically mentions the following:
If you simply need to find the integral of an InterpolatingFunction
object (as opposed to a function of one), it is better to use
Integrate because this gives you the result which is exact for the
polynomial approximation used in the InterpolatingFunction object.
On 3/7/07, Roman <rschmied at gmail.com> wrote:
> Hello all:
>
> When I have a simple InterpolatingFunction[] object from an NDSolve[]
> call, I know I can analytically integrate this by using Integrate[].
> However, what I want to do is analytically integrate compositions of
> such InterpolatingFunction[] objects, which Integrate[] cannot handle.
> For example, let
>
> f = y /. First[NDSolve[{y'[x] == x*y[x]^2, y[0] == 1}, y, {x, 0,
> 1}]]
>
> Now I want to integrate f[x]^2:
>
> NIntegrate[f[x]^2, {x, 0, 1}]
>
> works fine. But this being an interpolating function, it seems to me
> that one could get a much faster and more accurate result by analytic
> integration. Unfortunately,
>
> Integrate[f[x]^2, {x, 0, 1}]
>
> does not compute.
>
> In principle one could extract the interpolation grid from f[x] and
> set up an analytic integration "by hand", using
> NumericalMath`ListIntegrate`, but this quickly becomes nasty,
> especially if you integrate products of different
> InterpolatingFunction objects like
>
> NIntegrate[f[x]*g[x], {x, 0, 1}]
>
> which are both results of NDSolve[] and thus may be using different
> grid points.
>
> Does anyone have any suggestions on how to do these integrals
> properly? Or how to coax NIntegrate[] into realizing that it should
> use a grid which matches those of the various InterpolatingFunction
> objects in its argument?
>
> Cheers!
> Roman.
>
>
>
--
http://chris.chiasson.name/
Prev by Date:
**Re: Transformation rules - explain please**
Next by Date:
**Re: Integrate**
Previous by thread:
**analytic integration of InterpolatingFunction compositions**
Next by thread:
**Re: analytic integration of InterpolatingFunction compositions**
| |