SSJ
V. 2.6.2.

umontreal.iro.lecuyer.functions
Class AverageMathFunction

java.lang.Object
  extended by umontreal.iro.lecuyer.functions.AverageMathFunction
All Implemented Interfaces:
MathFunction, MathFunctionWithDerivative, MathFunctionWithFirstDerivative, MathFunctionWithIntegral

public class AverageMathFunction
extends Object
implements MathFunction, MathFunctionWithFirstDerivative, MathFunctionWithDerivative, MathFunctionWithIntegral

Represents a function computing the average of several functions. Let f0(x),…, fn-1(x) be a set of n functions. This function represents the average

f (x) = $\displaystyle {\frac{1}{n}}$i=0n-1fi(x).


Constructor Summary
AverageMathFunction(MathFunction... func)
          Constructs a function computing the average of the functions in the array func.
 
Method Summary
 double derivative(double x)
          Computes (or estimates) the first derivative of the function at point x.
 double derivative(double x, int n)
          Computes (or estimates) the nth derivative of the function at point x.
 double evaluate(double x)
          Returns the value of the function evaluated at x.
 MathFunction[] getFunctions()
          Returns the functions being averaged.
 double integral(double a, double b)
          Computes (or estimates) the integral of the function over the interval [a, b].
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AverageMathFunction

public AverageMathFunction(MathFunction... func)
Constructs a function computing the average of the functions in the array func.

Parameters:
func - the array of functions to average.
Method Detail

getFunctions

public MathFunction[] getFunctions()
Returns the functions being averaged.

Returns:
the averaged functions.

evaluate

public double evaluate(double x)
Description copied from interface: MathFunction
Returns the value of the function evaluated at x.

Specified by:
evaluate in interface MathFunction
Parameters:
x - value at which the function is evaluated
Returns:
function evaluated at x

derivative

public double derivative(double x,
                         int n)
Description copied from interface: MathFunctionWithDerivative
Computes (or estimates) the nth derivative of the function at point x. For n = 0, this returns the result of evaluate.

Specified by:
derivative in interface MathFunctionWithDerivative
Parameters:
x - the point to evaluate the derivate to.
n - the order of the derivative.
Returns:
the resulting derivative.

derivative

public double derivative(double x)
Description copied from interface: MathFunctionWithFirstDerivative
Computes (or estimates) the first derivative of the function at point x.

Specified by:
derivative in interface MathFunctionWithFirstDerivative
Parameters:
x - the point to evaluate the derivative to.
Returns:
the value of the derivative.

integral

public double integral(double a,
                       double b)
Description copied from interface: MathFunctionWithIntegral
Computes (or estimates) the integral of the function over the interval [a, b].

Specified by:
integral in interface MathFunctionWithIntegral
Parameters:
a - the starting point of the interval.
b - the ending point of the interval.
Returns:
the value of the integral.

SSJ
V. 2.6.2.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.