InterpolatingFunction

*To*: mathgroup at yoda.physics.unc.edu*Subject*: InterpolatingFunction*From*: wsgbfs at info.win.tue.nl (Fred Simons)*Date*: Mon, 19 Oct 92 14:06:06 +0100

When playing around with the MATHEMATICA InterpolatingFunction I found some unexpected results, of which I hope somebody can explain it to me. First look at the following. test = { {0, 3}, {1,8}, {2, 2}, {3,4}, {4,2}, {5,3} } y = Interpolation[ test, InterpolationOrder -> 5 ] Plot[ y'[x], {x, 0, 5} ] results in a nice graph which took on my 80386-machine 355 sec to be produced. About sixty times faster is v = y' Plot[ v[x], {x, 0, 5} ] which results in the same graph in 5.7 seconds. I suppose that this big difference has something to do with the HoldAll attribute of the Plot- function. Plot[ Evaluate[ y'[x] ], {x, 0, 5} ] takes about 8 seconds. My second problem is that I would expect that y', being the derivative of an InterpolatingFunction, again would be an InterpolatingFunction, but that is not true. However, we can transform y' into an Interpolating- Function by v = Head[ y'[[1]] ] Why is this not done automatically by MATHEMATICA? The third problem is about the smoothness. Maybe part of my confusion is due to the fact that I really know nothing about spline functions. However, the following reasoning seems straightforward to me. Suppose that we want to find a polynomial of degree three passing through the points {x1, y1} and {x2, y2}. Since the polynomial has four coefficients, we cannot only prescribe the values y1 and y2 of the polynomial at x1 and x2, but also the values of the derivative at x1 and x2. Hence with the default setting of InterpolationOrder to 3, it should be possible to obtain differentiable InterpolatingFunctions, but MATHEMATICA seems not to do so. test = Join[ test, {{1/2, 3}, {7/2, 5}} ] y = Interpolation[ test ] z = y' u = Interpolation[ test, InterpolationOrder -> 5 ] v = u' Plot[ {y[x], z[x], u[x], v[x]}, {x, 0, 5}, PlotStyle -> Table[ Hue[ i 0.2], {i, 0, 4} ] ] Order 3 results in discontinuities in the derivative at 1, 2, 3 and 7/2, and order 5 still results in discontinuities at 2 and 3. Finally, is there someone who can explain the internal representation of an InterpolatingFunction other than that the data in the table have to do something with the polynomials used and its derivatives? Many thanks, Fred Simons Eindhoven University of Technology wsgbfs at win.tue.nl

**MMA 2.1 graphics and HP X-terminals: solved**

**Set inside Module**

**MMA 2.1 graphics and HP X-terminals: solved**

**Set inside Module**