public class CubicSpline extends Object implements Interpolation
Various common end conditions are implemented: natural, clamped, and not-a-knot.
With the given end condition, this implementation also provides a default linear extrapolation at two ends whose slope matches the slope of the first or last splines. That means, the second derivative at both ends are zero.
Constructor and Description |
---|
CubicSpline()
Creates an instance with default end conditions which fits
natural splines, meaning that the second derivative at both ends
are zero.
|
Modifier and Type | Method and Description |
---|---|
static CubicSpline |
clamped()
Creates an instance with end conditions which fits clamped
splines, and the first derivative at both ends are zero.
|
static CubicSpline |
clamped(double df1,
double dfn)
Creates an instance with end conditions which fits clamped
splines, meaning that the first derivative at both ends equal to the
given values.
|
UnivariateRealFunction |
fit(OrderedPairs pairs)
Fit a real valued function from a discrete set of data points.
|
static CubicSpline |
natural()
Creates an instance with end conditions which fits natural
splines, meaning that the second derivative at both ends are zero.
|
static CubicSpline |
notAKnot()
Creates an instance with end conditions which fits not-a-knot
splines, meaning that continuity of the third derivative at the second
and the next-to-last knots are forced.
|
public CubicSpline()
public static CubicSpline natural()
public static CubicSpline clamped()
public static CubicSpline clamped(double df1, double dfn)
df1
- the first derivative at the first pointdfn
- the first derivative at the last pointpublic static CubicSpline notAKnot()
public UnivariateRealFunction fit(OrderedPairs pairs)
Interpolation
fit
in interface CurveFitting
fit
in interface Interpolation
pairs
- a discrete set of data pointsCopyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.