Class CsInterpolate
- All Implemented Interfaces:
Serializable,Cloneable
CsInterpolate computes a \(C^2\) cubic spline
interpolant to a set of data points \((x_i, f_i)\) for
\(i = 0, \ldots, n-1\). The breakpoints of the spline are the
abscissas. Endpoint conditions can be automatically determined by the program,
or explicitly specified by using the appropriate constructor. Constructors are
provided that allow setting specific values for first or second derivative values
at the endpoints, or for specifying conditions that correspond to the "not-a-knot"
condition (see de Boor 1978).
The "not-a-knot" conditions require that the third derivative of the spline be continuous at the second and next-to-last breakpoint. If n is 2 or 3, then the linear or quadratic interpolating polynomial is computed, respectively.
If the data points arise from the values of a smooth, say, \(C^4\) function f, i.e. \(f_i = f(x_i)\), then the error will behave in a predictable fashion. Let \(\xi\) be the breakpoint vector for the above spline interpolant. Then, the maximum absolute error satisfies
$$ |f-s|_{[\xi_0,\xi_n]} \le C \left\|f^{(4)}\right\|_{[{\xi_0 ,\xi_n }]} |\xi|^4 $$where
$$|\xi|\;: = \max_{i=0,\ldots,n-1} \left|\xi_{i+1} - \xi_i \right|$$For more details, see de Boor (1978, pages 55-56).
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intFields inherited from class com.imsl.math.Spline
breakPoint, coef, EPSILON_LARGE -
Constructor Summary
ConstructorsConstructorDescriptionCsInterpolate(double[] xData, double[] yData) Constructs a cubic spline that interpolates the given data points.CsInterpolate(double[] xData, double[] yData, int typeLeft, double valueLeft, int typeRight, double valueRight) Constructs a cubic spline that interpolates the given data points with specified derivative endpoint conditions. -
Method Summary
Methods inherited from class com.imsl.math.Spline
copyAndSortData, copyAndSortData, derivative, derivative, derivative, getBreakpoints, integral, value, value
-
Field Details
-
NOT_A_KNOT
public static final int NOT_A_KNOT- See Also:
-
FIRST_DERIVATIVE
public static final int FIRST_DERIVATIVE- See Also:
-
SECOND_DERIVATIVE
public static final int SECOND_DERIVATIVE- See Also:
-
-
Constructor Details
-
CsInterpolate
public CsInterpolate(double[] xData, double[] yData) Constructs a cubic spline that interpolates the given data points. The interpolant satisfies the "not-a-knot" condition.- Parameters:
xData- Adoublearray containing the x-coordinates of the data. Values must be distinct.yData- Adoublearray containing the y-coordinates of the data. The arrays xData and yData must have the same length.
-
CsInterpolate
public CsInterpolate(double[] xData, double[] yData, int typeLeft, double valueLeft, int typeRight, double valueRight) Constructs a cubic spline that interpolates the given data points with specified derivative endpoint conditions.- Parameters:
xData- Adoublearray containing the x-coordinates of the data. Values must be distinct.yData- Adoublearray containing the y-coordinates of the data. The arrays xData and yData must have the same length.typeLeft- Anintdenoting the type of condition at the left endpoint. This can beNOT_A_KNOT,FIRST_DERIVATIVEorSECOND_DERIVATIVE.valueLeft- Adoublevalue at the left endpoint. IftypeLeftisNOT_A_KNOTthis is ignored, Otherwise, it is the value of the specified derivative.typeRight- Anintdenoting the type of condition at the right endpoint. This can beNOT_A_KNOT,FIRST_DERIVATIVEorSECOND_DERIVATIVE.valueRight- Adoublevalue at the right endpoint.
-