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

Disallow second_derivative and hessian functions to be called without g #18

Open
eriktaubeneck opened this issue Aug 20, 2013 · 1 comment

Comments

@eriktaubeneck
Copy link
Contributor

Currently, derivative.jl has the two following definintions

second_derivative(f::Function) = second_derivative(f, derivative(f), :scalar, :central)
hessian(f::Function) = second_derivative(f, gradient(f), :vector, :central)

however we discussed that by estimating the first derivative to hand to the second derivative is error prone and subject to possibly large round off error.

I think it's simple enough for a user to input second_derivavitve(f,derivative(f)) explicitly if they want to take this risk.

Thoughts?
@johnmyleswhite

@ivarne
Copy link
Collaborator

ivarne commented Aug 20, 2013

I think it is good to remove functions with poor mathematical properties, especially when it is so simple to write the full version which makes it clear what is happening, and that the accuracy might be bad.

Should the ctranspose alias that allows sin'''(x) should be warned against in the documentation, or removed? Differentiating several times with finitie_difference gets very inaccurate quickly, and when ' is chained the resulting algorithm is very bad because eps is the same for each order.

Would it be reasonable to reserve the ' marker for algorithmic differentiation if someone will implement algorithmic differentiation of functions by reading the AST. Then it can be applied multiple times without losing accuracy. It might be convenient and improve readability if you can write sin'(x) instead of cos(x)

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