| |
|
| java.lang.Object org.apache.commons.math.analysis.PolynomialFunction
Constructor Summary | |
public | PolynomialFunction(double c) Construct a polynomial with the given coefficients. |
Method Summary | |
public int | degree() | public UnivariateRealFunction | derivative() | protected static double[] | differentiate(double[] coefficients) Returns the coefficients of the derivative of the polynomial with the given coefficients. | protected static double | evaluate(double[] coefficients, double argument) Uses Horner's Method to evaluate the polynomial with the given coefficients at
the argument. | public double[] | getCoefficients() Returns a copy of the coefficients array. | public PolynomialFunction | polynomialDerivative() | public double | value(double x) Compute the value of the function for the given argument.
The value returned is
coefficients[n] * x^n + ... |
PolynomialFunction | public PolynomialFunction(double c)(Code) | | Construct a polynomial with the given coefficients. The first element
of the coefficients array is the constant term. Higher degree
coefficients follow in sequence. The degree of the resulting polynomial
is the length of the array minus 1.
The constructor makes a copy of the input array and assigns the copy to
the coefficients property.
Parameters: c - polynominal coefficients throws: NullPointerException - if c is null throws: IllegalArgumentException - if c is empty |
degree | public int degree()(Code) | | Returns the degree of the polynomial
the degree of the polynomial |
differentiate | protected static double[] differentiate(double[] coefficients)(Code) | | Returns the coefficients of the derivative of the polynomial with the given coefficients.
Parameters: coefficients - the coefficients of the polynomial to differentiate the coefficients of the derivative or null if coefficients has length 1. throws: IllegalArgumentException - if coefficients is empty throws: NullPointerException - if coefficients is null |
evaluate | protected static double evaluate(double[] coefficients, double argument)(Code) | | Uses Horner's Method to evaluate the polynomial with the given coefficients at
the argument.
Parameters: coefficients - the coefficients of the polynomial to evaluate Parameters: argument - the input value the value of the polynomial throws: IllegalArgumentException - if coefficients is empty throws: NullPointerException - if coefficients is null |
getCoefficients | public double[] getCoefficients()(Code) | | Returns a copy of the coefficients array.
Changes made to the returned copy will not affect the coefficients of
the polynomial.
a fresh copy of the coefficients array |
polynomialDerivative | public PolynomialFunction polynomialDerivative()(Code) | | Returns the derivative as a PolynomialRealFunction
the derivative polynomial |
value | public double value(double x)(Code) | | Compute the value of the function for the given argument.
The value returned is
coefficients[n] * x^n + ... + coefficients[1] * x + coefficients[0]
Parameters: x - the argument for which the function value should be computed the value of the polynomial at the given point See Also: UnivariateRealFunction.value(double) |
|
|
|