public class PolynomialSplineFunction extends Object implements UnivariateDifferentiableFunction, FieldUnivariateFunction
A polynomial spline function consists of a set of
interpolating polynomials and an ascending array of domain
knot points, determining the intervals over which the spline function
is defined by the constituent polynomials. The polynomials are assumed to
have been computed to match the values of another function at the knot
points. The value consistency constraints are not currently enforced by
PolynomialSplineFunction
itself, but are assumed to hold among
the polynomials and knot points passed to the constructor.
N.B.: The polynomials in the polynomials
property must be
centered on the knot points to compute the spline function values.
See below.
The domain of the polynomial spline function is
[smallest knot, largest knot]
. Attempts to evaluate the
function at values outside of this range generate IllegalArgumentExceptions.
The value of the polynomial spline function for an argument x
is computed as follows:
x
belongs. If x
is less than the smallest knot point or greater
than the largest one, an IllegalArgumentException
is thrown.j
be the index of the largest knot point that is less
than or equal to x
. The value returned is
polynomials[j](x - knot[j])
Constructor and Description |
---|
PolynomialSplineFunction(double[] knots,
PolynomialFunction[] polynomials)
Construct a polynomial spline function with the given segment delimiters
and interpolating polynomials.
|
Modifier and Type | Method and Description |
---|---|
double[] |
getKnots()
Get an array copy of the knot points.
|
int |
getN()
Get the number of spline segments.
|
PolynomialFunction[] |
getPolynomials()
Get a copy of the interpolating polynomials array.
|
boolean |
isValidPoint(double x)
Indicates whether a point is within the interpolation range.
|
PolynomialSplineFunction |
polynomialSplineDerivative()
Get the derivative of the polynomial spline function.
|
DerivativeStructure |
value(DerivativeStructure t)
Simple mathematical function.
|
double |
value(double v)
Compute the value for the function.
|
<T extends RealFieldElement<T>> |
value(T t)
Compute the value of the function.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
toRealFieldUnivariateFunction
public PolynomialSplineFunction(double[] knots, PolynomialFunction[] polynomials) throws MathIllegalArgumentException, NullArgumentException
knots
- Spline segment interval delimiters.polynomials
- Polynomial functions that make up the spline.NullArgumentException
- if either of the input arrays is null
.MathIllegalArgumentException
- if knots has length less than 2.MathIllegalArgumentException
- if polynomials.length != knots.length - 1
.MathIllegalArgumentException
- if the knots
array is not strictly increasing.public double value(double v)
PolynomialSplineFunction
for details on the algorithm for
computing the value of the function.value
in interface UnivariateFunction
v
- Point for which the function value should be computed.MathIllegalArgumentException
- if v
is outside of the domain of the
spline function (smaller than the smallest knot point or larger than the
largest knot point).public PolynomialSplineFunction polynomialSplineDerivative()
public DerivativeStructure value(DerivativeStructure t)
UnivariateDifferentiableFunction
classes compute both the
value and the first derivative of the function.
value
in interface UnivariateDifferentiableFunction
t
- function input valuepublic <T extends RealFieldElement<T>> T value(T t)
value
in interface FieldUnivariateFunction
T
- the type of the field elementst
- Point at which the function value should be computed.public int getN()
public PolynomialFunction[] getPolynomials()
public double[] getKnots()
public boolean isValidPoint(double x)
x
- Point.true
if x
is a valid point.Copyright © 2016–2020 Hipparchus.org. All rights reserved.