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

Pull request/149da947 #92

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

RossBoylan
Copy link

#91 partial fix. As noted in the last commit message, there are still quite a few ways to get an asymmetric Hessian.

Ross Boylan added 2 commits June 25, 2016 11:34
This currently fails, though it passes if f5 is uses instead of f6.
There will still be problems if hessian is called with a gradient or
with a symbolic differentiantion type argument.
This solve the bug reported in PR 91, construed narrowly.  That is,
the specific invocation that wasn't work now works; the general
problem of asymmetric Hessians remains.
@RossBoylan
Copy link
Author

The value for the second derivative of the second argument is not very accurate. The hessian in the above test computes a value of 8832.66, but the true value is 8833.06977. I'm not sure what degree of accuracy is reasonable to expect.

I added the following tests (not in the public commits)

# PR 91: Asymmetric Hessian                                                                                                                                                                                             
f6(x) = sin(x[1]^2+3x[2]^4)
h6 = Calculus.hessian(f6, [1.0, 2.0])
@test issym(h6)
g6(x) = [2x[1]*cos(3x[2]^4+x[1]^2), 12x[2]^3*cos(3x[2]^4+x[1]^2)]
h6b = Calculus.hessian(f6, g6, [1.0, 2.0])
@test issym(h6b)
h22 = 8833.06977
@test abs(h6[2,2] - h22) < 10e-4
@test abs(h6b[2,2] - h22) < 10e-4
@test maximum(abs(h6b-h6)) < 10e-4

which show asymmetric result if the gradient is defined, as well as precision failures for the [2,2] term of the hessian. BTW, the [2,2] term computed with the gradient appears correct.

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

Successfully merging this pull request may close these issues.

1 participant