Package org.apache.commons.math.analysis
Class ComposableFunction
java.lang.Object
org.apache.commons.math.analysis.ComposableFunction
- All Implemented Interfaces:
UnivariateRealFunction
Base class for
UnivariateRealFunction
that can be composed with other functions.- Since:
- 2.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ComposableFunction
TheFastMath.abs
method wrapped as aComposableFunction
.static final ComposableFunction
TheFastMath.abs
method wrapped as aComposableFunction
.static final ComposableFunction
TheFastMath.asin
method wrapped as aComposableFunction
.static final ComposableFunction
TheFastMath.atan
method wrapped as aComposableFunction
.static final ComposableFunction
TheFastMath.cbrt
method wrapped as aComposableFunction
.static final ComposableFunction
TheFastMath.ceil
method wrapped as aComposableFunction
.static final ComposableFunction
TheFastMath.cos
method wrapped as aComposableFunction
.static final ComposableFunction
TheFastMath.cosh
method wrapped as aComposableFunction
.static final ComposableFunction
TheFastMath.exp
method wrapped as aComposableFunction
.static final ComposableFunction
TheFastMath.expm1
method wrapped as aComposableFunction
.static final ComposableFunction
TheFastMath.floor
method wrapped as aComposableFunction
.static final ComposableFunction
The identity function.static final ComposableFunction
The invert operator wrapped as aComposableFunction
.static final ComposableFunction
TheFastMath.log
method wrapped as aComposableFunction
.static final ComposableFunction
TheFastMath.log10
method wrapped as aComposableFunction
.static final ComposableFunction
TheFastMath.log1p
method wrapped as aComposableFunction
.static final ComposableFunction
The - operator wrapped as aComposableFunction
.static final ComposableFunction
The constant function always returning 1.static final ComposableFunction
TheFastMath.rint
method wrapped as aComposableFunction
.static final ComposableFunction
TheFastMath.signum
method wrapped as aComposableFunction
.static final ComposableFunction
TheFastMath.sin
method wrapped as aComposableFunction
.static final ComposableFunction
TheFastMath.sinh
method wrapped as aComposableFunction
.static final ComposableFunction
TheFastMath.sqrt
method wrapped as aComposableFunction
.static final ComposableFunction
TheFastMath.tan
method wrapped as aComposableFunction
.static final ComposableFunction
TheFastMath.tanh
method wrapped as aComposableFunction
.static final ComposableFunction
TheFastMath.ulp
method wrapped as aComposableFunction
.static final ComposableFunction
The constant function always returning 0. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd
(double a) Return a function adding a constant term to the instance.Return a function adding the instance and another function.Generates a function that iteratively apply instance function on all elements of an array.asCollector
(double initialValue) Generates a function that iteratively apply instance function on all elements of an array.asCollector
(BivariateRealFunction combiner) Generates a function that iteratively apply instance function on all elements of an array.asCollector
(BivariateRealFunction combiner, double initialValue) Generates a function that iteratively apply instance function on all elements of an array.combine
(UnivariateRealFunction f, BivariateRealFunction combiner) Return a function combining the instance and another function.Return a function dividing the instance by another function.multiply
(double scaleFactor) Return a function scaling the instance by a constant factor.Return a function multiplying the instance and another function.Precompose the instance with another function.Postcompose the instance with another function.Return a function subtracting another function from the instance.abstract double
value
(double x) Compute the value for the function.
-
Field Details
-
ZERO
The constant function always returning 0. -
ONE
The constant function always returning 1. -
IDENTITY
The identity function. -
ABS
TheFastMath.abs
method wrapped as aComposableFunction
. -
NEGATE
The - operator wrapped as aComposableFunction
. -
INVERT
The invert operator wrapped as aComposableFunction
. -
SIN
TheFastMath.sin
method wrapped as aComposableFunction
. -
SQRT
TheFastMath.sqrt
method wrapped as aComposableFunction
. -
SINH
TheFastMath.sinh
method wrapped as aComposableFunction
. -
EXP
TheFastMath.exp
method wrapped as aComposableFunction
. -
EXPM1
TheFastMath.expm1
method wrapped as aComposableFunction
. -
ASIN
TheFastMath.asin
method wrapped as aComposableFunction
. -
ATAN
TheFastMath.atan
method wrapped as aComposableFunction
. -
TAN
TheFastMath.tan
method wrapped as aComposableFunction
. -
TANH
TheFastMath.tanh
method wrapped as aComposableFunction
. -
CBRT
TheFastMath.cbrt
method wrapped as aComposableFunction
. -
CEIL
TheFastMath.ceil
method wrapped as aComposableFunction
. -
FLOOR
TheFastMath.floor
method wrapped as aComposableFunction
. -
LOG
TheFastMath.log
method wrapped as aComposableFunction
. -
LOG10
TheFastMath.log10
method wrapped as aComposableFunction
. -
LOG1P
TheFastMath.log1p
method wrapped as aComposableFunction
. -
COS
TheFastMath.cos
method wrapped as aComposableFunction
. -
ACOS
TheFastMath.abs
method wrapped as aComposableFunction
. -
COSH
TheFastMath.cosh
method wrapped as aComposableFunction
. -
RINT
TheFastMath.rint
method wrapped as aComposableFunction
. -
SIGNUM
TheFastMath.signum
method wrapped as aComposableFunction
. -
ULP
TheFastMath.ulp
method wrapped as aComposableFunction
.
-
-
Constructor Details
-
ComposableFunction
public ComposableFunction()
-
-
Method Details
-
of
Precompose the instance with another function.The composed function h created by
h = g.of(f)
is such thath.value(x) == g.value(f.value(x))
for all x.- Parameters:
f
- function to compose with- Returns:
- a new function which computes
this.value(f.value(x))
- See Also:
-
postCompose
Postcompose the instance with another function.The composed function h created by
h = g.postCompose(f)
is such thath.value(x) == f.value(g.value(x))
for all x.- Parameters:
f
- function to compose with- Returns:
- a new function which computes
f.value(this.value(x))
- See Also:
-
combine
Return a function combining the instance and another function.The function h created by
h = g.combine(f, combiner)
is such thath.value(x) == combiner.value(g.value(x), f.value(x))
for all x.- Parameters:
f
- function to combine with the instancecombiner
- bivariate function used for combining- Returns:
- a new function which computes
combine.value(this.value(x), f.value(x))
-
add
Return a function adding the instance and another function.- Parameters:
f
- function to combine with the instance- Returns:
- a new function which computes
this.value(x) + f.value(x)
-
add
Return a function adding a constant term to the instance.- Parameters:
a
- term to add- Returns:
- a new function which computes
this.value(x) + a
-
subtract
Return a function subtracting another function from the instance.- Parameters:
f
- function to combine with the instance- Returns:
- a new function which computes
this.value(x) - f.value(x)
-
multiply
Return a function multiplying the instance and another function.- Parameters:
f
- function to combine with the instance- Returns:
- a new function which computes
this.value(x) * f.value(x)
-
multiply
Return a function scaling the instance by a constant factor.- Parameters:
scaleFactor
- constant scaling factor- Returns:
- a new function which computes
this.value(x) * scaleFactor
-
divide
Return a function dividing the instance by another function.- Parameters:
f
- function to combine with the instance- Returns:
- a new function which computes
this.value(x) / f.value(x)
-
asCollector
Generates a function that iteratively apply instance function on all elements of an array.The generated function behaves as follows:
- initialize result = initialValue
- iterate:
result = combiner.value(result, this.value(nextMultivariateEntry));
- return result
- Parameters:
combiner
- combiner to use between entriesinitialValue
- initial value to use before first entry- Returns:
- a new function that iteratively apply instance function on all elements of an array.
-
asCollector
Generates a function that iteratively apply instance function on all elements of an array.Calling this method is equivalent to call
asCollector(BivariateRealFunction, 0.0)
.- Parameters:
combiner
- combiner to use between entries- Returns:
- a new function that iteratively apply instance function on all elements of an array.
- See Also:
-
asCollector
Generates a function that iteratively apply instance function on all elements of an array.Calling this method is equivalent to call
asCollector(BinaryFunction.ADD, initialValue)
.- Parameters:
initialValue
- initial value to use before first entry- Returns:
- a new function that iteratively apply instance function on all elements of an array.
- See Also:
-
asCollector
Generates a function that iteratively apply instance function on all elements of an array.Calling this method is equivalent to call
asCollector(BinaryFunction.ADD, 0.0)
.- Returns:
- a new function that iteratively apply instance function on all elements of an array.
- See Also:
-
value
Compute the value for the function.- Specified by:
value
in interfaceUnivariateRealFunction
- Parameters:
x
- the point for which the function value should be computed- Returns:
- the value
- Throws:
FunctionEvaluationException
- if the function evaluation fails
-