Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have a generic function $g(x)$ where $x$ is an 6-dimensional vector. Now I want to compute the Hessian of this function for a point $x_0$. What is the most efficient way to do this? Can I do this with finite differences and which formulas do I need?

The diagonal entries are no problem when following the formulas from http://en.wikipedia.org/wiki/Finite_difference, but how the compute the off-diagonal entries?

share|improve this question
add comment

1 Answer 1

You can approximate the entries in the Hessian with finite differences: $$ f_{ij} \doteq \left(f(x_1,x_2,\dots,x_i+h,\dots,x_j+k,\dots,x_n) -f(x_1,x_2,\dots,x_i+h,\dots,x_j,\dots,x_n) -f(x_1,x_2,\dots,x_i,\dots,x_j+k,\dots,x_n) +f(x_1,x_2,\dots,x_i,\dots,x_j,\dots,x_n)\right)/(hk) $$ for small $h,k$.

The formula above is just a finite difference ratio in the $i^\text{th}$ variable combined with a finite difference ratio in the $j^\text{th}$ variable.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.