public class CosineFunction extends AbstractDifferentiableUnivariateScalarFunction implements Vectorizable
Modifier and Type | Field and Description |
---|---|
static double |
TWO_PI
Value of 2.0*pi = 6.283185307179586.
|
Constructor and Description |
---|
CosineFunction()
Creates a new instance of CosineFunction
|
CosineFunction(double amplitude,
double frequency)
Creates a new instance of CosineFunction
|
CosineFunction(double amplitude,
double frequency,
double phase)
Creates a new instance of CosineFunction
|
Modifier and Type | Method and Description |
---|---|
CosineFunction |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
void |
convertFromVector(Vector parameters)
Converts the object from a Vector of parameters.
|
Vector |
convertToVector()
Converts the object to a vector.
|
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
|
double |
getAmplitude()
Getter for amplitude
|
double |
getFrequency()
Getter for frequency
|
double |
getPhase()
Getter for phase
|
void |
setAmplitude(double amplitude)
Setter for amplitude
|
void |
setFrequency(double frequency)
Setter for frequency
|
void |
setPhase(double phase)
Setter for phase
|
java.lang.String |
toString() |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
differentiate
evaluate, evaluateAsDouble
public static final double TWO_PI
public CosineFunction()
public CosineFunction(double amplitude, double frequency)
amplitude
- Maximum value of the cosine function. The value of "A" in
y=A*cos(2*pi*f*x + phase).frequency
- Frequency of the cosine function. The value of "f" in
y=A*cos(2*pi*f*x + phase).public CosineFunction(double amplitude, double frequency, double phase)
amplitude
- Maximum value of the cosine function. The value of "A" in
y=A*cos(2*pi*f*x + phase).frequency
- Frequency of the cosine function. The value of "f" in
y=A*cos(2*pi*f*x + phase).phase
- Phase of the cosine function. The value of "phase" in
y=A*cos(2*pi*f*x + phase).public CosineFunction clone()
AbstractCloneableSerializable
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.clone
in interface Vectorizable
clone
in interface CloneableSerializable
clone
in class AbstractCloneableSerializable
public double evaluate(double input)
UnivariateScalarFunction
evaluate
in interface UnivariateScalarFunction
input
- Input to the Evaluatorpublic double differentiate(double input)
DifferentiableUnivariateScalarFunction
differentiate
in interface DifferentiableUnivariateScalarFunction
input
- Input about which to compute the derivative of the function outputpublic double getAmplitude()
public void setAmplitude(double amplitude)
amplitude
- Maximum value of the cosine function. The value of "A" in
y=A*cos(2*pi*f*x + phase).public double getFrequency()
public void setFrequency(double frequency)
frequency
- Frequency of the cosine function. The value of "f" in
y=A*cos(2*pi*f*x + phase).public double getPhase()
public void setPhase(double phase)
phase
- Phase of the cosine function. The value of "phase" in
y=A*cos(2*pi*f*x + phase).public Vector convertToVector()
Vectorizable
convertToVector
in interface Vectorizable
public void convertFromVector(Vector parameters)
Vectorizable
convertFromVector
in interface Vectorizable
parameters
- The parameters to incorporate.public java.lang.String toString()
toString
in class java.lang.Object