Re: Re: Odd behavior ofInterpolationFunctionderivative
- To: mathgroup at smc.vnet.net
- Subject: [mg29430] Re: [mg29379] Re: [mg29368] Odd behavior ofInterpolationFunctionderivative
- From: Maryvonne Teissier <my.teissier at cybercable.fr>
- Date: Tue, 19 Jun 2001 05:35:44 -0400 (EDT)
- References: <200106150623.CAA28862@smc.vnet.net> <200106160647.CAA07738@smc.vnet.net> <000d01c0f734$99aebe60$9ab9eb94@dqb2301>
- Sender: owner-wri-mathgroup at wolfram.com
Ok, I try to give a better explanation. First you have to notice that you obtain the same plot for he Interpolation obtained for a given set of numbers {f1, f2,...,fn}, and for the Interpolation obtained giving also the abscissa values explicitly, i.e., {{x1, f1}, {x2, f2},..., {xn, fn}} ... ONLY IF THE ABSCISSA VALUES ARE REGULARLY SPACED (or the values fi constants) That was the case in your first formulation with the Sin, but not in the second one. Now, realize that for the following set of values (with regular space between abcisses) {{1 , f1} , {3 , f2)} , {5, f3} . {7, f4)} , {9 , f5} } the first way will give you some Interpolation x->F(x) and the second way will give you for {f1 , f2 , f3 , f4 , f5} the solution that the first way would give for {{1 , f1} , {2, f2)} , {3, f3} . {4, f4)} , {5, f5} } , which is x->F(2x-1). So, the derivative of the second one will be the double of the first one. Exactly the same that if you take twice the same drawing of a straigth Line , with same vertical unit vector, but with different horizontal unit vector , for example first one double of the second., the slope of the first "straigth line" will be half of the second "same straigth line" Is it more easy to understand, like that ? I manage to avoid the change the name of the local variable x. You are right to say that it is two different contexts. But if i want to compare what happens in the two contexts it is sometimes more easy to do the distinction, exactly like when you change variable in an integral. Maryvonne Teissier., University of Paris 7 Tomas Garza a *crit : > 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 > To: <mathgroup at smc.vnet.net> > Sent: Saturday, June 16, 2001 1:47 AM > Subject: [mg29430] [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