public class FiniteDifference extends java.lang.Object implements RealScalarFunction
Function.EvaluationException| Constructor and Description |
|---|
FiniteDifference(RealScalarFunction f,
int[] varidx)
Construct the partial derivative of a multi-variable function.
|
| Modifier and Type | Method and Description |
|---|---|
int |
dimensionOfDomain()
Get the number of variables the function has.
|
int |
dimensionOfRange()
Get the dimension of the range space of the function.
|
java.lang.Double |
evaluate(Vector x)
Evaluate numerically the partial derivative of f at point x.
|
double |
evaluate(Vector x,
double h)
Evaluate numerically the partial derivative of f at point x with step size h.
|
public FiniteDifference(RealScalarFunction f, int[] varidx)
varidx = new int[]{1, 2} means
\[
f_{x_1,x_2} = {\partial^2 \over \partial x_1 \partial x_2} = {\partial \over \partial x_2}({\partial \over \partial x_1})
\]f - the real multivariate function to take derivative ofvaridx - the variable indices of the derivative, counting from 1 up to the domain dimension of fpublic java.lang.Double evaluate(Vector x)
evaluate in interface Function<Vector,java.lang.Double>x - the point to evaluate the derivative atpublic double evaluate(Vector x, double h)
x - the point to evaluate the derivative of f ath - the step sizepublic int dimensionOfDomain()
FunctiondimensionOfDomain in interface Function<Vector,java.lang.Double>public int dimensionOfRange()
FunctiondimensionOfRange in interface Function<Vector,java.lang.Double>