Package ca.cgjennings.math
Class Interpolation.QuadraticRegression
- java.lang.Object
-
- ca.cgjennings.math.Interpolation.InterpolatedFunction
-
- ca.cgjennings.math.Interpolation.QuadraticRegression
-
- All Implemented Interfaces:
Fn,UnivariatePolynomial
- Enclosing class:
- Interpolation
public static class Interpolation.QuadraticRegression extends Interpolation.InterpolatedFunction implements UnivariatePolynomial
A QuadraticRegression function finds the quadratic curve of best fit for a set of (usually noisy) data points.
-
-
Constructor Summary
Constructors Constructor Description QuadraticRegression(double[] x, double[] y)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublef(double x)Returns the y-value of the interpolation function given an x-value.doublegetCoefficient(int n)Returns the nth coefficient for this polynomial.intgetNumCoefficients()Returns the number of coefficients for this polynomial.-
Methods inherited from class ca.cgjennings.math.Interpolation.InterpolatedFunction
checkPoints
-
-
-
-
Method Detail
-
f
public double f(double x)
Description copied from class:Interpolation.InterpolatedFunctionReturns the y-value of the interpolation function given an x-value.- Specified by:
fin interfaceFn- Specified by:
fin classInterpolation.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:UnivariatePolynomialReturns 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:
getNumCoefficientsin interfaceUnivariatePolynomial
-
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:
getCoefficientin interfaceUnivariatePolynomial
-
-