public class PolynomialChebyshevFunction extends Object implements UnivariateFunction, ParametricUnivariateFunction, PolynomialFunctionInterface
The following methods and algorithms are based on the article [NUMERICAL RECIPES], §5.8 (Chebyshev Approximation) & §5.9 (Derivatives or Integrals of a Chebyshev).
Important notice: two conventions exist for defining Chebyshev polynomials:
| Constructor and Description |
|---|
PolynomialChebyshevFunction(double start,
double end,
double[] c)
Construct a Chebyshev polynomial with the given coefficients.
|
| Modifier and Type | Method and Description |
|---|---|
PolynomialChebyshevFunction |
add(PolynomialChebyshevFunction p)
Add a Chebyshev polynomial to the instance.
|
PolynomialChebyshevFunction |
derivative()
Return a new
PolynomialChebyshevFunction object that approximates the derivative of
the existing function
over the same range [start; end]. |
boolean |
equals(Object obj) |
protected static double |
evaluate(double start,
double end,
double[] coefficients,
double argument)
The Chebyshev polynomial is evaluated at a point and the
result is returned as the function value.
|
double[] |
getChebyshevAbscissas(int n)
Compute the N Chebyshev abscissas on the range [start ; end] in a chronological (increasing)
order..
|
double[] |
getCoefficients()
Returns a copy of the coefficients array.
|
int |
getDegree()
Returns the degree of the Chebyshev polynomial.
|
double |
getEnd()
Getter for the end range.
|
PolynomialType |
getPolynomialType()
Return the type of this polynomial function.
|
double |
getStart()
Getter for the start range.
|
double[] |
gradient(double x,
double... parameters)
Compute the gradient of the function with respect to its parameters.
|
int |
hashCode() |
PolynomialChebyshevFunction |
negate()
Negate the instance coefficients.
|
PolynomialChebyshevFunction |
primitive(double x0,
double y0)
Returns the primitive of the Chebyshev polynomial.
|
PolynomialChebyshevFunction |
subtract(PolynomialChebyshevFunction p)
Subtract a Chebyshev polynomial from the instance.
|
String |
toString()
Returns a string representation of the Chebyshev polynomial.
|
UnivariateFunction |
univariateDerivative()
Return a new Chebyshev polynomial object as a
UnivariateFunction that approximates
the derivative of the
existing function over the same range [start; end]. |
double |
value(double x)
Compute the value of the function for the given argument.
|
double |
value(double x,
double... parameters)
Compute the value of the function.
|
public PolynomialChebyshevFunction(double start,
double end,
double[] c)
The constructor makes a copy of the input array and assigns the copy to the coefficients property.
The Chebyshev polynomial is an approximation defined on the range [start ; end].
start - Start rangeend - End rangec - Chebyshev polynomial coefficientsNullArgumentException - if c is nullNoDataException - if c is emptyMathIllegalArgumentException - if start >= endpublic double getStart()
public double getEnd()
public int getDegree()
getDegree in interface PolynomialFunctionInterfacepublic double[] getCoefficients()
Changes made to the returned copy will not affect the coefficients of the Chebyshev polynomial.
getCoefficients in interface PolynomialFunctionInterfacepublic double[] getChebyshevAbscissas(int n)
n - Number of points to evaluateNotStrictlyPositiveException - if n <= 0MathIllegalArgumentException - if start >= endpublic double value(double x)
The value returned is
coefficients[0] + coefficients[1] * T1 + ... + coefficients[n] * Tn
Note: the argument must be in the Chebyshev polynomial range [start; end].
value in interface UnivariateFunctionx - Argument for which the function value should be computedIllegalArgumentException - if the argument isn't in the Chebyshev polynomial rangeUnivariateFunction.value(double)protected static double evaluate(double start,
double end,
double[] coefficients,
double argument)
start - Start rangeend - End rangecoefficients - Coefficients of the polynomial to evaluate.argument - Input valueNoDataException - if coefficients is emptyNullArgumentException - if coefficients is nullMathIllegalArgumentException - if start >= endIllegalArgumentException - if the argument isn't in the Chebyshev polynomial rangepublic PolynomialChebyshevFunction add(PolynomialChebyshevFunction p)
Note: the Chebyshev polynomial to add must be defined on the same range as the instance.
p - Chebyshev polynomial to addpIllegalArgumentException - if the given Chebyshev polynomial hasn't the same range as
the instancepublic PolynomialChebyshevFunction subtract(PolynomialChebyshevFunction p)
Note: the Chebyshev polynomial to subtract must be defined on the same range as the instance.
p - Chebyshev polynomial to subtractpIllegalArgumentException - if the given Chebyshev polynomial hasn't the same range as
the instancepublic PolynomialChebyshevFunction negate()
public PolynomialChebyshevFunction derivative()
PolynomialChebyshevFunction object that approximates the derivative of
the existing function
over the same range [start; end].derivative in interface PolynomialFunctionInterfacepublic UnivariateFunction univariateDerivative()
UnivariateFunction that approximates
the derivative of the
existing function over the same range [start; end].public PolynomialChebyshevFunction primitive(double x0, double y0)
primitive in interface PolynomialFunctionInterfacex0 - the absicssa at which the polynomial value is knowny0 - the value of the polynomial at x0public double[] gradient(double x,
double... parameters)
gradient in interface ParametricUnivariateFunctionx - Point for which the function value should be computed.parameters - Function parameters.public double value(double x,
double... parameters)
value in interface ParametricUnivariateFunctionx - Point for which the function value should be computed.parameters - Function parameters.public String toString()
The representation is user oriented. Terms are displayed lowest degrees first. The
multiplications signs, coefficients equals to one and null terms are not displayed (except if
the polynomial is 0, in which case the 0 constant term is displayed). Addition of terms with
negative coefficients are replaced by subtraction of terms with positive coefficients except
for the first displayed term (i.e. we display -3 for a constant negative
polynomial, but 1 - 3 T1 + T2 if the negative coefficient is not the first one
displayed).
public PolynomialType getPolynomialType()
getPolynomialType in interface PolynomialFunctionInterfaceCopyright © 2024 CNES. All rights reserved.