SSJ  3.3.1
Stochastic Simulation in Java
Public Member Functions | List of all members
AverageMathFunction Class Reference

Represents a function computing the average of several functions. More...

Inheritance diagram for AverageMathFunction:
[legend]
Collaboration diagram for AverageMathFunction:
[legend]

Public Member Functions

 AverageMathFunction (MathFunction... func)
 Constructs a function computing the average of the functions in the array func. More...
 
MathFunction [] getFunctions ()
 Returns the functions being averaged. More...
 
double evaluate (double x)
 Returns the value of the function evaluated at \(x\). More...
 
double derivative (double x, int n)
 Computes (or estimates) the \(n\)th derivative of the function at point x. More...
 
double derivative (double x)
 Computes (or estimates) the first derivative of the function at point x. More...
 
double integral (double a, double b)
 Computes (or estimates) the integral of the function over the interval \([a, b]\). More...
 

Detailed Description

Represents a function computing the average of several functions.

Let \(f_0(x), …, f_{n-1}(x)\) be a set of \(n\) functions. This function represents the average

\[ f(x)=\frac{1}{n}\sum_{i=0}^{n-1} f_i(x). \]

Constructor & Destructor Documentation

◆ AverageMathFunction()

AverageMathFunction ( MathFunction...  func)

Constructs a function computing the average of the functions in the array func.

Parameters
functhe array of functions to average.

Member Function Documentation

◆ derivative() [1/2]

double derivative ( double  x,
int  n 
)

Computes (or estimates) the \(n\)th derivative of the function at point x.

For \(n=0\), this returns the result of umontreal.ssj.functions.MathFunction.evaluate(double).

Parameters
xthe point to evaluate the derivate to.
nthe order of the derivative.
Returns
the resulting derivative.
Exceptions
IllegalArgumentExceptionif n is negative or 0.

Implements MathFunctionWithDerivative.

◆ derivative() [2/2]

double derivative ( double  x)

Computes (or estimates) the first derivative of the function at point x.

Parameters
xthe point to evaluate the derivative to.
Returns
the value of the derivative.

Implements MathFunctionWithFirstDerivative.

◆ evaluate()

double evaluate ( double  x)

Returns the value of the function evaluated at \(x\).

Parameters
xvalue at which the function is evaluated
Returns
function evaluated at x

Implements MathFunction.

◆ getFunctions()

MathFunction [] getFunctions ( )

Returns the functions being averaged.

Returns
the averaged functions.

◆ integral()

double integral ( double  a,
double  b 
)

Computes (or estimates) the integral of the function over the interval \([a, b]\).

Parameters
athe starting point of the interval.
bthe ending point of the interval.
Returns
the value of the integral.

Implements MathFunctionWithIntegral.


The documentation for this class was generated from the following file: