Package org.opensourcephysics.tools
Class KnownPolynomial
java.lang.Object
org.opensourcephysics.numerics.Polynomial
org.opensourcephysics.numerics.PolynomialLeastSquareFit
org.opensourcephysics.tools.KnownPolynomial
- All Implemented Interfaces:
Function,KnownFunction
A polynomial that implements KnownFunction. Limited to degree 5 or less.
-
Field Summary
Fields inherited from class org.opensourcephysics.numerics.Polynomial
coefficients -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Gets a clone of this function.booleanDetermines if another KnownFunction is the same as this one.Gets the description of the function.getExpression(String indepVarName) Gets the expression.getName()Gets the name of the function.intGets the parameter count.getParameterDescription(int i) Gets a parameter description.getParameterName(int i) Gets a parameter name.doublegetParameterValue(int i) Gets a parameter value.newUserFunction(String var) voidsetDescription(String aDescription) Sets the description of the function.voidSets the name of the function.voidsetParameters(String[] names, double[] values, String[] descriptions) Sets the parameters.voidsetParameterValue(int i, double value) Sets a parameter value.toString()Converts this polynomial to a String.Methods inherited from class org.opensourcephysics.numerics.PolynomialLeastSquareFit
computeCoefficients, fitDataMethods inherited from class org.opensourcephysics.numerics.Polynomial
add, add, coefficient, deflate, degree, derivative, divide, divide, divideWithRemainder, evalPolynomial, evaluate, getCoefficients, integral, integral, multiply, multiply, roots, rootsReal, subtract, subtract, valueAndDerivative
-
Constructor Details
-
KnownPolynomial
public KnownPolynomial(double[] coeffs)
-
-
Method Details
-
getParameterCount
public int getParameterCount()Gets the parameter count.- Specified by:
getParameterCountin interfaceKnownFunction- Returns:
- the number of parameters
-
getParameterName
Gets a parameter name.- Specified by:
getParameterNamein interfaceKnownFunction- Parameters:
i- the parameter index- Returns:
- the name of the parameter
-
getParameterDescription
Gets a parameter description. May be null.- Specified by:
getParameterDescriptionin interfaceKnownFunction- Parameters:
i- the parameter index- Returns:
- the description of the parameter (may be null)
-
getParameterValue
public double getParameterValue(int i) Gets a parameter value.- Specified by:
getParameterValuein interfaceKnownFunction- Parameters:
i- the parameter index- Returns:
- the value of the parameter
-
setParameterValue
public void setParameterValue(int i, double value) Sets a parameter value.- Specified by:
setParameterValuein interfaceKnownFunction- Parameters:
i- the parameter indexvalue- the value
-
setParameters
Sets the parameters.- Specified by:
setParametersin interfaceKnownFunction- Parameters:
names- the parameter names (may be null)values- the parameter values (may be null)descriptions- the parameter descriptions (may be null)
-
getExpression
Gets the expression.- Specified by:
getExpressionin interfaceKnownFunction- Parameters:
indepVarName- the name of the independent variable- Returns:
- the equation expression
-
getName
Gets the name of the function.- Specified by:
getNamein interfaceKnownFunction- Returns:
- the name
-
setName
Sets the name of the function.- Specified by:
setNamein interfaceKnownFunction- Parameters:
aName- the name
-
getDescription
Gets the description of the function.- Specified by:
getDescriptionin interfaceKnownFunction- Returns:
- the description
-
setDescription
Sets the description of the function.- Specified by:
setDescriptionin interfaceKnownFunction- Parameters:
aDescription- the description
-
clone
Gets a clone of this function.- Specified by:
clonein interfaceKnownFunction- Overrides:
clonein classObject- Returns:
- the clone
-
equals
Determines if another KnownFunction is the same as this one.- Specified by:
equalsin interfaceKnownFunction- Overrides:
equalsin classObject- Parameters:
f- the KnownFunction to test- Returns:
- true if equal
-
toString
Description copied from class:PolynomialConverts this polynomial to a String.- Overrides:
toStringin classPolynomial
-
newUserFunction
- Specified by:
newUserFunctionin interfaceKnownFunction
-