|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.commons.math.analysis.PolynomialFunction
Immutable representation of a real polynomial function with real coefficients.
Horner's Method is used to evaluate the function.
| Constructor Summary | |
PolynomialFunction(double[] c)
Construct a polynomial with the given coefficients. |
|
| Method Summary | |
int |
degree()
Returns the degree of the polynomial |
UnivariateRealFunction |
derivative()
Returns the derivative as a UnivariateRealFunction |
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. |
double[] |
getCoefficients()
Returns a copy of the coefficients array. |
PolynomialFunction |
polynomialDerivative()
Returns the derivative as a PolynomialRealFunction |
double |
value(double x)
Compute the value of the function for the given argument. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public PolynomialFunction(double[] c)
The constructor makes a copy of the input array and assigns the copy to the coefficients property.
c - polynominal coefficients
NullPointerException - if c is null
IllegalArgumentException - if c is empty| Method Detail |
public double value(double x)
The value returned is
coefficients[n] * x^n + ... + coefficients[1] * x + coefficients[0]
value in interface UnivariateRealFunctionx - the argument for which the function value should be computed
UnivariateRealFunction.value(double)public int degree()
public double[] getCoefficients()
Changes made to the returned copy will not affect the coefficients of the polynomial.
protected static double evaluate(double[] coefficients,
double argument)
coefficients - the coefficients of the polynomial to evaluateargument - the input value
IllegalArgumentException - if coefficients is empty
NullPointerException - if coefficients is nullprotected static double[] differentiate(double[] coefficients)
coefficients - the coefficients of the polynomial to differentiate
IllegalArgumentException - if coefficients is empty
NullPointerException - if coefficients is nullpublic PolynomialFunction polynomialDerivative()
public UnivariateRealFunction derivative()
derivative in interface DifferentiableUnivariateRealFunction
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||