Re: Re: Odd behavior of InterpolationFunctionderivative
- To: mathgroup at smc.vnet.net
- Subject: [mg29411] Re: [mg29379] Re: [mg29368] Odd behavior of InterpolationFunctionderivative
- From: Tomas Garza <tgarza01 at prodigy.net.mx>
- Date: Mon, 18 Jun 2001 03:39:11 -0400 (EDT)
- References: <200106150623.CAA28862@smc.vnet.net> <200106160647.CAA07738@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hello Maryvonne, I'm afraid your explanation doesn't address the problem I was referring to. Essentially, what I'm saying is that a given set of numbers {f1, f2,...,fn} (forget that they were generated using the Sin function; they are just some numerical values) produces an InterpolationFunction which, in the case where Interpolation was called giving only those values has a derivative which is different from that where the Interpolation is called giving also the abscissa values explicitly, i.e., {{x1, f1}, {x2, f2},..., {xn, fn}}. The plot of the Interpolation Function is the same in both cases; however the plots of the corresponding derivatives - which should be equal, too - are different. Just look at the plot of what I called functionTwo: The slope of the InterpolationFunction is obviously very close to 1 when x = 6; however, the plot of its derivative has a maximum of about 0.314 (at x = 6). Nowhere in the graph the "derivative" reflects the value of the slope of the InterpolationFunction. Finally, I don't understand your remark: > Please, try at beginning not use the variable x in both cases. I don't see why you object to using the same symbol for the argument of a function in two different contexts (?). There is absolutely no way that this could induce any confusion whatsoever. Regards, Tomas ----- Original Message ----- From: "Maryvonne Teissier" <my.teissier at cybercable.fr> To: mathgroup at smc.vnet.net Subject: [mg29411] [mg29379] Re: [mg29368] Odd behavior of InterpolationFunctionderivative > 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 > >
- References:
- Odd behavior of InterpolationFunction derivative
- From: Tomas Garza <tgarza01@prodigy.net.mx>
- Re: Odd behavior of InterpolationFunction derivative
- From: Maryvonne Teissier <my.teissier@cybercable.fr>
- Odd behavior of InterpolationFunction derivative