From: Anh Ngoc LAI on 16 Jan 2010 06:13 Dear all, I have to calculate the numerical hessian matrix of a numerical defined function. So i use two time ND, but the result seems to me that is not correct. Let take the function as f(x,y), and the hessian matrix at point (1,1) will be: (1) ND[f[x,1],{x,2},1] (2) ND[f[1,y],{y,2},1] and (3) ND[ND[f[x,y],{x,1},1],{y,1},1] But it seems that the result given by (3) is not right, so that i can not go further. Any suggestion will be very helpful. Thanks. LAI.
From: Roman on 17 Jan 2010 07:12 Lai, you could make use of the fact that the cross derivative can be calculated from ND[f[t,t],{t,2},1]: XX = ND[f[x,1],{x,2},1] YY = ND[f[1,y],{y,2},1] XY = (ND[f[t,t],{t,2},1]-XX-YY)/2 Cheers! Roman.
From: dh on 18 Jan 2010 05:40 Hi, as long as the derivatives are continuous there should be no difference between fxy and fyx. Therefore, it is not clear why ND should not give the correct result for the mixed derivative. Maybe your function does not behave properly? Can you give a simple example? Daniel Anh Ngoc LAI wrote: > Dear all, > > I have to calculate the numerical hessian matrix of a numerical defined function. So i use two time ND, but the result seems to me that is not correct. > > Let take the function as f(x,y), and the hessian matrix at point (1,1) will be: > > (1) ND[f[x,1],{x,2},1] > > (2) ND[f[1,y],{y,2},1] > > and > > (3) ND[ND[f[x,y],{x,1},1],{y,1},1] > > But it seems that the result given by (3) is not right, so that i can not go further. > > Any suggestion will be very helpful. > > Thanks. > > LAI. >
|
Pages: 1 Prev: Question about Mathematica Next: First function debug help |