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 ComposableFunctionTheFastMath.absmethod wrapped as aComposableFunction.static final ComposableFunctionTheFastMath.absmethod wrapped as aComposableFunction.static final ComposableFunctionTheFastMath.asinmethod wrapped as aComposableFunction.static final ComposableFunctionTheFastMath.atanmethod wrapped as aComposableFunction.static final ComposableFunctionTheFastMath.cbrtmethod wrapped as aComposableFunction.static final ComposableFunctionTheFastMath.ceilmethod wrapped as aComposableFunction.static final ComposableFunctionTheFastMath.cosmethod wrapped as aComposableFunction.static final ComposableFunctionTheFastMath.coshmethod wrapped as aComposableFunction.static final ComposableFunctionTheFastMath.expmethod wrapped as aComposableFunction.static final ComposableFunctionTheFastMath.expm1method wrapped as aComposableFunction.static final ComposableFunctionTheFastMath.floormethod wrapped as aComposableFunction.static final ComposableFunctionThe identity function.static final ComposableFunctionThe invert operator wrapped as aComposableFunction.static final ComposableFunctionTheFastMath.logmethod wrapped as aComposableFunction.static final ComposableFunctionTheFastMath.log10method wrapped as aComposableFunction.static final ComposableFunctionTheFastMath.log1pmethod wrapped as aComposableFunction.static final ComposableFunctionThe - operator wrapped as aComposableFunction.static final ComposableFunctionThe constant function always returning 1.static final ComposableFunctionTheFastMath.rintmethod wrapped as aComposableFunction.static final ComposableFunctionTheFastMath.signummethod wrapped as aComposableFunction.static final ComposableFunctionTheFastMath.sinmethod wrapped as aComposableFunction.static final ComposableFunctionTheFastMath.sinhmethod wrapped as aComposableFunction.static final ComposableFunctionTheFastMath.sqrtmethod wrapped as aComposableFunction.static final ComposableFunctionTheFastMath.tanmethod wrapped as aComposableFunction.static final ComposableFunctionTheFastMath.tanhmethod wrapped as aComposableFunction.static final ComposableFunctionTheFastMath.ulpmethod wrapped as aComposableFunction.static final ComposableFunctionThe 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 doublevalue(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.absmethod wrapped as aComposableFunction. -
NEGATE
The - operator wrapped as aComposableFunction. -
INVERT
The invert operator wrapped as aComposableFunction. -
SIN
TheFastMath.sinmethod wrapped as aComposableFunction. -
SQRT
TheFastMath.sqrtmethod wrapped as aComposableFunction. -
SINH
TheFastMath.sinhmethod wrapped as aComposableFunction. -
EXP
TheFastMath.expmethod wrapped as aComposableFunction. -
EXPM1
TheFastMath.expm1method wrapped as aComposableFunction. -
ASIN
TheFastMath.asinmethod wrapped as aComposableFunction. -
ATAN
TheFastMath.atanmethod wrapped as aComposableFunction. -
TAN
TheFastMath.tanmethod wrapped as aComposableFunction. -
TANH
TheFastMath.tanhmethod wrapped as aComposableFunction. -
CBRT
TheFastMath.cbrtmethod wrapped as aComposableFunction. -
CEIL
TheFastMath.ceilmethod wrapped as aComposableFunction. -
FLOOR
TheFastMath.floormethod wrapped as aComposableFunction. -
LOG
TheFastMath.logmethod wrapped as aComposableFunction. -
LOG10
TheFastMath.log10method wrapped as aComposableFunction. -
LOG1P
TheFastMath.log1pmethod wrapped as aComposableFunction. -
COS
TheFastMath.cosmethod wrapped as aComposableFunction. -
ACOS
TheFastMath.absmethod wrapped as aComposableFunction. -
COSH
TheFastMath.coshmethod wrapped as aComposableFunction. -
RINT
TheFastMath.rintmethod wrapped as aComposableFunction. -
SIGNUM
TheFastMath.signummethod wrapped as aComposableFunction. -
ULP
TheFastMath.ulpmethod 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:
valuein interfaceUnivariateRealFunction- Parameters:
x- the point for which the function value should be computed- Returns:
- the value
- Throws:
FunctionEvaluationException- if the function evaluation fails
-