## Interface DoubleFunction1D

• All Superinterfaces:
DoubleUnaryOperator
All Known Implementing Classes:
RealPolynomialFunction1D

public interface DoubleFunction1D
extends DoubleUnaryOperator
Defines a family of functions that take real arguments and return real values. The functionality of Function is extended; this class allows arithmetic operations on functions and defines a derivative function.
• ### Method Summary

All Methods
Modifier and Type Method Description
default DoubleFunction1D add​(double a)
For a DoubleFunction1D $g(x)$, adding a constant $a$ returns the function $h(x) = g(x) + a$.
default DoubleFunction1D add​(DoubleFunction1D f)
For a DoubleFunction1D $g(x)$, adding a function $f(x)$ returns the function $h(x) = f(x) + g(x)$.
default DoubleFunction1D derivative()
Returns a function that calculates the first derivative.
default DoubleFunction1D derivative​(FiniteDifferenceType differenceType, double eps)
Returns a function that calculates the first derivative.
default DoubleFunction1D divide​(double a)
For a DoubleFunction1D $g(x)$, dividing by a constant $a$ returns the function $h(x) = \frac{g(x)}{a}$.
default DoubleFunction1D divide​(DoubleFunction1D f)
For a DoubleFunction1D $g(x)$, dividing by a function $f(x)$ returns the function $h(x) = \frac{g(x)}{f(x)}$.
static DoubleFunction1D from​(Function<Double,​Double> f)
Converts a Function<Double, Double> into a DoubleFunction1D.
default DoubleFunction1D multiply​(double a)
For a DoubleFunction1D $g(x)$, multiplying by a constant $a$ returns the function $h(x) = a g(x)$.
default DoubleFunction1D multiply​(DoubleFunction1D f)
For a DoubleFunction1D $g(x)$, multiplying by a function $f(x)$ returns the function $h(x) = f(x) g(x)$.
default DoubleFunction1D subtract​(double a)
For a DoubleFunction1D $g(x)$, subtracting a constant $a$ returns the function $h(x) = g(x) - a$.
default DoubleFunction1D subtract​(DoubleFunction1D f)
For a DoubleFunction1D $g(x)$, subtracting a function $f(x)$ returns the function $h(x) = f(x) - g(x)$.
• ### Methods inherited from interface java.util.function.DoubleUnaryOperator

andThen, applyAsDouble, compose
• ### Method Detail

• #### derivative

default DoubleFunction1D derivative()
Returns a function that calculates the first derivative.

The method used is central finite difference, with $\epsilon = 10^{-5}$. Implementing classes can override this method to return a function that is the exact functional representation of the first derivative.

Returns:
a function that calculates the first derivative of this function
• #### derivative

default DoubleFunction1D derivative​(FiniteDifferenceType differenceType,
double eps)
Returns a function that calculates the first derivative. The method used is finite difference, with the differencing type and $\epsilon$ as arguments.
Parameters:
differenceType - the differencing type to use
eps - the $\epsilon$ to use
Returns:
a function that calculates the first derivative of this function

default DoubleFunction1D add​(DoubleFunction1D f)
For a DoubleFunction1D $g(x)$, adding a function $f(x)$ returns the function $h(x) = f(x) + g(x)$.
Parameters:
f - the function to add
Returns:
a function $h(x) = f(x) + g(x)$

default DoubleFunction1D add​(double a)
For a DoubleFunction1D $g(x)$, adding a constant $a$ returns the function $h(x) = g(x) + a$.
Parameters:
a - the constant to add
Returns:
a function $h(x) = g(x) + a$
• #### divide

default DoubleFunction1D divide​(DoubleFunction1D f)
For a DoubleFunction1D $g(x)$, dividing by a function $f(x)$ returns the function $h(x) = \frac{g(x)}{f(x)}$.
Parameters:
f - the function to divide by
Returns:
a function $h(x) = \frac{f(x)}{g(x)}$
• #### divide

default DoubleFunction1D divide​(double a)
For a DoubleFunction1D $g(x)$, dividing by a constant $a$ returns the function $h(x) = \frac{g(x)}{a}$.
Parameters:
a - the constant to add
Returns:
a function $h(x) = \frac{g(x)}{a}$
• #### multiply

default DoubleFunction1D multiply​(DoubleFunction1D f)
For a DoubleFunction1D $g(x)$, multiplying by a function $f(x)$ returns the function $h(x) = f(x) g(x)$.
Parameters:
f - the function to multiply by
Returns:
a function $h(x) = f(x) g(x)$
• #### multiply

default DoubleFunction1D multiply​(double a)
For a DoubleFunction1D $g(x)$, multiplying by a constant $a$ returns the function $h(x) = a g(x)$.
Parameters:
a - the constant to add
Returns:
a function $h(x) = a g(x)$
• #### subtract

default DoubleFunction1D subtract​(DoubleFunction1D f)
For a DoubleFunction1D $g(x)$, subtracting a function $f(x)$ returns the function $h(x) = f(x) - g(x)$.
Parameters:
f - the function to subtract
Returns:
a function $h(x) = g(x) - f(x)$
• #### subtract

default DoubleFunction1D subtract​(double a)
For a DoubleFunction1D $g(x)$, subtracting a constant $a$ returns the function $h(x) = g(x) - a$.
Parameters:
a - the constant to add
Returns:
a function $h(x) = g(x) - a$
• #### from

static DoubleFunction1D from​(Function<Double,​Double> f)
Converts a Function<Double, Double> into a DoubleFunction1D.
Parameters:
f - the function to convert
Returns:
the converted function