public class Polynomial
extends java.lang.Object
Constructor and Description |
---|
Polynomial()
Creates a new instance of Polynomial
|
Polynomial(int n)
Creates a new instance of Polynomial
|
Modifier and Type | Method and Description |
---|---|
void |
addData(double x,
double y)
Adds a data point to the internal data
|
void |
addData(double x,
double y,
double y_err)
Adds a data point to the internal data
|
void |
clear()
Removes all internal data
|
java.lang.String |
equation()
Return the characteristic equation as a String
|
java.lang.String |
equation(java.lang.String format_pattern)
Return the characteristic equation as a String
|
boolean |
fit()
It performs one step of the data fit
|
boolean |
fitFromCenter()
It performs one step of the data fit by using centered data.
|
boolean |
fitParameter(int index)
Returns the boolean vaiable about including the coefficient into the
fitting
|
void |
fitParameter(int index,
boolean fitting)
Includes or excludes the parameter into fitting
|
double[] |
getCoefficients()
Returns the array with the coefficients of the Polynomial
|
double[] |
getCoefficientsErr()
Returns the array with the errors of the coefficients of the Polynomial
|
int |
getOrder()
Returns the order of the Polynomial object
|
double |
getParameter(int index)
Returns the parameter value
|
double |
getParameterError(int index)
Returns the parameter value error
|
double |
getValue(double x)
Returns the value of Polynomial function
|
double |
getValue(double x,
double[] a)
Returns the value of Polynomial function
|
static void |
main(java.lang.String[] args)
MAIN for debugging
|
void |
setData(double[] x_arr,
double[] y_arr)
Sets the data attribute of the Polynomial object
|
void |
setData(double[] x_arr,
double[] y_arr,
double[] y_err_arr)
Sets the data attribute of the Polynomial object
|
void |
setOrder(int n)
Sets the order of the Polynomial object
|
void |
setParameter(int index,
double val)
Sets the parameter value
|
public Polynomial()
public Polynomial(int n)
n
- The order of the Polynomial objectpublic double getParameter(int index)
index
- The coefficient for power "index" of the polynomialpublic double getParameterError(int index)
index
- The coefficient index for power equals to "index" in the
polynomialpublic void fitParameter(int index, boolean fitting)
index
- The coefficient index for power equals to "index" in the
polynomialfitting
- The boolean vaiable about including the coefficient into the
fittingpublic boolean fitParameter(int index)
index
- The coefficient index for power equals to "index" in the
polynomialpublic void setParameter(int index, double val)
val
- The new parameter valueindex
- he coefficient index for power equals to "index" in the
polynomialpublic void setData(double[] x_arr, double[] y_arr, double[] y_err_arr)
y_arr
- Y data arrayy_err_arr
- Y values error arrayx_arr
- The new data valuepublic void setData(double[] x_arr, double[] y_arr)
y_arr
- Y data arrayx_arr
- The new data valuepublic void clear()
public void setOrder(int n)
n
- The new order valuepublic int getOrder()
public void addData(double x, double y)
x
- The x valuey
- The y valuepublic void addData(double x, double y, double y_err)
x
- The x valuey
- The y valuy_err
- The error of the y valuepublic boolean fit()
public boolean fitFromCenter()
public double getValue(double x)
x
- The x-valuepublic double getValue(double x, double[] a)
x
- The x-valuea
- The array of coefficientspublic double[] getCoefficients()
public double[] getCoefficientsErr()
public java.lang.String equation()
public java.lang.String equation(java.lang.String format_pattern)
format_pattern
- The fortran format pattern, e.g. G12.5public static void main(java.lang.String[] args)
args
- The array of strings as parameters