Compute Hessian analytically