public class PolynomialFunction extends AbstractDifferentiableUnivariateScalarFunction implements ParameterGradientEvaluator<java.lang.Double,java.lang.Double,Vector>
| Modifier and Type | Class and Description |
|---|---|
static interface |
PolynomialFunction.ClosedForm
Describes functionality of a closed-form algebraic polynomial function
|
static class |
PolynomialFunction.Cubic
Algebraic treatment for a polynomial of the form
y(x) = q0 + q1*x + q2*x^2 + q3*x^3
|
static class |
PolynomialFunction.Linear
Utilities for algebraic treatment of a linear polynomial of the form
y(x) = q0 + q1*x
|
static class |
PolynomialFunction.Quadratic
Utilities for algebraic treatment of a quadratic polynomial of the form
y(x) = q0 + q1*x + q2*x^2.
|
static class |
PolynomialFunction.Regression
Performs Linear Regression using an arbitrary set of
PolynomialFunction basis functions
|
| Constructor and Description |
|---|
PolynomialFunction(double exponent)
Creates a new instance of PolynomialFunction
|
PolynomialFunction(PolynomialFunction other)
Copy Constructor
|
| Modifier and Type | Method and Description |
|---|---|
PolynomialFunction |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
Vector |
computeParameterGradient(java.lang.Double input)
Computes the derivative of the output with respect to the parameters for
a particular input.
|
void |
convertFromVector(Vector parameters)
Sets the value of the exponent
|
Vector |
convertToVector()
Returns the value of the exponent
|
static java.util.ArrayList<PolynomialFunction> |
createPolynomials(double... polynomialExponents)
Creates an array of PolynomialFunctions from the array of their exponents
|
double |
differentiate(double input)
Differentiates the output of the function about the given input
|
double |
evaluate(double input)
Evaluates the polynomial for the given input, returning
Math.pow( input, exponent )
|
double |
getExponent()
Getter for exponent
|
void |
setExponent(double exponent)
Setter for exponent
|
java.lang.String |
toString() |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdifferentiateevaluate, evaluateAsDoublepublic PolynomialFunction(double exponent)
exponent - Real-valued exponent of this polynomialpublic PolynomialFunction(PolynomialFunction other)
other - PolynomialFunction to copypublic PolynomialFunction clone()
AbstractCloneableSerializableObject class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone() to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone() as the basis for your implementation.clone in interface Vectorizableclone in interface CloneableSerializableclone in class AbstractCloneableSerializablepublic Vector convertToVector()
convertToVector in interface Vectorizablepublic void convertFromVector(Vector parameters)
convertFromVector in interface Vectorizableparameters - Exponent of this polynomialpublic double differentiate(double input)
DifferentiableUnivariateScalarFunctiondifferentiate in interface DifferentiableUnivariateScalarFunctioninput - Input about which to compute the derivative of the function outputpublic double evaluate(double input)
evaluate in interface UnivariateScalarFunctioninput - Input about which to compute the polynomialpublic Vector computeParameterGradient(java.lang.Double input)
ParameterGradientEvaluatorcomputeParameterGradient in interface ParameterGradientEvaluator<java.lang.Double,java.lang.Double,Vector>input - Input about which to compute the parameter gradient.public java.lang.String toString()
toString in class java.lang.Objectpublic double getExponent()
public void setExponent(double exponent)
exponent - Real-valued exponent of this polynomialpublic static java.util.ArrayList<PolynomialFunction> createPolynomials(double... polynomialExponents)
polynomialExponents - Exponents for the various polynomials