Package org.hipparchus.fitting
Class PolynomialCurveFitter
java.lang.Object
org.hipparchus.fitting.AbstractCurveFitter
org.hipparchus.fitting.PolynomialCurveFitter
Fits points to a
The size of the
polynomial
function.
The size of the
initial guess
array defines the
degree of the polynomial to be fitted.
They must be sorted in increasing order of the polynomial's degree.
The optimal values of the coefficients will be returned in the same order.-
Nested Class Summary
Nested classes/interfaces inherited from class org.hipparchus.fitting.AbstractCurveFitter
AbstractCurveFitter.TheoreticalValuesFunction
-
Method Summary
Modifier and TypeMethodDescriptionstatic PolynomialCurveFitter
create
(int degree) Creates a default curve fitter.protected LeastSquaresProblem
getProblem
(Collection<WeightedObservedPoint> observations) Creates a least squares problem corresponding to the appropriate curve.withMaxIterations
(int newMaxIter) Configure the maximum number of iterations.withStartPoint
(double[] newStart) Configure the start point (initial guess).Methods inherited from class org.hipparchus.fitting.AbstractCurveFitter
fit, getOptimizer
-
Method Details
-
create
Creates a default curve fitter. Zero will be used as initial guess for the coefficients, and the maximum number of iterations of the optimization algorithm is set toInteger.MAX_VALUE
.- Parameters:
degree
- Degree of the polynomial to be fitted.- Returns:
- a curve fitter.
- See Also:
-
withStartPoint
Configure the start point (initial guess).- Parameters:
newStart
- new start point (initial guess)- Returns:
- a new instance.
-
withMaxIterations
Configure the maximum number of iterations.- Parameters:
newMaxIter
- maximum number of iterations- Returns:
- a new instance.
-
getProblem
Creates a least squares problem corresponding to the appropriate curve.- Specified by:
getProblem
in classAbstractCurveFitter
- Parameters:
observations
- Sample points.- Returns:
- the least squares problem to use for fitting the curve to the
given
points
.
-