
Re: BUG or FEATURE in Interpolation[] ?
Posted:
Aug 16, 1996 3:07 AM


In article <4upfkc$48n@dragonfly.wolfram.com>, Stefan Schulz <sschulz@chemie.fuberlin.de> wrote:
> Dear Mathematica users, > > when I typed in the following lines: > > xdata = {1., 0.5, 0., 1., 3., 6., 9.}; > ydata = Map[(Exp[#]1)^2&, xdata]; > data = Inner[List,xdata,ydata,List]; > int = Interpolation[data]; > Plot[int[x], {x,1,9}] > > I found to my surprise, that the function returned by Interpolation > is not smooth at some of the data points! For this reason I resorted to > write a package Spline1D which returns a smooth cubic spline as a > pure function, but is naturally slower than the builtin Interpolation > command. Did I find a bug or is this a feature? If it is a feature > it certainly makes the Interpolation command not suitable to obtain > smooth curves. I would appreciate your comments an this. Many Thanks > in advance. > I quote the Mathematica Reference Guide describing the function Interpolation:
Data can be given in the form {{xi, {fi, dfi, ddfi, ÃÂ }}, ÃÂ } to specify derivatives as well as values of the function at the points xi. You can specify different numbers of derivatives at different points.
Using this feature to specify the first derivatives of the function, gives what you want:
xdata = {1., 0.5, 0., 1., 3., 6., 9.};
data1 = Transpose[{xdata, Transpose[{(Exp[xdata]  1)^2, Derivative[1][(Exp[#1]  1)^2 & ][xdata]} ]}];
int1 = Interpolation[data1];
Plot[{(Exp[x]  1)^2,int1[x]}, {x,1,9}]
Bye
Jarl

