I have this data:

data = 
  {{0.2, 103}, {2, 13.9}, {20, 2.72}, {200, 0.8}, {2000, 0.401}, {20000, 0.433}}

Is there any way of finding value at $x=5$ using splines and not an interpolating polynomial?

  • 2
    $\begingroup$ Interpolation[data, Method -> "Spline", InterpolationOrder -> 3][5] $\endgroup$
    – MeMyselfI
    Dec 15, 2017 at 20:03
  • 3
    $\begingroup$ recommend InterpolationOrder -> 1 here. With that data the higher order interpolation oscillates pretty wildly. $\endgroup$
    – george2079
    Dec 15, 2017 at 20:31
  • 4
    $\begingroup$ Interpolation and SplineFit are not the same : Interpolation[...,Method-> "Spline"...] returns a piecewise polynomial function x->y. SplineFit returns a parametric function t->{x,y}. This last function can represent a curve that goes in every directions, like a circle for example (x get greater, then smaller etc...). For one x there may be several y. $\endgroup$
    – andre314
    Dec 15, 2017 at 20:47

1 Answer 1


I think I would rescale the domain (logarithmically) to get better spacing between nodes:

ifn = Evaluate[
      Transpose[{Log@data[[All, 1]], data[[All, 2]]}],
      Method -> "Spline"
    ] &;

LogLogPlot[{ifn[x]}, {x, 0.2, 20000}, 
 Epilog -> {Red, PointSize[Medium], Point@Log@data}, PlotRange -> All]

Mathematica graphics

(*  4.83159  *)
  • $\begingroup$ For me, it is still unclear if the OP wants piecewise interpolation or if he wants to interpolate the whole region with one function. Nowadays the questions are so vague and incomplete... +1 $\endgroup$
    – halirutan
    Dec 16, 2017 at 13:04
  • $\begingroup$ @halirutan Thanks. I assumed "spline" meant spline and the original Q said "not InterpolatingPolynomial". I took it that the OP possibly didn't know the spline option to Interpolation. But if the question is a real problem, then probably what is wanted is linear interpolation, suggested by george2079, or splines with tension, which I don't think is built in M. The inflection points in my answer suggest the interpolation is not very accurate much past the point at $x=2$. $\endgroup$
    – Michael E2
    Dec 16, 2017 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.