SSJ  3.3.1
Stochastic Simulation in Java
Public Member Functions | List of all members
MultivariateFunction Interface Reference

Represents a function of multiple variables. More...

Inheritance diagram for MultivariateFunction:
[legend]

Public Member Functions

int getDimension ()
 Returns \(d\), the dimension of the function computed by this implementation. More...
 
double evaluate (double... x)
 Computes the function \(g(\mathbf{x})\) for the vector x. More...
 
double evaluateGradient (int i, double... x)
 Computes \(\partial g(\mathbf{x})/\partial x_i\), the derivative of \(g(\mathbf{x})\) with respect to \(x_i\). More...
 

Detailed Description

Represents a function of multiple variables.

This interface specifies a method evaluate that computes a \(g(\mathbf{x})\) function, where \(\mathbf{x}=(x_0,…,x_{d-1})\in\mathbb{R}^d\). It also specifies a method evaluateGradient for computing its gradient \(\nabla g(\mathbf{x})\).

The dimension \(d\) can be fixed or variable. When \(d\) is fixed, the methods specified by this interface always take the same number of arguments. This is the case, for example, with a ratio of two variables. When \(d\) is variable, the implementation can compute the function for a vector \(\mathbf{x}\) of any length. This can happen for a product or sum of variables.

The methods of this interface take a variable number of arguments to accomodate the common case of fixed dimension with more convenience; the programmer can call the method without creating an array. For the generic case, however, one can replace the arguments with an array.

Member Function Documentation

◆ evaluate()

double evaluate ( double...  x)

Computes the function \(g(\mathbf{x})\) for the vector x.

The length of the given array must correspond to the dimension of this function. The method must compute and return the result of the function without modifying the elements in x since the array can be reused for further computation.

Parameters
xa vector \(\mathbf{x}\).
Returns
the value of \(g(\mathbf{x})\).
Exceptions
NullPointerExceptionif x is null.
IllegalArgumentExceptionif x.length does not correspond to the dimension of this function.

Implemented in RatioFunction.

◆ evaluateGradient()

double evaluateGradient ( int  i,
double...  x 
)

Computes \(\partial g(\mathbf{x})/\partial x_i\), the derivative of \(g(\mathbf{x})\) with respect to \(x_i\).

The length of the given array must correspond to the dimension of this function. The method must compute and return the result of the derivative without modifying the elements in x since the array can be reused for further computations, e.g., the gradient \(\nabla g(\mathbf{x})\).

Parameters
ithe variable to derive with respect to.
xa vector \(\mathbf{x}\).
Returns
the value of the partial derivative.
Exceptions
NullPointerExceptionif x is null.
IllegalArgumentExceptionif x.length does not correspond to the dimension of this function.
IndexOutOfBoundsExceptionif i is negative or greater than or equal to the dimension of this function.

Implemented in RatioFunction.

◆ getDimension()

int getDimension ( )

Returns \(d\), the dimension of the function computed by this implementation.

If the dimension is not fixed, this method must return a negative value.

Returns
the dimension.

Implemented in RatioFunction.


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