Package ffx.numerics.switching
Class PowerSwitch
java.lang.Object
ffx.numerics.switching.PowerSwitch
- All Implemented Interfaces:
UnivariateDiffFunction,UnivariateSwitchingFunction
A PowerSwitch interpolates between 0 and 1 vi f(x) = (ax)^beta, where x must be between 0 and
1/a.
- Author:
- Jacob M. Litman, Michael J. Schnieders
-
Constructor Summary
ConstructorsConstructorDescriptionDefault Constructor of the PowerSwitch: constructs a linear switch.PowerSwitch(double a, double beta) Constructor of the PowerSwitch. -
Method Summary
Modifier and TypeMethodDescriptionbooleanRemains 0 below the lower bound, and 1 above the upper bound (i.e. a multiplicative switch).doublefirstDerivative(double x) First derivative at a point.doubleGets the value of beta in f(x) = (a*x)^betaintThe highest-order derivative that is zero at the bounds.doubleGets the value of a in f(x) = (a*x)^beta.doubleGets the one bound, where f(x) becomes one.doubleGets the zero bound, where f(x) becomes zero.intPower switch derivatives can be zero at the zero bound if the exponent is greater than the derivative order.doublenthDerivative(double x, int order) N'th order derivative at a point.doublesecondDerivative(double x) Second derivative at a point.booleanTrue if f(lb + delta) + f(ub - delta) = 1 for all delta between 0 and (ub - lb).toString()booleanRemains in the range 0-1 outside the bounds.doublevalueAt(double x) Value at a point
-
Constructor Details
-
PowerSwitch
public PowerSwitch()Default Constructor of the PowerSwitch: constructs a linear switch. -
PowerSwitch
public PowerSwitch(double a, double beta) Constructor of the PowerSwitch.- Parameters:
a- The upper bound of the switch is 1.0 / a.beta- The power of the function f(x) = (ax)^beta,
-
-
Method Details
-
constantOutsideBounds
public boolean constantOutsideBounds()Remains 0 below the lower bound, and 1 above the upper bound (i.e. a multiplicative switch).- Specified by:
constantOutsideBoundsin interfaceUnivariateSwitchingFunction- Returns:
- df(x)/dx is zero outside range lb-ub.
-
firstDerivative
First derivative at a point.- Specified by:
firstDerivativein interfaceUnivariateDiffFunction- Parameters:
x- a double.- Returns:
- f'(x)
- Throws:
IllegalArgumentException- If f'(x) is undefined at x.
-
getExponent
public double getExponent()Gets the value of beta in f(x) = (a*x)^beta- Returns:
- Exponent of input
-
getHighestOrderZeroDerivative
public int getHighestOrderZeroDerivative()The highest-order derivative that is zero at the bounds.- Specified by:
getHighestOrderZeroDerivativein interfaceUnivariateSwitchingFunction- Returns:
- Maximum order zero derivative at bounds.
-
getMultiplier
public double getMultiplier()Gets the value of a in f(x) = (a*x)^beta.- Returns:
- Multiplier of input
-
getOneBound
public double getOneBound()Gets the one bound, where f(x) becomes one.- Specified by:
getOneBoundin interfaceUnivariateSwitchingFunction- Returns:
- One bound
-
getZeroBound
public double getZeroBound()Gets the zero bound, where f(x) becomes zero.- Specified by:
getZeroBoundin interfaceUnivariateSwitchingFunction- Returns:
- Zero bound
-
highestOrderZeroDerivativeAtZeroBound
public int highestOrderZeroDerivativeAtZeroBound()Power switch derivatives can be zero at the zero bound if the exponent is greater than the derivative order.- Specified by:
highestOrderZeroDerivativeAtZeroBoundin interfaceUnivariateSwitchingFunction- Returns:
- the highest order zero derivative at zero bound
-
nthDerivative
N'th order derivative at a point. Should be relatively optional for any order above 2.- Specified by:
nthDerivativein interfaceUnivariateDiffFunction- Parameters:
x- a double.order- Derivative order (>= 1)- Returns:
- d^nf(x)/dx^n
- Throws:
IllegalArgumentException- If derivative undefined at x.
-
secondDerivative
Second derivative at a point.- Specified by:
secondDerivativein interfaceUnivariateDiffFunction- Parameters:
x- a double.- Returns:
- f''(x)
- Throws:
IllegalArgumentException- If f''(x) is undefined at x.
-
symmetricToUnity
public boolean symmetricToUnity()True if f(lb + delta) + f(ub - delta) = 1 for all delta between 0 and (ub - lb). For example, a power switch with beta 1 is symmetric to unity, as f(l) + f(1-l) = 1, but beta 2 produces a non-unity result, where f(0.5) + f(0.5) = 0.5.- Specified by:
symmetricToUnityin interfaceUnivariateSwitchingFunction- Returns:
- If symmetry produces unity result.
-
toString
-
validOutsideBounds
public boolean validOutsideBounds()Remains in the range 0-1 outside the bounds. Implied to be true if constantOutsideBounds is true.- Specified by:
validOutsideBoundsin interfaceUnivariateSwitchingFunction- Returns:
- min(f ( x)) = 0 and max(f(x)) = 1.
-
valueAt
Value at a point- Specified by:
valueAtin interfaceUnivariateDiffFunction- Parameters:
x- a double.- Returns:
- f(x)
- Throws:
IllegalArgumentException- If f(x) is undefined at x.
-