Class CubicSplineInterpolation1D

java.lang.Object
smile.interpolation.AbstractInterpolation
smile.interpolation.CubicSplineInterpolation1D
All Implemented Interfaces:
Serializable, Interpolation

public class CubicSplineInterpolation1D extends AbstractInterpolation
Cubic spline interpolation. Spline interpolation uses low-degree polynomials in each of the intervals, and chooses the polynomial pieces such that they fit smoothly together. The resulting function is called a spline.

The natural cubic spline is piecewise cubic and twice continuously differentiable. Furthermore, its second derivative is zero at the end points.

Like polynomial interpolation, spline interpolation incurs a smaller error than linear interpolation and the interpolant is smoother. However, the interpolant is easier to evaluate than the high-degree polynomials used in polynomial interpolation. It also does not suffer from Runge's phenomenon.

See Also:
  • Constructor Details

    • CubicSplineInterpolation1D

      public CubicSplineInterpolation1D(double[] x, double[] y)
      Constructor.
      Parameters:
      x - the tabulated points.
      y - the function values at x.
  • Method Details

    • rawinterp

      public double rawinterp(int j, double x)
      Description copied from class: AbstractInterpolation
      Subclasses provide this as the actual interpolation method.
      Specified by:
      rawinterp in class AbstractInterpolation
      Parameters:
      j - the value jlo is such that x is (insofar as possible) centered in the subrange xx[j..j+m-1], where xx is the stored data.
      x - interpolate at this value
      Returns:
      the raw interpolated value.
    • toString

      public String toString()
      Overrides:
      toString in class Object