25package umontreal.ssj.functions;
27import java.util.Arrays;
46 if (x.length != y.length)
47 throw new IllegalArgumentException();
71 final int idx = Arrays.binarySearch(this.x, x);
74 final int insertionPoint = -(idx + 1);
75 return y[insertionPoint];
PiecewiseConstantFunction(double[] x, double[] y)
Constructs a new piecewise-constant function with and coordinates given by x and y.
double evaluate(double x)
Returns the value of the function evaluated at .
double[] getY()
Returns the coordinates of the function.
double[] getX()
Returns the coordinates of the function.
This interface should be implemented by classes which represent univariate mathematical functions.