Man Scilab

numdiff
Scilab Function

numdiff - numerical gradient estimation

Calling Sequence

g=numdiff(fun,x [,dx])

Parameters

Description

given a function fun(x) from R^n to R^p computes the matrix g such as


    [   d f    ]
    [      i   ]
g = [   ----   ]
 ij [   d x    ]
    [      j   ]
   
    

using finite difference methods.

The function fun calling sequence must be y=fun(x,p1,p2,..pn) .If parameters p1,p2,..pn exist then numdiff can be called as follow g=numdiff(list(fun,p1,p2,..pn),x).

Examples


function  f=myfun(x,y,z,t)
f=(x+y)^t+z
endfunction

y=3;z=4;t=2;
g=numdiff(list(myfun,3,4,2),1)

x=1;
exact=t*(x+y)^(t-1)
 
  

See Also

optim ,  

Back