Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Using InterpolatingFunction from NDSolve

  • To: mathgroup at
  • Subject: [mg58573] Re: Using InterpolatingFunction from NDSolve
  • From: dh <dh at>
  • Date: Fri, 8 Jul 2005 00:46:03 -0400 (EDT)
  • References: <daitir$su4$>
  • Sender: owner-wri-mathgroup at

Hi Tamás,
It seems that "InterpolatingFunction" is not very well integrated in the 
"Integrate" function. Integrate can not even handle very simple 
functions of "InterpolatingFunction". Example:

We define an interpolating function (1 dimensionla for simplicity):
f = Interpolation[{{0, 0}, {1, 1}, {2, 2}, {3, 3}}]
The following works
It also work if f is put inside a Plus function:
Integrate[ Plus[f[x],f[x]] ,{x,0,3}]]
however,if we change the Plus function to Times function, Integrate can 
no more do it:
Integrate[ Times[f[x],f[x]] ,{x,0,3}]]

Now what can we do? A work around is to re-interpolate: e.g.
to get the f^2 we coud write:
ff= FunctionInterpolation[f[x]^2, {x, 0, 3}]
This function will then integrate:

for your case where you use replacement: u[t, x]^2 /. nds[[1]], note 
that "FunctionInterpolation" has the Attribute "HoldAll". Therefore, 
either you replace outside "FunctionInterpolation" or you wrap the 
replacement inside "Evaluate".

Tamás wrote:
> I solved a PDE with NDSolve in Mathematica 5.1. I could plot,
> differentiate and integrate the obtained InterpolatingFunction object,
> the result being a similar object. I was able to integrate the 2nd
> derivative of it. What I need is to integrate the square of the
> obtained InterpolatingFunction object (the square itself does not
> simplify to such an object).
> You can see the details on my homepage:
> Every suggestions are welcome!
> Thank you,
> Tamás

  • Prev by Date: Re: Using InterpolatingFunction from NDSolve
  • Next by Date: Re: Set of strings reducing problem
  • Previous by thread: Re: Using InterpolatingFunction from NDSolve
  • Next by thread: superscripts