public class FunctionUtils extends Object
Modifier and Type | Method and Description |
---|---|
static DifferentiableUnivariateFunction |
add(DifferentiableUnivariateFunction... f)
Add functions.
|
static UnivariateFunction |
add(UnivariateFunction... f)
Add functions.
|
static MultivariateFunction |
collector(BivariateFunction combiner,
double initialValue)
Returns a MultivariateFunction h(x[]) defined by
|
static MultivariateFunction |
collector(BivariateFunction combiner,
UnivariateFunction f,
double initialValue)
Returns a MultivariateFunction h(x[]) defined by
|
static UnivariateFunction |
combine(BivariateFunction combiner,
UnivariateFunction f,
UnivariateFunction g)
Returns the univariate function
h(x) = combiner(f(x), g(x)) . |
static DifferentiableUnivariateFunction |
compose(DifferentiableUnivariateFunction... f)
Compose functions.
|
static UnivariateFunction |
compose(UnivariateFunction... f)
Compose functions.
|
static UnivariateFunction |
fix1stArgument(BivariateFunction f,
double fixed)
Create a unary function by fixing the first argument of a binary function.
|
static UnivariateFunction |
fix2ndArgument(BivariateFunction f,
double fixed)
Create a unary function by fixing the second argument of a binary function.
|
static DifferentiableUnivariateFunction |
multiply(DifferentiableUnivariateFunction... f)
Multiply functions.
|
static UnivariateFunction |
multiply(UnivariateFunction... f)
Multiply functions.
|
static double[] |
sample(UnivariateFunction f,
double min,
double max,
int n)
Samples the specified univariate real function on the specified interval.
|
public static UnivariateFunction compose(UnivariateFunction... f)
f
- List of functions.public static DifferentiableUnivariateFunction compose(DifferentiableUnivariateFunction... f)
f
- List of functions.public static UnivariateFunction add(UnivariateFunction... f)
f
- List of functions.public static DifferentiableUnivariateFunction add(DifferentiableUnivariateFunction... f)
f
- List of functions.public static UnivariateFunction multiply(UnivariateFunction... f)
f
- List of functions.public static DifferentiableUnivariateFunction multiply(DifferentiableUnivariateFunction... f)
f
- List of functions.public static UnivariateFunction combine(BivariateFunction combiner, UnivariateFunction f, UnivariateFunction g)
h(x) = combiner(f(x), g(x))
.combiner
- Combiner function.f
- Function.g
- Function.public static MultivariateFunction collector(BivariateFunction combiner, UnivariateFunction f, double initialValue)
h(x[]) = combiner(...combiner(combiner(initialValue,f(x[0])),f(x[1]))...),f(x[x.length-1]))
combiner
- Combiner function.f
- Function.initialValue
- Initial value.public static MultivariateFunction collector(BivariateFunction combiner, double initialValue)
h(x[]) = combiner(...combiner(combiner(initialValue,x[0]),x[1])...),x[x.length-1])
combiner
- Combiner function.initialValue
- Initial value.public static UnivariateFunction fix1stArgument(BivariateFunction f, double fixed)
f
- Binary function.fixed
- Value to which the first argument of f
is set.public static UnivariateFunction fix2ndArgument(BivariateFunction f, double fixed)
f
- Binary function.fixed
- Value to which the second argument of f
is set.public static double[] sample(UnivariateFunction f, double min, double max, int n)
Samples the specified univariate real function on the specified interval.
The interval is divided equally into n
sections and sample points
are taken from min
to max - (max - min) / n
; therefore
f
is not sampled at the upper bound max
.
f
- the function to be sampledmin
- the (inclusive) lower bound of the intervalmax
- the (exclusive) upper bound of the intervaln
- the number of sample pointsNumberIsTooLargeException
- if the lower bound min
is
greater than, or equal to the upper bound max
NotStrictlyPositiveException
- if the number of sample points
n
is negativeCopyright © 2003-2012 The Apache Software Foundation. All Rights Reserved.