joptima.functions
Class Cubic
- java.lang.Object
-
- joptima.functions.ConstrainableFunction
-
- joptima.functions.Cubic
-
- All Implemented Interfaces:
- Function
public class Cubic extends ConstrainableFunction
Function a * x^3 + b * x^2 + c * x + d. A concrete implementation of joptima.Function that calculates a cubic function of one argument.
-
-
Field Summary
Fields Modifier and Type Field and Description doublem_adoublem_bdoublem_cdoublem_d
-
Constructor Summary
Constructors Constructor and Description Cubic()Default constructor: a = 1, b = 0, c = 0, d = 0.Cubic(double a, double b, double c, double d)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublecalculate(double x)Calculates the value of the function at the given point using the preset parameters.voidconstrain(java.lang.String parametername)Removes the given parameter from the parameter list.doublegetA()doublegetB()doublegetC()doublegetD()java.lang.StringgetName()Gets the (user-settable) name of this function.Parameter[]getParameters()Lists all the mutable parameters to this function.voidsetA(double a)voidsetB(double b)voidsetC(double c)voidsetD(double d)voidsetName(java.lang.String newname)Overrides the default function name.-
Methods inherited from class joptima.functions.ConstrainableFunction
constrain, constrain
-
-
-
-
Field Detail
-
m_a
public double m_a
-
m_b
public double m_b
-
m_c
public double m_c
-
m_d
public double m_d
-
-
Constructor Detail
-
Cubic
public Cubic()
Default constructor: a = 1, b = 0, c = 0, d = 0.
-
Cubic
public Cubic(double a, double b, double c, double d)Constructor.
-
-
Method Detail
-
getParameters
public Parameter[] getParameters()
Description copied from interface:FunctionLists all the mutable parameters to this function.- Returns:
- a
Parameter[] of delegates that access the proper member variables.
-
constrain
public void constrain(java.lang.String parametername)
Description copied from class:ConstrainableFunctionRemoves the given parameter from the parameter list. This constraint is mandatory to implement.- Specified by:
constrainin classConstrainableFunction
-
getName
public java.lang.String getName()
Description copied from interface:FunctionGets the (user-settable) name of this function.- Returns:
- the name of the function
-
setName
public void setName(java.lang.String newname)
Description copied from interface:FunctionOverrides the default function name.- Parameters:
newname- the new name for the function
-
calculate
public double calculate(double x)
Description copied from interface:FunctionCalculates the value of the function at the given point using the preset parameters.- Parameters:
x- the x coordinate to calculate the function at- Returns:
- the value of the function at the given coordinate
-
getA
public double getA()
-
setA
public void setA(double a)
-
getB
public double getB()
-
setB
public void setB(double b)
-
getC
public double getC()
-
setC
public void setC(double c)
-
getD
public double getD()
-
setD
public void setD(double d)
-
-
DMelt 3.0 © DataMelt by jWork.ORG