public class SmoothingCubicSpline extends java.lang.Object implements MathFunction, MathFunctionWithFirstDerivative, MathFunctionWithDerivative, MathFunctionWithIntegral
The spline is computed with a smoothing parameter ρ∈[0, 1] which represents its accuracy with respect to the initial (xi, yi) nodes. The smoothing spline minimizes
| Constructor and Description |
|---|
SmoothingCubicSpline(double[] x,
double[] y,
double rho)
Constructs a spline with nodes at
(xi, yi),
with weights = 1 and smoothing factor ρ = rho.
|
SmoothingCubicSpline(double[] x,
double[] y,
double[] w,
double rho)
Constructs a spline with nodes at
(xi, yi),
with weights wi and smoothing factor ρ = rho.
|
| Modifier and Type | Method and Description |
|---|---|
double |
derivative(double z)
Evaluates and returns the value of the first derivative of
the spline at z.
|
double |
derivative(double z,
int n)
Evaluates and returns the value of the n-th derivative of
the spline at z.
|
double |
evaluate(double z)
Evaluates and returns the value of the spline at z.
|
int |
getFitPolynomialIndex(double x)
Returns the index of P, the
Polynomial instance used to evaluate
x, in an ArrayList table instance returned by
getSplinePolynomials(). |
double |
getRho()
Returns the smoothing factor used to construct the spline.
|
Polynomial[] |
getSplinePolynomials()
Returns a table containing all fitting polynomials.
|
double[] |
getWeights()
Returns the weights of the points.
|
double[] |
getX()
Returns the xi coordinates for this spline.
|
double[] |
getY()
Returns the yi coordinates for this spline.
|
double |
integral(double a,
double b)
Evaluates and returns the value of the integral of the
spline from a to b.
|
public SmoothingCubicSpline(double[] x,
double[] y,
double[] w,
double rho)
x - the xi coordinates.y - the yi coordinates.w - the weight for each point, must be > 0.rho - the smoothing parameterjava.lang.IllegalArgumentException - if x, y and
z do not have the same length, if rho has wrong value, or if
the spline cannot be calculated.public SmoothingCubicSpline(double[] x,
double[] y,
double rho)
x - the xi coordinates.y - the yi coordinates.rho - the smoothing parameterjava.lang.IllegalArgumentException - if x and y do
not have the same length, if rho has wrong value, or if the spline
cannot be calculated.public double evaluate(double z)
evaluate in interface MathFunctionz - argument of the spline.public double integral(double a,
double b)
integral in interface MathFunctionWithIntegrala - lower limit of integral.b - upper limit of integral.public double derivative(double z)
derivative in interface MathFunctionWithFirstDerivativez - argument of the spline.public double derivative(double z,
int n)
derivative in interface MathFunctionWithDerivativez - argument of the spline.n - order of the derivative.public double[] getX()
public double[] getY()
public double[] getWeights()
public double getRho()
public Polynomial[] getSplinePolynomials()
public int getFitPolynomialIndex(double x)
Polynomial instance used to evaluate
x, in an ArrayList table instance returned by
getSplinePolynomials(). This index k gives also the interval in
table X which contains the value x
(i.e. such that
xk < x <= xk+1).To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.