Class SmoothStepFactory.SmoothStepFunction
- java.lang.Object
-
- org.hipparchus.analysis.polynomials.PolynomialFunction
-
- org.hipparchus.analysis.polynomials.SmoothStepFactory.SmoothStepFunction
-
- All Implemented Interfaces:
Serializable
,UnivariateDifferentiableFunction
,FieldUnivariateFunction
,UnivariateFunction
- Direct Known Subclasses:
SmoothStepFactory.QuadraticSmoothStepFunction
- Enclosing class:
- SmoothStepFactory
public static class SmoothStepFactory.SmoothStepFunction extends PolynomialFunction
Smoothstep function as defined here.It is used to do a smooth transition between the "left edge" and the "right edge" with left edge assumed to be smaller than right edge.
By definition, for order n greater than 1 and input x, a smoothstep function respects at least the following properties :
- f(x <= leftEdge) = 0 and f(x >= rightEdge) = 1
- f'(leftEdge) = f'(rightEdge) = 0
- f(x <= 0) = 0 and f(x >= 1) = 1
- f'(0) = f'(1) = 0
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.hipparchus.analysis.polynomials.PolynomialFunction
PolynomialFunction.Parametric
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkInputEdges(double leftEdge, double rightEdge)
Check that left edge is lower than right edge.protected double
clampInput(double leftEdge, double rightEdge, double x)
Clamp input between edges.protected double
normalizeInput(double leftEdge, double rightEdge, double x)
Normalize input between left and right edges.double
value(double xNormalized)
Compute the value of the smoothstep for the given argument normalized between edges.double
value(double leftEdge, double rightEdge, double x)
Compute the value of the smoothstep function for the given edges and argument.-
Methods inherited from class org.hipparchus.analysis.polynomials.PolynomialFunction
add, antiDerivative, degree, differentiate, equals, evaluate, getCoefficients, hashCode, integrate, multiply, negate, polynomialDerivative, subtract, toString, value
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.hipparchus.analysis.FieldUnivariateFunction
toCalculusFieldUnivariateFunction
-
-
-
-
Method Detail
-
value
public double value(double xNormalized)
Compute the value of the smoothstep for the given argument normalized between edges.- Specified by:
value
in interfaceUnivariateFunction
- Overrides:
value
in classPolynomialFunction
- Parameters:
xNormalized
- Normalized argument for which the function value should be computed. It is expected to be between [0:1] and will throw an exception otherwise.- Returns:
- the value of the polynomial at the given point.
- See Also:
UnivariateFunction.value(double)
-
value
public double value(double leftEdge, double rightEdge, double x) throws MathIllegalArgumentException
Compute the value of the smoothstep function for the given edges and argument.Note that right edge is expected to be greater than left edge. It will throw an exception otherwise.
- Parameters:
leftEdge
- left edgerightEdge
- right edgex
- Argument for which the function value should be computed- Returns:
- the value of the polynomial at the given point
- Throws:
MathIllegalArgumentException
- if right edge is greater than left edge- See Also:
UnivariateFunction.value(double)
-
checkInputEdges
protected void checkInputEdges(double leftEdge, double rightEdge)
Check that left edge is lower than right edge. Otherwise, throw an exception.- Parameters:
leftEdge
- left edgerightEdge
- right edge
-
clampInput
protected double clampInput(double leftEdge, double rightEdge, double x)
Clamp input between edges.- Parameters:
leftEdge
- left edgerightEdge
- right edgex
- input to clamp- Returns:
- clamped input
-
normalizeInput
protected double normalizeInput(double leftEdge, double rightEdge, double x)
Normalize input between left and right edges.- Parameters:
leftEdge
- left edgerightEdge
- right edgex
- input to normalize- Returns:
- normalized input
-
-