Class LeastSquaresFit.Polynomial

All Implemented Interfaces:
DoubleUnaryOperator, RealValuedDomainOps, RealValuedFunctOps, RealValuedFunctVAOps, VADomainOps
Enclosing class:
LeastSquaresFit

public static class LeastSquaresFit.Polynomial extends LeastSquaresFit.Linear
Class to provide a linear least squares fit when the basis functions are the functions whose values are 1, x, x2, x3, etc. The parameters are the coefficients of the polynomial, with the 0th parameter being the coefficient for 1, the 1st parameter being the coefficient for x, etc.

The same behavior can be obtained by using the class LeastSquaresFit.FunctionBasis: this class is provided to (a) increase performance and (b) to provide a simpler constructor.

See Also:
  • Constructor Details

    • Polynomial

      public Polynomial(int n, double[] x, double[] y)
      Constructor. This constructor uses the data points to compute the standard deviation. As a result, the fit will always seem to be a good one when measured by the value of χ2.
      Parameters:
      n - the degree of the polynomial that will be used to fit the data
      x - the values of xi
      y - the values of yi
    • Polynomial

      public Polynomial(int n, double[] x, double[] y, double sigma)
      Constructor providing a standard deviation for Y values.
      Parameters:
      n - the degree of the polynomial that will be used to fit the data
      x - the values of xi
      y - the values of yi
      sigma - the standard deviation for every y value
    • Polynomial

      public Polynomial(int n, double[] x, double[] y, double[] sigma)
      Constructor given an error for each data point.
      Parameters:
      n - the degree of the polynomial that will be used to fit the data
      x - the values of xi
      y - the values of yi
      sigma - the values of σi
  • Method Details