MathGroup Archive 2001

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

Search the Archive

Re: Odd behavior of InterpolationFunction derivative

  • To: mathgroup at smc.vnet.net
  • Subject: [mg29379] Re: [mg29368] Odd behavior of InterpolationFunction derivative
  • From: Maryvonne Teissier <my.teissier at cybercable.fr>
  • Date: Sat, 16 Jun 2001 02:47:51 -0400 (EDT)
  • References: <200106150623.CAA28862@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Tomas,

No bug ! Just Mathematics!

Please, try at beginning not use the variable x in both cases.

If you want derivative of your InterpolationFunction , you must thinck
at functionTwo as Sin[a*(w-c)] rather than Sin ...
When w goes from 1 to 11  you want that a*(w -c) goes from
-Pi/2 to Pi/2, so a = Pi/10 and c = 6 .  In your (good) example,
the derivative with respect to w is a*Cos[a*(w-c)]. not only Cos ...Try
the following and you will see back your strange derivative of functionTwo

functionMy[w_]:=N[Sin[(Pi/10)(w-6)]];

Plot[{functionMy[w],(functionMy[#] &)'[w]}, {w, 1., 11.}];

Sincerly,
Maryvonne Teissier,
University of Paris 7.


Tomas Garza a *crit :

> "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.
>
> In[1]:=
> points = Table[x, {x, -Pi/2, Pi/2, Pi/10}];
> vals = Table[Sin[x], {x, -Pi/2, Pi/2, Pi/10}];
>
> In[3]:=
> functionOne = Interpolation[Transpose[{points, vals}]];
> functionTwo = Interpolation[vals];
>
> In[5]:=
> Plot[{functionOne[x], (functionOne[#] &)'[x]}, {x, -Pi/2, Pi/2}];
>
> In[6]:=
> 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: Truth in inequalities
  • Next by Date: Re: Re: pattern matching quirks
  • Previous by thread: Odd behavior of InterpolationFunction derivative
  • Next by thread: Re: Re: Odd behavior of InterpolationFunctionderivative