Top Description Fields Constructors Methods
org.apache.commons.math3.analysis.function

public Class StepFunction

extends Object
implements UnivariateFunction
Class Inheritance
All Implemented Interfaces
org.apache.commons.math3.analysis.UnivariateFunction
Imports
java.util.Arrays, org.apache.commons.math3.analysis.UnivariateFunction, org.apache.commons.math3.exception.DimensionMismatchException, .NoDataException, .NonMonotonicSequenceException, .NullArgumentException, org.apache.commons.math3.util.MathArrays

Step function.
Since
3.0

Field Summary

Modifier and TypeField and Description
private final double[]
abscissa

Abscissae.

private final double[]
ordinate

Ordinates.

Constructor Summary

AccessConstructor and Description
public
StepFunction(double[]
Domain values where the function changes value.
x
,
double[]
Values of the function.
y
)

Builds a step function from a list of arguments and the corresponding values.

Method Summary

Modifier and TypeMethod and Description
public double
value(double
Point at which the function value should be computed.
x
)

Implements org.apache.commons.math3.analysis.UnivariateFunction.value.

Compute the value of the function.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

abscissaback to summary
private final double[] abscissa

Abscissae.

ordinateback to summary
private final double[] ordinate

Ordinates.

Constructor Detail

StepFunctionback to summary
public StepFunction(double[] x, double[] y) throws NullArgumentException, NoDataException, DimensionMismatchException, NonMonotonicSequenceException

Builds a step function from a list of arguments and the corresponding values. Specifically, returns the function h(x) defined by


h(x) = y[0] for all x < x[1]
       y[1] for x[1] ≤ x < x[2]
       ...
       y[y.length - 1] for x ≥ x[x.length - 1]
The value of x[0] is ignored, but it must be strictly less than x[1].
Parameters
x:double[]

Domain values where the function changes value.

y:double[]

Values of the function.

Exceptions
NullArgumentException:
if x or y are null.
NoDataException:
if x or y are zero-length.
DimensionMismatchException:
if x and y do not have the same length.
NonMonotonicSequenceException:
if the x array is not sorted in strictly increasing order.

Method Detail

valueback to summary
public double value(double x)

Implements org.apache.commons.math3.analysis.UnivariateFunction.value.

Doc from org.apache.commons.math3.analysis.UnivariateFunction.value.

Compute the value of the function.

Parameters
x:double

Point at which the function value should be computed.

Returns:double

the value of the function.