Class KnownPolynomial

All Implemented Interfaces:
Function, KnownFunction

public class KnownPolynomial extends PolynomialLeastSquareFit implements KnownFunction
A polynomial that implements KnownFunction. Limited to degree 5 or less.
  • Constructor Details

    • KnownPolynomial

      public KnownPolynomial(double[] coeffs)
  • Method Details

    • getParameterCount

      public int getParameterCount()
      Gets the parameter count.
      Specified by:
      getParameterCount in interface KnownFunction
      Returns:
      the number of parameters
    • getParameterName

      public String getParameterName(int i)
      Gets a parameter name.
      Specified by:
      getParameterName in interface KnownFunction
      Parameters:
      i - the parameter index
      Returns:
      the name of the parameter
    • getParameterDescription

      public String getParameterDescription(int i)
      Gets a parameter description. May be null.
      Specified by:
      getParameterDescription in interface KnownFunction
      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:
      getParameterValue in interface KnownFunction
      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:
      setParameterValue in interface KnownFunction
      Parameters:
      i - the parameter index
      value - the value
    • setParameters

      public void setParameters(String[] names, double[] values, String[] descriptions)
      Sets the parameters.
      Specified by:
      setParameters in interface KnownFunction
      Parameters:
      names - the parameter names (may be null)
      values - the parameter values (may be null)
      descriptions - the parameter descriptions (may be null)
    • getExpression

      public String getExpression(String indepVarName)
      Gets the expression.
      Specified by:
      getExpression in interface KnownFunction
      Parameters:
      indepVarName - the name of the independent variable
      Returns:
      the equation expression
    • getName

      public String getName()
      Gets the name of the function.
      Specified by:
      getName in interface KnownFunction
      Returns:
      the name
    • setName

      public void setName(String aName)
      Sets the name of the function.
      Specified by:
      setName in interface KnownFunction
      Parameters:
      aName - the name
    • getDescription

      public String getDescription()
      Gets the description of the function.
      Specified by:
      getDescription in interface KnownFunction
      Returns:
      the description
    • setDescription

      public void setDescription(String aDescription)
      Sets the description of the function.
      Specified by:
      setDescription in interface KnownFunction
      Parameters:
      aDescription - the description
    • clone

      public KnownPolynomial clone()
      Gets a clone of this function.
      Specified by:
      clone in interface KnownFunction
      Overrides:
      clone in class Object
      Returns:
      the clone
    • equals

      public boolean equals(Object f)
      Determines if another KnownFunction is the same as this one.
      Specified by:
      equals in interface KnownFunction
      Overrides:
      equals in class Object
      Parameters:
      f - the KnownFunction to test
      Returns:
      true if equal
    • toString

      public String toString()
      Description copied from class: Polynomial
      Converts this polynomial to a String.
      Overrides:
      toString in class Polynomial
    • newUserFunction

      public UserFunction newUserFunction(String var)
      Specified by:
      newUserFunction in interface KnownFunction