|
Contents | Previous | Next | Subchapters |
| Syntax |
cendiff(function f, x, h) |
| See Also | fordiff |
h(j) is 0,
partials with respect to x(j) are not approximated and 0
is returned in the corresponding column of the Jacobian.
A matrix function J(x)
is the Jacobian of a column vector function f(x)
if the (i,j) element of J(x)
is the partial of the
ith element of f(x)
with respect to the
jth element of x.
Given a real or double precision vector with the same dimension
as x, the function f returns a real,
double-precision, or complex column vector.
The return value of cendiff
has the type that results from
coercion
between the type of x, h and f(x).
It has the same number of rows as
f(x) and its column dimension is equal to the length of
x.
The functions
cendiff and fordiff
can be used to
approximate derivatives for an optimization or zero-finding algorithm.
The cendiff function is more accurate,
but it requires more function evaluations.
function f(x) begin
return x^2
end
x = 1.
h = .1
cendiff(function f, x, h)
returns
2