etomica.util.numerical

## Class PolynomialFit

• java.lang.Object
• etomica.util.numerical.PolynomialFit

• ```public class PolynomialFit
extends java.lang.Object```
Class that performs a polynomial fit to x,y data, optionally taking weights associated with each data point.
• ### Constructor Summary

Constructors
Constructor and Description
`PolynomialFit()`
• ### Method Summary

All Methods
Modifier and Type Method and Description
`static double[]` ```doFit(int order, double[] x, double[] y)```
Perform polynomial fit of the given order.
`static double[]` ```doFit(int order, double[] x, double[] y, double[] w)```
Perform polynomial fit of the given order with the given weights (w).
`static void` `main(java.lang.String[] args)`
• ### Methods inherited from class java.lang.Object

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

• #### PolynomialFit

`public PolynomialFit()`
• ### Method Detail

• #### doFit

```public static double[] doFit(int order,
double[] x,
double[] y)```
Perform polynomial fit of the given order. order=2 would fit y = a*x^2 + b*x + c The polynomial coefficients are returned as a double array in order of increasing power of x. So, double[] r = doFit(); r[i] is the coefficient for x^i
• #### doFit

```public static double[] doFit(int order,
double[] x,
double[] y,
double[] w)```
Perform polynomial fit of the given order with the given weights (w). order=2 would fit y = a*x^2 + b*x + c The polynomial coefficients are returned as a double array in order of increasing power of x. So, double[] r = doFit(); r[i] is the coefficient for x^i
• #### main

`public static void main(java.lang.String[] args)`