Contents | Previous | Next | Subchapters |

Syntax |
`cendiff(function ` f`, ` x`, ` h`)` |

See Also | fordiff |

Returns the central difference approximation for the Jacobian of

*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
*i*

th element of *f*(*x*)

with respect to the
*j*

th element of *x*

.

Given a real or double precision vector with the same dimension
as `cendiff`

has the type that results from
coercion
between the type of *f*(*x*)

.
It has the same number of rows as
*f*(*x*)

and its column dimension is equal to the length of

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