MathGroup Archive 1996

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

Search the Archive

Re: BUG or FEATURE in Interpolation[] ?

  • To: mathgroup at
  • Subject: [mg4641] Re: BUG or FEATURE in Interpolation[] ?
  • From: jsobel at (Jarl R Sobel)
  • Date: Thu, 22 Aug 1996 03:54:58 -0400
  • Organization: ABB Industrial Systems
  • Sender: owner-wri-mathgroup at

In article <4upfkc$48n at>, Stefan Schulz
<sschulz at> wrote:

> Dear Mathematica users,
> when I typed in the following lines:
> xdata =3D {-1., -0.5, 0., 1., 3., 6., 9.};
> ydata =3D Map[(Exp[-#]-1)^2&, xdata];
> data  =3D Inner[List,xdata,ydata,List];
> int   =3D Interpolation[data];
> Plot[int[x], {x,-1,9}]
> I found to my surprise, that the function returned by Interpolation=20
> 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=20
> pure function, but is naturally slower than the built-in Interpolation=20
> 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=20
> smooth curves. I would appreciate your comments an this. Many Thanks
> in advance.
I quote the Mathematica Reference Guide describing the function Interpola=

Data can be given in the form {{xi, {fi, dfi, ddfi, =8A }}, =8A } to spec=
derivatives as well as values of the function at the points xi. You can
specify different numbers of derivatives at different points.=20

Using this feature to specify the first derivatives of the function, give=
what you want:

xdata =3D {-1., -0.5, 0., 1., 3., 6., 9.};

data1 =3D Transpose[{xdata,=20
    Transpose[{(Exp[-xdata] - 1)^2,=20
      Derivative[1][(Exp[-#1] - 1)^2 & ][xdata]}

int1   =3D Interpolation[data1];

Plot[{(Exp[-x] - 1)^2,int1[x]}, {x,-1,9}]




  • Prev by Date: fitting differential eq. to data
  • Next by Date: Graphics Output (publication quality) from Mathematica?
  • Previous by thread: BUG or FEATURE in Interpolation[] ?
  • Next by thread: Re: BUG or FEATURE in Interpolation[] ?