|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jidesoft.chart.fit.Polynomial
public class Polynomial
This class represents a polynomial of any number of terms (provided the powers of x are all positive integers).
So, for example an instance of this class can be used to represent an expression such as x - 5 or 3x2 + 4x + 2
Constructor Summary | |
---|---|
Polynomial(double... coefficients)
Create a polynomial using the supplied coefficients for successive powers of x starting from a constant. |
|
Polynomial(Double[] coefficients)
Create a polynomial using the supplied coefficients for successive powers of x starting from a constant. |
Method Summary | |
---|---|
boolean |
equals(Object obj)
|
double |
eval(double x)
Compute the value of the polynomial for a given x value. |
Double |
getCoefficient(int index)
Returns the coefficient of the polynomial with the given index. |
List<Double> |
getCoefficients()
Returns the coefficients of the polynomials, lowest term (i.e. |
int |
hashCode()
|
void |
setCoefficients(Double[] coefficients)
Specify the coefficients of the polynomial |
void |
setCoefficients(List<Double> coefficients)
Specify the coefficients of the polynomial |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Polynomial(Double[] coefficients)
coefficients
- the coefficients of the successive terms of the polynomialpublic Polynomial(double... coefficients)
new Polynomial(4, 2)
.
coefficients
- the coefficients of the successive terms of the polynomialMethod Detail |
---|
public List<Double> getCoefficients()
public Double getCoefficient(int index)
index
- the index of the coefficient; the constant term has zero index.
public void setCoefficients(List<Double> coefficients)
coefficients
- the coefficients, given as a List
of Double
spublic void setCoefficients(Double[] coefficients)
coefficients
- the coefficients, given as an array of Double
spublic double eval(double x)
x
- the x value to plug into the expression
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
public String toString()
toString
in class Object
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |