java.lang.Object
net.finmath.integration.PiecewiseContantDoubleUnaryOperator
- All Implemented Interfaces:
DoubleUnaryOperator,Function<Double,Double>
public class PiecewiseContantDoubleUnaryOperator
extends Object
implements DoubleUnaryOperator, Function<Double,Double>
A piecewise constant
DoubleUnaryOperator \( f : \mathbb{R} \rightarrow \mathbb{R} \)
with exact calculation of the integral \( \int_{a}^{b} f(x) dx \) for given bounds \( a, b \).
The summation uses Kahan error correction.
For convenience the class can act as DoubleUnaryOperator specialization
and as Function.- Author:
- Christian Fries
-
Constructor Summary
ConstructorsConstructorDescriptionPiecewiseContantDoubleUnaryOperator(double[] intervalRightPoints, double[] values)Construct a piecewise constantDoubleUnaryOperator\( f : \mathbb{R} \rightarrow \mathbb{R} \).PiecewiseContantDoubleUnaryOperator(List<Double> intervalRightPoints, List<Double> values)Construct a piecewise constantDoubleUnaryOperator\( f : \mathbb{R} \rightarrow \mathbb{R} \). -
Method Summary
Modifier and TypeMethodDescriptionGet the value of this function \( f \) at the given argument.doubleapplyAsDouble(double operand)Get the value of this unary operator \( f \) at the given argument.doublegetIntegral(double lowerBound, double upperBound)Get the integral \( \int_{a}^{b} f(x) dx \) of this function \( f \) for given bounds \( a, b \).doublegetIntegral(double lowerBound, double upperBound, DoubleUnaryOperator operator)Get the integral \( \int_{a}^{b} g(f(x)) dx \) of this function \( f \) plugged into a given function \( g \) for given bounds \( a, b \).doublegetIntegral(double lowerBound, double upperBound, Function<Double,Double> operator)Get the integral \( \int_{a}^{b} g(f(x)) dx \) of this function \( f \) plugged into a given function \( g \) for given bounds \( a, b \).Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.function.DoubleUnaryOperator
andThen, compose
-
Constructor Details
-
PiecewiseContantDoubleUnaryOperator
public PiecewiseContantDoubleUnaryOperator(double[] intervalRightPoints, double[] values)Construct a piecewise constantDoubleUnaryOperator\( f : \mathbb{R} \rightarrow \mathbb{R} \).- Parameters:
intervalRightPoints- Array of length \( n \) with the right hand points \( x_{i} \) of the intervals \( (x_{i-1},x_{i}] \) on which we have values.values- Array of length \( n+1 \) with the values \( f_{i} \) on the intervals \( (x_{i-1},x_{i}] \) where:- the first value \( f_{0} \) in this array corresponds to the value on \( (-\infty,x_{0}] \)
- the last value \( f_{n} \) in this array corresponds to the value on \( (x_{n-1},\infty) \)
-
PiecewiseContantDoubleUnaryOperator
Construct a piecewise constantDoubleUnaryOperator\( f : \mathbb{R} \rightarrow \mathbb{R} \).- Parameters:
intervalRightPoints- List of length \( n \) with the right hand points \( x_{i} \) of the intervals \( (x_{i-1},x_{i}] \) on which we have values.values- List of length \( n+1 \) with the values \( f_{i} \) on the intervals \( (x_{i-1},x_{i}] \) where:- the first value \( f_{0} \) in this array corresponds to the value on \( (-\infty,x_{0}] \)
- the last value \( f_{n} \) in this array corresponds to the value on \( (x_{n-1},\infty) \)
-
-
Method Details
-
getIntegral
Get the integral \( \int_{a}^{b} g(f(x)) dx \) of this function \( f \) plugged into a given function \( g \) for given bounds \( a, b \).- Parameters:
lowerBound- The lower bound a.upperBound- The upper bound b.operator- The given function g.- Returns:
- The integral \( \int_{a}^{b} g(f(x)) dx \).
-
getIntegral
Get the integral \( \int_{a}^{b} g(f(x)) dx \) of this function \( f \) plugged into a given function \( g \) for given bounds \( a, b \).- Parameters:
lowerBound- The lower bound a.upperBound- The upper bound b.operator- The given function g.- Returns:
- The integral \( \int_{a}^{b} g(f(x)) dx \).
-
getIntegral
public double getIntegral(double lowerBound, double upperBound)Get the integral \( \int_{a}^{b} f(x) dx \) of this function \( f \) for given bounds \( a, b \).- Parameters:
lowerBound- The lower bound a.upperBound- The upper bound b.- Returns:
- The integral \( \int_{a}^{b} f(x) dx \).
-
applyAsDouble
public double applyAsDouble(double operand)Get the value of this unary operator \( f \) at the given argument.- Specified by:
applyAsDoublein interfaceDoubleUnaryOperator- Parameters:
operand- The given argument.- Returns:
- The value \( f(x) \).
-
apply
Get the value of this function \( f \) at the given argument.
-