Class Interpolation.QuadraticRegression

    • Field Summary

      • Fields inherited from interface ca.cgjennings.math.Fn

        IDENTITY
    • Constructor Summary

      Constructors 
      Constructor Description
      QuadraticRegression​(double[] x, double[] y)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double f​(double x)
      Returns the y-value of the interpolation function given an x-value.
      double getCoefficient​(int n)
      Returns the nth coefficient for this polynomial.
      int getNumCoefficients()
      Returns the number of coefficients for this polynomial.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • QuadraticRegression

        public QuadraticRegression​(double[] x,
                                   double[] y)
    • Method Detail

      • f

        public double f​(double x)
        Description copied from class: Interpolation.InterpolatedFunction
        Returns the y-value of the interpolation function given an x-value.
        Specified by:
        f in interface Fn
        Specified by:
        f in class Interpolation.InterpolatedFunction
        Parameters:
        x - the value to evaluate the curve function at
        Returns:
        f(x), where f is a function for the interpolating curve
      • getNumCoefficients

        public int getNumCoefficients()
        Description copied from interface: UnivariatePolynomial
        Returns the number of coefficients for this polynomial. This is not the same as the degree, since the high coefficients may be zero; it simply indicates the highest currently possible coefficient in this implementation.
        Specified by:
        getNumCoefficients in interface UnivariatePolynomial
      • getCoefficient

        public double getCoefficient​(int n)
        Returns the nth coefficient for this polynomial. The formula for this interpolator's curve is:
        f(x) = getCoefficient(2) * x^2 * getCoefficient(1) * x + getCoefficient(0)
        Specified by:
        getCoefficient in interface UnivariatePolynomial