[SciPy-user] splrep/splev versus interp1d

Travis E. Oliphant oliphant@enthought....
Wed May 21 11:23:21 CDT 2008

Johann Rohwer wrote:
> Hi,
> What is the difference (in terms of the underlying algorithms) between 
> splines generated by sp.interpolate.interp1d and sp.interpolate.splrep/splev?
The former does not use any "smoothing" while the latter does use 
"smoothing".     Interpolation using splines for order greater than 1 
actually requires additional constraints to be made as there are more 
degrees of freedom left after specifying continuity up to the (k-1)st 
derivative (for order k).

The splrep functions use a smoothing constraint which I find useless 
unless you are interpolating noisy "data" (you can set the smoothing 
constraint to 0 and then I'm not sure what additional constraint it is 
using to define a unique spline).

The interp1d function which uses low-level spline interpolation 
functions by default uses a constraint that enforces "minimial" 
discontinuity in the kth-derivative.  So, yes, they will return 
non-identical results and this is to be expected.

Interpolations for k>1 depends on the additional assumptions you add and 
there is a large number of possibilities.   I'd like to flesh this out a 
bit better so it is clear what additional constraints are available. 


More information about the SciPy-user mailing list