3

As far as I can tell, Interpolation uses cubic spline interpolation by default - please correct me if I'm wrong.

What does it use for extrapolation outside of the range of specified x-values?

With cubic spline interpolation, the second derivative at the end points is zero, and so extrapolating along a straight line seems natural. However, that's not what happens: Screenshot of <code>Plot[Interpolation[{{-2, 0}, {-1,-1 }, {1, 1}, {2, 0}}][x], {x, -3, 3}]</code>

feklee
  • 131
  • 3
  • You can find these informations in the documentation, esp. under "Details and Options". – Karsten7 Nov 21 '14 at 20:43
  • 1
    @Karsten7. What I found already before asking this question: "Interpolation supports a Method option. Possible settings include for spline interpolation and for Hermite interpolation." However, that tells nothing about extrapolation. And also it doesn't tell which interpolation method is the default. – feklee Nov 21 '14 at 20:47
  • 2
    Related: http://mathematica.stackexchange.com/questions/59944/extracting-the-function-from-interpolatingfunction-object - with f and pwf as in my answer, check out f[x] - pwf /. {{x -> -10}, {x -> 50}} and you will see that extrapolation coincides with the interpolating formulas at the ends of the domain (which is what I would expect). – Michael E2 Nov 21 '14 at 21:57
  • 4
    By the way, "With cubic spline interpolation, the second derivative at the end points is zero" is only true for what are known as "natural" cubic splines, which are not the only possible type of spline. In any case, Mathematica does not use spline interpolation by default, but even when you specify Method -> "Spline" it doesn't use natural splines. –  Nov 22 '14 at 06:58
  • @Rahul Thanks for pointing that out! I missed that when skimming the Wikipedia article on spline interpolation. – feklee Nov 22 '14 at 15:23

1 Answers1

3

The default method is Hermite:

data = {{-2, 0}, {-1, -1}, {1, 1}, {2, 0}};

Interpolation[data]["InterpolationMethod"];
(*  "Hermite"  *)

With spline interpolation the second derivative is piecewise linear, and is not necessarily zero at the endpoints:

Plot[Interpolation[data, Method -> "Spline"]''[x], {x, -3, 3}]

enter image description here

Simon Woods
  • 84,945
  • 8
  • 175
  • 324
  • Concerning spline interpolation: That's a different method than the one described on Wikipedia? Because there, the second derivative at the end points is zero: "The spline turns into a straight line here (y'' = 0)" – feklee Nov 21 '14 at 21:02
  • While I appreciate the correction concerning default interpolation method, your answer does not explain what extrapolation method is used. – feklee Nov 21 '14 at 21:16