|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math.analysis.PolynomialSplineFunction
public class PolynomialSplineFunction
Represents a polynomial spline function.
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])
Field Summary | |
---|---|
private double[] |
knots
Spline segment interval delimiters (knots). |
private int |
n
Number of spline segments = number of polynomials = number of partition points - 1 |
private PolynomialFunction[] |
polynomials
The polynomial functions that make up the spline. |
private static long |
serialVersionUID
Serializable version identifier |
Constructor Summary | |
---|---|
PolynomialSplineFunction(double[] knots,
PolynomialFunction[] polynomials)
Construct a polynomial spline function with the given segment delimiters and interpolating polynomials. |
Method Summary | |
---|---|
UnivariateRealFunction |
derivative()
Returns the derivative of the polynomial spline function as a UnivariateRealFunction |
double[] |
getKnots()
Returns an array copy of the knot points. |
int |
getN()
Returns the number of spline segments = the number of polynomials = the number of knot points - 1. |
PolynomialFunction[] |
getPolynomials()
Returns a copy of the interpolating polynomials array. |
private static boolean |
isStrictlyIncreasing(double[] x)
Determines if the given array is ordered in a strictly increasing fashion. |
PolynomialSplineFunction |
polynomialSplineDerivative()
Returns the derivative of the polynomial spline function as a PolynomialSplineFunction |
double |
value(double v)
Compute the value for the function. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
private double[] knots
private PolynomialFunction[] polynomials
(x - knot[i])
where i is the
knot segment to which x belongs.
private int n
Constructor Detail |
---|
public PolynomialSplineFunction(double[] knots, PolynomialFunction[] polynomials)
The constructor copies both arrays and assigns the copies to the knots and polynomials properties, respectively.
knots
- spline segment interval delimiterspolynomials
- polynomial functions that make up the spline
java.lang.NullPointerException
- if either of the input arrays is null
java.lang.IllegalArgumentException
- if knots has length less than 2,
polynomials.length != knots.length - 1
, or the knots array
is not strictly increasing.Method Detail |
---|
public double value(double v) throws ArgumentOutsideDomainException
Throws FunctionEvaluationException if v is outside of the domain of the function. The domain is [smallest knot, largest knot].
See PolynomialSplineFunction
for details on the algorithm for
computing the value of the function.
value
in interface UnivariateRealFunction
v
- the point for which the function value should be computed
ArgumentOutsideDomainException
- if v is outside of the domain of
of the spline function (less than the smallest knot point or greater
than the largest knot point)public UnivariateRealFunction derivative()
derivative
in interface DifferentiableUnivariateRealFunction
public PolynomialSplineFunction polynomialSplineDerivative()
public int getN()
public PolynomialFunction[] getPolynomials()
Returns a fresh copy of the array. Changes made to the copy will not affect the polynomials property.
public double[] getKnots()
Returns a fresh copy of the array. Changes made to the copy will not affect the knots property.
private static boolean isStrictlyIncreasing(double[] x)
x
- the array to examine.
true
if the elements in x
are ordered
in a stricly increasing manner. false
, otherwise.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |