Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inverse sign of off-diagonal Hessian elements #31

Closed
Konjkov opened this issue Jan 12, 2014 · 2 comments
Closed

Inverse sign of off-diagonal Hessian elements #31

Konjkov opened this issue Jan 12, 2014 · 2 comments

Comments

@Konjkov
Copy link

Konjkov commented Jan 12, 2014

Formula for off-diagonal Hessian elements in /src/bin/findif/fd_geoms_freq_0.cc has inverse sing:
3-point - off-diagonal
O(1/h^2): new-way: [f(1,1)+f(-1,-1)+2f(0,0) -f(1,0) -f(-1,0) -f(0,1) -f(0,-1)]/(2h^2)
Implementation is the same.
But off-diagonal elements of the Hessian matrix (cross-derivatives) is:
[f(1,0) + f(-1,0) - f(1,1) - f(0,0)] + [f(0,1) + f(0,-1) - f(-1,-1) - f(0,0)]/(2h^2)
with a negative sign at f(0,0).
Does it mean that off-diagonal Hessian elements are calculated and stored with an opposite sign? or it is an issue?

@psi-rking
Copy link
Contributor

The 3-point coded formula is correct. I confirmed it analytically and with the 5-point formula for the analytic function f(x,y) = x y^2 at point (2,3). Off-diagonal second derivative is +6.

@Konjkov
Copy link
Author

Konjkov commented Jan 13, 2014

Thanks for the exact answer. I found a mistake in my equation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants