| Constructor and Description |
|---|
PiecewiseFunction(Function
Creates a new
PiecewiseFunction.
|
| Modifier and Type | Method and Description |
|---|---|
static PiecewiseFunction |
create(Function
This creates a
PiecewiseFunction that resembles another function.
|
double |
evaluate(double x)
Evaluates f(x).
|
double[] |
evaluateInverse(double y)
Returns all the x-values for the equation f(x) = y.
|
Function |
getFunction(int index)
|
int |
getFunctionCount()
|
void |
setFunction(int index, Function
|
String |
toString()
|
public PiecewiseFunction(Function[] functions, double[] upperBounds)
PiecewiseFunction.
functions -
upperBounds - the right-most edge of functions. If there are n-elements in
functions, there should be (n-1) elements in this array.
So if you pass 2 functions [a, b], and this value is the array [k], then for all values less than k: a will be used. For all values greater than k, b will be be used.
public static PiecewiseFunctioncreate(Function f, Function fDeriv, double min, double max, int functions)
PiecewiseFunction that resembles another function. This method should be used when the argument
f is normally expensive to calculate, and generally predictable/simple in curvature.
The pieces of the new PiecewiseFunction are going to be PolynomialFunctions.
f - the function to mimic.
fDeriv - a derivative of
f.
min - the left edge of the domain you're interested in mimicking.
max - the right edge of the domain you're interested in mimicking.
functions - the number of functions/partitions the
PiecewiseFunction should use.
public StringtoString()
public double evaluate(double x)
Function
public double[] evaluateInverse(double y)
Function
evaluateInverse in interface
Function
y - a possible output of this function.
public FunctiongetFunction(int index)
public int getFunctionCount()
public void setFunction(int index,
Function f)