|
SSJ V. 2.2. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectumontreal.iro.lecuyer.functions.Polynomial
umontreal.iro.lecuyer.functionfit.LeastSquares
public class LeastSquares
Represents a polynomial obtained by the least squares method on a set of points. More specifically, let (x0, y0),…,(xn, yn) be a set of points and p(x) the constructed polynomial of degree m. The constructed polynomial minimizes the square error
| Constructor Summary | |
|---|---|
LeastSquares(double[] x,
double[] y,
int degree)
Constructs a new least squares polynomial with points (x[0], y[0]),..., (x[n], y[n]). |
|
| Method Summary | |
|---|---|
LeastSquares |
clone()
|
static double[] |
getCoefficients(double[] x,
double[] y,
int degree)
Computes and returns the coefficients of the fitting polynomial of degree degree. |
double[] |
getX()
Returns the x coordinates of the fitted points. |
double[] |
getY()
Returns the y coordinates of the fitted points. |
String |
toString()
Calls toString
with the associated points. |
| Methods inherited from class umontreal.iro.lecuyer.functions.Polynomial |
|---|
derivative, derivative, derivativePolynomial, evaluate, getCoefficient, getCoefficients, getDegree, integral, integralPolynomial, setCoefficients |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public LeastSquares(double[] x,
double[] y,
int degree)
x - the x coordinates of the points.y - the y coordinates of the points.degree - the degree of the polynomial.
NullPointerException - if x or y are null.
IllegalArgumentException - if the lengths of x and y are different,
or if less than degree + 1 points are specified.| Method Detail |
|---|
public static double[] getCoefficients(double[] x,
double[] y,
int degree)
x - the x coordinates of the points.y - the y coordinates of the points.degree - the degree of the polynomial.
public double[] getX()
public double[] getY()
public String toString()
toString
with the associated points.
toString in class Polynomialpublic LeastSquares clone()
clone in class Polynomial
|
SSJ V. 2.2. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||