CubicSpline Class

Represents a cubic spline curve.

Definition

Namespace: Numerics.NET.Curves
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.4
C#
public class CubicSpline : PiecewiseCurve
Inheritance
Object  →  Curve  →  PiecewiseCurve  →  CubicSpline

Remarks

Use the CubicSpline class to interpolate tabulated data, or to approximate a function defined in terms of tabulated data.

A cubic spline is a piecewise curve defined by a third degree polynomial on each interval.

Splines are defined by the data points and some additional conditions. Depending on the nature of these conditions, different types of spline curves arise. There are four kinds of splines. These types are enumerated by the CubicSplineKind type.

A natural spline is a spline curve whose second derivative at the end points are zero. This type of spline tends to minimize the overall curvature of the spline. There is only one natural spline for a given set of data points.

A clamped spline is a spline curve whose slope is fixed at both end points. There is a clamped spline curve for each pair of slopes. Therefore, two parameters must be defined in addition to the data points to specify a clamped spline completely.

Clamped and natural splines have continuous second derivatives.

A cubic Hermite spline is a spline curve whose slope is fixed at each data point. These slopes must be provided by the user. As a result of these additional conditions, the second derivative is no longer continuous.

An Akima spline is a variation of a spline that is robust against outliers. The polynomial on each interval is defined using only a limited number of points. This means that, unlike natural and clamped splines, the effect of an anomalous data point doesn't propagate throughout the curve. Akima splines require only the data points. No other information is needed.

A smoothing spline is a variation of a natural spline that reduces the curvature of the curve at the expense of no longer interpolating the data points.

Constructors

CubicSpline(IList<Point>) Constructs the natural cubic spline through a set of points.
CubicSpline(Double[], Double[]) Constructs the natural cubic spline through a set of points.
Obsolete.
CubicSpline(IList<Point>, CubicSplineKind) Constructs the natural cubic spline through a set of points.
CubicSpline(IList<Point>, IList<Double>) Constructs the cubic Hermite spline through a set of points.
CubicSpline(IList<Double>, IList<Double>) Constructs the natural cubic spline through a set of points.
CubicSpline(ReadOnlySpan<Double>, ReadOnlySpan<Double>) Constructs the natural cubic spline through a set of points.
CubicSpline(Double[], Double[], CubicSplineKind) Constructs a natural or Akima cubic spline through a set of points.
CubicSpline(Double[], Double[], Double[]) Constructs the cubic Hermite spline through a set of points.
Obsolete.
CubicSpline(IList<Point>, Double, IList<Double>) Constructs a cubic smoothing spline with the specified smoothing parameter.
CubicSpline(IList<Point>, Double, Double) Constructs a clamped cubic spline through a set of points.
CubicSpline(IList<Double>, IList<Double>, CubicSplineKind) Constructs the natural cubic spline through a set of points.
CubicSpline(IList<Double>, IList<Double>, IList<Double>) Constructs the cubic Hermite spline through a set of points.
CubicSpline(ReadOnlySpan<Double>, ReadOnlySpan<Double>, ReadOnlySpan<Double>) Constructs the cubic Hermite spline through a set of points.
CubicSpline(Double[], Double[], Double, Double) Constructs a clamped cubic spline through a set of points.
CubicSpline(IList<Double>, IList<Double>, Double, IList<Double>) Constructs a cubic smoothing spline with the specified smoothing parameter.
CubicSpline(IList<Double>, IList<Double>, Double, Double) Constructs a clamped cubic spline through a set of points.

Properties

Kind Gets the type of the cubic spline.
NumberOfIntervals Gets the number of intervals that make up this PiecewiseCurve.
(Inherited from PiecewiseCurve)
Parameters Gets the collection of parameters that determine the shape of this Curve.
(Inherited from Curve)

Methods

