public class LeastSquares extends Polynomial implements java.io.Serializable
| Constructor and Description |
|---|
LeastSquares(double[] x,
double[] y,
int degree)
Constructs a new least squares polynomial with points (x[0],
y[0]),..., (x[n], y[n]).
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
java.lang.String |
toString()
Calls
toString
with the associated points. |
derivative, derivative, derivativePolynomial, evaluate, getCoefficient, getCoefficients, getDegree, integral, integralPolynomial, setCoefficientspublic 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.java.lang.NullPointerException - if x or y are null.java.lang.IllegalArgumentException - if the lengths of x and y are different,
or if less than degree + 1 points are specified.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 java.lang.String toString()
toString
with the associated points.toString in class Polynomialpublic LeastSquares clone()
clone in class PolynomialTo submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.