MathGroup Archive 2011

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

Search the Archive

Suming InterpolatingFunction Objects

  • To: mathgroup at
  • Subject: [mg120233] Suming InterpolatingFunction Objects
  • From: Gabriel Landi <gtlandi at>
  • Date: Thu, 14 Jul 2011 05:22:34 -0400 (EDT)

Hello everyone.

I encountered the following problem, which I am not sure is a bug or simply
a annoying detail.
I will use as an example a piece of code from the mathematica tutorials.

Say I solve a system of ODEs

s = NDSolve[{x'[t] == -y[t] - x[t]^2, y'[t] == 2 x[t] - y[t]^3,
   x[0] == y[0] == 1}, {x, y}, {t, 20}]

My quantity of interest could be x[t] + y[t]. I can plot it:

Plot[x[t] + y[t] /. s, {t, 0, 20}]

But say I wish to store it as a single object.
So I do (this is the kinky part):

sum = FunctionInterpolation[x[t] + y[t] /. s, {t, 0, 20}]

Now, when I plot the result, it comes out completely different. It looks
like something changed with the interpolation order or something.

Plot[sum[t], {t, 0, 20}]

What do you guys think?

Best regards,


  • Prev by Date: Re: Numerical accuracy/precision - this is a bug or a feature?
  • Next by Date: Overriding the definition of Plus so that it does exact arithmetic: Bug or Feature?
  • Previous by thread: Re: I think Omitting the multiplication sign is a big mistake
  • Next by thread: Re: Suming InterpolatingFunction Objects