Clone Constructs an exact copy of this instance.
(Inherited from Curve)
CreateAkima(IList<Point>) Constructs the natural cubic spline through a set of points.
CreateAkima(IList<Double>, IList<Double>) Constructs the cubic Akima spline through a set of points.
CreateClamped(IList<Point>, Double, Double) Constructs a clamped cubic spline through a set of points.
CreateClamped(IList<Double>, IList<Double>, Double, Double) Constructs a clamped cubic spline through a set of points.
CreateHermiteInterpolant(IList<Point>, IList<Double>) Constructs the cubic Hermite spline through a set of points.
CreateHermiteInterpolant(IList<Double>, IList<Double>, IList<Double>) Constructs the cubic Hermite spline through a set of points.
CreateMonotonic(IList<Point>) Constructs a cubic spline through a set of points that preserves monotonicity.
CreateMonotonic(IList<Double>, IList<Double>) Constructs a cubic spline through a set of points that preserves monotonicity.
CreateNatural(IList<Point>) Constructs the natural cubic spline through a set of points.
CreateNatural(IList<Double>, IList<Double>) Constructs the natural cubic spline through a set of points.
CreateNotAKnot(IList<Point>) Constructs a cubic spline through a set of points with not-a-knot boundary conditions.
CreateNotAKnot(IList<Double>, IList<Double>) Constructs a cubic spline through a set of points with not-a-knot boundary conditions.
CreateSmooth(IList<Point>, Double) Constructs a smoothing spline for a set of points with specified smoothing parameter.
CreateSmooth(IList<Point>, Double, IList<Double>) Constructs a smoothing spline for a set of points with specified smoothing parameter and weights for the data points.
CreateSmooth(IList<Double>, IList<Double>, Double) Constructs a smoothing spline for a set of points with specified smoothing parameter.
CreateSmooth(IList<Double>, IList<Double>, Double, IList<Double>) Constructs a smoothing spline for a set of points with specified smoothing parameter and weights for the data points.
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
FindRoots Gets the set of X-coordinates where the curve crosses the X-axis.
(Overrides Curve.FindRoots())
GetCurveFitter Returns a CurveFitter object that can be used to fit the curve to data.
(Inherited from Curve)
GetDataPoint Gets the data point with the specified index.
(Inherited from PiecewiseCurve)
GetDerivative Returns a Curve that represents the derivative of this Curve.
(Inherited from Curve)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetIntervalPolynomial(Double) Returns a polynomial that represents the cubic spline at the specified point.
GetIntervalPolynomial(Int32, Boolean) Returns a polynomial that represents the cubic spline on the specified interval.
GetTypeGets the Type of the current instance.
(Inherited from Object)
GetXValue Returns the X value of the data point with the specified index.
(Inherited from PiecewiseCurve)
GetXValuesSpan Returns a span containing the X-values of the data points.
(Inherited from PiecewiseCurve)
GetYValue Returns the Y value of the data point with the specified index.
(Inherited from PiecewiseCurve)
GetYValuesSpan Returns a span containing the Y-values of the data points.
(Inherited from PiecewiseCurve)
IndexOf Finds the index of the lower bound of the interval that contains the specfied value.
(Inherited from PiecewiseCurve)
Integral Gets the definite integral of the curve between the specified X-coordinates.
(Overrides PiecewiseCurve.Integral(Double, Double))
IntegrateOnInterval(Int32) Returns the value of the integral over the interval with the specified index.
(Overrides PiecewiseCurve.IntegrateOnInterval(Int32))
IntegrateOnInterval(Int32, Double, Double) Returns the integral of the curve over a single interval.
(Overrides PiecewiseCurve.IntegrateOnInterval(Int32, Double, Double))
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
OnParameterChanged Called after a curve parameter has changed.
(Overrides Curve.OnParameterChanged(Int32, Double))
OnParameterChanging Called before the value of a curve parameter is changed.
(Inherited from PiecewiseCurve)
SetDataPoint Sets the X value of the data point with the specified index.
(Inherited from PiecewiseCurve)
SetDataPoints Sets the data points at the specified indexes.
(Inherited from PiecewiseCurve)
SetParameter Sets a curve parameter to the specified value.
(Inherited from Curve)
SetXValue Sets the X value of the data point with the specified index.
(Inherited from PiecewiseCurve)
SetXValues Sets the X values at the specified indexes.
(Inherited from PiecewiseCurve)
SetYValue Sets the Y value of the data point with the specified index.
(Inherited from PiecewiseCurve)
SetYValues Sets the Y values at the specified indexes.
(Inherited from PiecewiseCurve)
SlopeAt Gets the slope of the curve at the specified X-coordinate.
(Overrides Curve.SlopeAt(Double))
Solve Finds the x value where the curve reaches the specified y value.
(Inherited from Curve)
TangentAt Gets the tangent line to the curve at the specified X-coordinate.
(Inherited from Curve)
ToStringReturns a string that represents the current object.
(Inherited from Object)
ValueAt Gets the Y-value of the curve at the specified X-coordinate.
(Overrides Curve.ValueAt(Double))

See Also