|
|||||||||
PREV CLASS NEXT CLASS | All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math.analysis.PolynomialFunction
public class 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 |
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 |
---|
equals, 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
java.lang.NullPointerException
- if c is null
java.lang.IllegalArgumentException
- if c is emptyMethod Detail |
---|
public double value(double x)
The value returned is
coefficients[n] * x^n + ... + coefficients[1] * x + coefficients[0]
value
in interface UnivariateRealFunction
x
- 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.
public PolynomialFunction polynomialDerivative()
public UnivariateRealFunction derivative()
derivative
in interface DifferentiableUnivariateRealFunction
|
|||||||||
PREV CLASS NEXT CLASS | All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |