Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

 Quantlet: nmgraditer Description: Computes the gradient of a function func at a point x0 using Ridders' method of polynomial extrapolation

 Usage: z = nmgraditer(func, x0{, h}) Input: func name of function (string) whose gradient is to be computed. The function should take just one parameter x, which is n x k matrix (k >= 1) x = (x1,x2,...,xk); xi (n x 1 vector; i=1..k) represent points in which the function should be evaluated. As a result, the function should return k real numbers in a form of 1 x k vector. x0 n x 1 vector, the point at which gradient is to be computed h optional n x 1 vector or scalar (in the latter case, h <- h * matrix(n) will be used); vector of initial stepsizes for partial derivatives; (h need not to be very small) default value is 0.001 Output: z.grad n x 1 vector, computed gradient z.err n x 1 vector, estimates of errors of partial derivatives z.hfin n x 1 vector, stepsizes for partial derivatives in last iteration

Example:
```library("nummath")
;
; definition of function f(x) = 1 - x1 + x2^2
;
proc(r)=f(x)
r=1-x[1,]+x[2,]^2
endp
;

```
Result:
```Contents of grad
[1,]       -1
[2,]        4
```
Example:
```library("nummath")
z

```
Result:
```Contents of z.grad
[1,]        1

Contents of z.err
[1,]  3.3307e-16

Contents of z.hfin
[1,]  0.06776
```

Author: L. Cizkova, 20010505 license MD*Tech
(C) MD*TECH Method and Data Technologies, 05.02.2006