Hessian Matrix 2 variables numerical method

2.8k Views Asked by At

I have a $\mathbb{R}^2\to \mathbb{R}$ function f and I only know 9 points

       x-h1   x   x+h1
 y-h2   a     d    g
  y     b     e    h
 y+h2   c     f    i

I can calculate $\frac{df'}{dx}$, $\frac{df'}{dy}$, $\frac{df''}{dxx}$ and $\frac{df''}{dyy}$ using 3 point central numerical analysis formula, but don't know how to calculate the $\frac{df''}{dxy}$ and $\frac{df''}{dyx}$. My objetive is calculate the hessian matrix on central point $(x,y)$.

Can anyone help?

Thanks

1

There are 1 best solutions below

0
On BEST ANSWER

So you have the formula $df/dx = (h-b)/(2h_1)$ at $(x,y)$, right? You can apply the same formula to get $df/dx = (i-c)/(2h_1)$ at $(x,y+h_2)$, and also $df/dx = (g-a)/(2h_1)$ at $(x,y-h_2)$. This is good, because to approximate the $d/dy$ operator what we want is values at $y+h_2$ and $y-h_2$. So that's what we do -- apply the $d/dy$ operator to our formula for $df/dx$: $$ \begin{align} \frac{d^2f}{dydx} &= \frac{1}{2h_2}\left(\frac{i-c}{2h_1}-\frac{g-a}{2h_1}\right) \\ &= \frac{a-g-c+i}{4h_1h_2} \end{align} $$ at $(x,y)$. The formula for $d^2f/dxdy$ had better come out the same since mixed partial derivatives are equal (assuming the functions are sufficiently smooth to warrant finite difference approximation in the first place!). It would be a good exercise to verify that it is, in fact, equal.