Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.math3.fitting
Class PolynomialFitter

    java.lang.Object
      org.apache.commons.math3.fitting.CurveFitter<PolynomialFunction.Parametric>
          org.apache.commons.math3.fitting.PolynomialFitter

    public class PolynomialFitter

extends CurveFitter<PolynomialFunction.Parametric>

Polynomial fitting is a very simple case of `curve fitting`. The estimated coefficients are the polynomial coefficients (see the `fit` method).

Since:
  2.0
Version:
  $Id: PolynomialFitter.java 1416643 2012-12-03 19:37:14Z tn $

Constructor Summary
`PolynomialFitter(MultivariateVectorOptimizer optimizer)` Simple constructor.

Method Summary
`double[]` | `fit(double[] guess)` Get the coefficients of the polynomial fitting the weighted data points.
`double[]` | `fit(int maxEval, double[] guess)` Get the coefficients of the polynomial fitting the weighted data points.

Methods inherited from class org.apache.commons.math3.fitting.CurveFitter
`addObservedPoint, addObservedPoint, addObservedPoint, clearObservations, fit, fit, getObservations`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PolynomialFitter

    public PolynomialFitter(MultivariateVectorOptimizer optimizer)

  Simple constructor.

  Parameters:
    `optimizer` - Optimizer to use for the fitting.

Method Detail

### fit

    public double[] fit(int maxEval,
                        double[] guess)

  Get the coefficients of the polynomial fitting the weighted data points. The degree of the fitting polynomial is `guess.length - 1`.

  Parameters:
    `guess` - First guess for the coefficients. They must be sorted in increasing order of the polynomial's degree.
    `maxEval` - Maximum number of evaluations of the polynomial.
  Returns:
    the coefficients of the polynomial that best fits the observed points.
  Throws:
    `TooManyEvaluationsException` - if the number of evaluations exceeds `maxEval`.
    `ConvergenceException` - if the algorithm failed to converge.

### fit

    public double[] fit(double[] guess)

  Get the coefficients of the polynomial fitting the weighted data points. The degree of the fitting polynomial is `guess.length - 1`.

  Parameters:
    `guess` - First guess for the coefficients. They must be sorted in increasing order of the polynomial's degree.
  Returns:
    the coefficients of the polynomial that best fits the observed points.
  Throws:
    `ConvergenceException` - if the algorithm failed to converge.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.