Documentation of 'umontreal.iro.lecuyer.functionfit.LeastSquares' Java class
LeastSquares
umontreal.iro.lecuyer.functionfit

Class LeastSquares

    • Constructor Detail

      • LeastSquares

        public LeastSquares(double[] x,
                            double[] y,
                            int degree)
        Constructs a new least squares polynomial with points (x[0], y[0]),..., (x[n], y[n]). The constructed polynomial has degree degree.
        Parameters:
        x - the x coordinates of the points.
        y - the y coordinates of the points.
        degree - the degree of the polynomial.
        Throws:
        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.
    • Method Detail

      • getCoefficients

        public static double[] getCoefficients(double[] x,
                                               double[] y,
                                               int degree)
        Computes and returns the coefficients of the fitting polynomial of degree degree. The coordinates of the given points are (x[i], y[i]).
        Parameters:
        x - the x coordinates of the points.
        y - the y coordinates of the points.
        degree - the degree of the polynomial.
        Returns:
        the coefficients of the fitting polynomial.
      • getX

        public double[] getX()
        Returns the x coordinates of the fitted points.
        Returns:
        the x coordinates of the fitted points.
      • getY

        public double[] getY()
        Returns the y coordinates of the fitted points.
        Returns:
        the y coordinates of the fitted points.
      • toString

        public java.lang.String toString()
        Calls toString with the associated points.
        Overrides:
        toString in class Polynomial
        Returns:
        a string containing the points.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.