gov.sandia.cognition.learning.function.scalar

## Class PolynomialFunction.Linear

• ### Field Summary

Fields
Modifier and Type Field and Description
`static double` `COLLINEAR_TOLERANCE`
Tolerance below which to consider something zero, 0.0
• ### Constructor Summary

Constructors
Constructor and Description
```Linear(double q0, double q1)```
Creates a new instance of Linear
• ### Method Summary

All Methods
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()`
• ### Methods inherited from class java.lang.Object

`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`
• ### Methods inherited from interface gov.sandia.cognition.math.DifferentiableUnivariateScalarFunction

`differentiate`
• ### Methods inherited from interface gov.sandia.cognition.math.UnivariateScalarFunction

`evaluate, evaluateAsDouble`
• ### Field Detail

• #### COLLINEAR_TOLERANCE

`public static final double COLLINEAR_TOLERANCE`
Tolerance below which to consider something zero, 0.0
Constant Field Values
• ### Constructor Detail

• #### Linear

```public Linear(double q0,
double q1)```
Creates a new instance of Linear
Parameters:
`q0` - Constant (zeroth-order) coefficient
`q1` - Linear (first-order) coefficient
• ### Method Detail

• #### clone

`public PolynomialFunction.Linear clone()`
Description copied from class: `AbstractCloneableSerializable`
This makes public the clone method on the `Object` 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.
Specified by:
`clone` in interface `CloneableSerializable`
Overrides:
`clone` in class `AbstractCloneableSerializable`
Returns:
A clone of this object.
• #### evaluate

`public double evaluate(double input)`
Description copied from interface: `UnivariateScalarFunction`
Produces a double output for the given double input
Specified by:
`evaluate` in interface `UnivariateScalarFunction`
Parameters:
`input` - Input to the Evaluator
Returns:
output at the given input
• #### differentiate

`public double differentiate(double input)`
Description copied from interface: `DifferentiableUnivariateScalarFunction`
Differentiates the output of the function about the given input
Specified by:
`differentiate` in interface `DifferentiableUnivariateScalarFunction`
Parameters:
`input` - Input about which to compute the derivative of the function output
Returns:
Derivative of the output with respect to the input
• #### roots

`public java.lang.Double[] roots()`
Description copied from interface: `PolynomialFunction.ClosedForm`
Finds the real-valued roots (zero crossings) of the polynomial
Specified by:
`roots` in interface `PolynomialFunction.ClosedForm`
Returns:
Array of roots, will never be null
• #### stationaryPoints

`public java.lang.Double[] stationaryPoints()`
Description copied from interface: `PolynomialFunction.ClosedForm`
Finds the real-valued stationary points (zero slope) maxima or minima of the polynomial
Specified by:
`stationaryPoints` in interface `PolynomialFunction.ClosedForm`
Returns:
Array of stationary points, will never be null
• #### fit

```public 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
Parameters:
`p0` - First point
`p1` - Second point
Returns:
closed-form Linear function representing the data points
• #### fit

`public static PolynomialFunction.Linear fit(InputOutputSlopeTriplet p0)`
Fits a linear (stright-line) curve to the given data point
Parameters:
`p0` - First point
Returns:
closed-form Linear function representing the data points
• #### getQ0

`public double getQ0()`
Getter for q0
Returns:
Zeroth order coefficient
• #### setQ0

`public void setQ0(double q0)`
Setter for q0
Parameters:
`q0` - Zeroth order coefficient
• #### getQ1

`public double getQ1()`
Getter for q1
Returns:
First-order coefficient
• #### setQ1

`public void setQ1(double q1)`
Setter for q1
Parameters:
`q1` - First-order coefficient
• #### toString

`public java.lang.String toString()`
Overrides:
`toString` in class `java.lang.Object`