umontreal.iro.lecuyer.functions
Class PowerMathFunction
- java.lang.Object
-
- umontreal.iro.lecuyer.functions.PowerMathFunction
-
- All Implemented Interfaces:
- MathFunction, MathFunctionWithFirstDerivative
public class PowerMathFunction extends java.lang.Object implements MathFunction, MathFunctionWithFirstDerivative
Represents a function computing (af (x) + b)p for a user-defined function f (x) and power p.
-
-
Constructor Summary
Constructors Constructor and Description PowerMathFunction(MathFunction func, double power)Constructs a new power function for function func and power power.PowerMathFunction(MathFunction func, double a, double b, double power)Constructs a new power function for function func, power power, and constants a and b.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublederivative(double x)Computes (or estimates) the first derivative of the function at point x.doubleevaluate(double x)Returns the value of the function evaluated at x.doublegetA()Returns the value of a.doublegetB()Returns the value of b.MathFunctiongetFunction()Returns the function f (x).doublegetPower()Returns the power p.
-
-
-
Constructor Detail
-
PowerMathFunction
public PowerMathFunction(MathFunction func, double power)
Constructs a new power function for function func and power power. The values of the constants are a = 1 and b = 0.- Parameters:
func- the function f (x).power- the power p.
-
PowerMathFunction
public PowerMathFunction(MathFunction func, double a, double b, double power)
Constructs a new power function for function func, power power, and constants a and b.- Parameters:
func- the function f (x).power- the power p.a- the multiplicative constant.b- the additive constant.
-
-
Method Detail
-
getFunction
public MathFunction getFunction()
Returns the function f (x).- Returns:
- the function.
-
getA
public double getA()
Returns the value of a.- Returns:
- the value of a.
-
getB
public double getB()
Returns the value of b.- Returns:
- the value of b.
-
getPower
public double getPower()
Returns the power p.- Returns:
- the power.
-
derivative
public double derivative(double x)
Description copied from interface:MathFunctionWithFirstDerivativeComputes (or estimates) the first derivative of the function at point x.- Specified by:
derivativein interfaceMathFunctionWithFirstDerivative- Parameters:
x- the point to evaluate the derivative to.- Returns:
- the value of the derivative.
-
evaluate
public double evaluate(double x)
Description copied from interface:MathFunctionReturns the value of the function evaluated at x.- Specified by:
evaluatein interfaceMathFunction- Parameters:
x- value at which the distribution function is evaluated- Returns:
- function evaluated at x
-
-
DMelt 3.0 © DataMelt by jWork.ORG