MathGroup Archive 2001

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

Search the Archive

Odd behavior of InterpolationFunction derivative

  • To: mathgroup at
  • Subject: [mg29368] Odd behavior of InterpolationFunction derivative
  • From: Tomas Garza <tgarza01 at>
  • Date: Fri, 15 Jun 2001 02:23:38 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

"Interpolation[data] constructs an InterpolatingFunction object which 
represents an approximate function that interpolates the data. The data 
can have the forms {{x1, f1},{x2, f2},...} or {f1, f2,...}, where in the 
second case, the xi are taken to have values 1, 2, ..." (on-line Help 
Browser). The following example shows that while in both cases the 
InterpolationFunction works properly, the first derivatives appear to be 
different. Take, for example, Sin[x] in the range (-Pi/2, Pi/2), and 
construct a list of 11 values thereof in order to obtain an 
interpolation function.

points = Table[x, {x, -Pi/2, Pi/2, Pi/10}];
vals = Table[Sin[x], {x, -Pi/2, Pi/2, Pi/10}];

functionOne = Interpolation[Transpose[{points, vals}]];
functionTwo = Interpolation[vals];

Plot[{functionOne[x], (functionOne[#] &)'[x]}, {x, -Pi/2, Pi/2}];

Plot[{functionTwo[x], (functionTwo[#] &)'[x]}, {x, 1, 11}];

In both plots the graph of the approximation of Sin[x] appears 
correctly. However, in the second plot the graph of the interpolated 
derivative, Cos[x], is clearly wrong.

What is going on? Is this a bug (aka "feature")?

Tomas Garza
Mexico City

  • Prev by Date: Re: Saved Interpolating Functions Don't Work When Called ???
  • Next by Date: Re: Truth in inequalities
  • Previous by thread: Re: Can Mathematica evaluate step by step???
  • Next by thread: Re: Odd behavior of InterpolationFunction derivative