public static class PolynomialFunction.Linear extends AbstractDifferentiableUnivariateScalarFunction implements PolynomialFunction.ClosedForm
| Modifier and Type | Field and Description |
|---|---|
static double |
COLLINEAR_TOLERANCE
Tolerance below which to consider something zero, 0.0
|
| Constructor and Description |
|---|
Linear(double q0,
double q1)
Creates a new instance of Linear
|
| Modifier and Type | Method and Description |
|---|---|
PolynomialFunction.Linear |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
double |
differentiate(double input)
Differentiates the output of the function about the given input
|
double |
evaluate(double input)
Produces a double output for the given double input
|
static PolynomialFunction.Linear |
fit(InputOutputPair<java.lang.Double,java.lang.Double> p0,
InputOutputPair<java.lang.Double,java.lang.Double> p1)
Fits a linear (straight-line) curve to the given data points
|
static PolynomialFunction.Linear |
fit(InputOutputSlopeTriplet p0)
Fits a linear (stright-line) curve to the given data point
|
double |
getQ0()
Getter for q0
|
double |
getQ1()
Getter for q1
|
java.lang.Double[] |
roots()
Finds the real-valued roots (zero crossings) of the polynomial
|
void |
setQ0(double q0)
Setter for q0
|
void |
setQ1(double q1)
Setter for q1
|
java.lang.Double[] |
stationaryPoints()
Finds the real-valued stationary points (zero slope) maxima or minima
of the polynomial
|
java.lang.String |
toString() |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdifferentiateevaluate, evaluateAsDoublepublic static final double COLLINEAR_TOLERANCE
public Linear(double q0,
double q1)
q0 - Constant (zeroth-order) coefficientq1 - Linear (first-order) coefficientpublic PolynomialFunction.Linear 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 CloneableSerializableclone in class AbstractCloneableSerializablepublic double evaluate(double input)
UnivariateScalarFunctionevaluate in interface UnivariateScalarFunctioninput - Input to the Evaluatorpublic double differentiate(double input)
DifferentiableUnivariateScalarFunctiondifferentiate in interface DifferentiableUnivariateScalarFunctioninput - Input about which to compute the derivative of the function outputpublic java.lang.Double[] roots()
PolynomialFunction.ClosedFormroots in interface PolynomialFunction.ClosedFormpublic java.lang.Double[] stationaryPoints()
PolynomialFunction.ClosedFormstationaryPoints in interface PolynomialFunction.ClosedFormpublic static PolynomialFunction.Linear fit(InputOutputPair<java.lang.Double,java.lang.Double> p0, InputOutputPair<java.lang.Double,java.lang.Double> p1)
p0 - First pointp1 - Second pointpublic static PolynomialFunction.Linear fit(InputOutputSlopeTriplet p0)
p0 - First pointpublic double getQ0()
public void setQ0(double q0)
q0 - Zeroth order coefficientpublic double getQ1()
public void setQ1(double q1)
q1 - First-order coefficientpublic java.lang.String toString()
toString in class java.lang.Object