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

Wrong derivative of exp(cos(x)) #294

Open
astrozot opened this issue Jul 29, 2024 · 0 comments
Open

Wrong derivative of exp(cos(x)) #294

astrozot opened this issue Jul 29, 2024 · 0 comments

Comments

@astrozot
Copy link

It seems to me that there is a problem with cos derivatives in composite functions:

julia> D = (f, x) -> AbstractDifferentiation.derivative(DiffractorForwardBackend(), f, x)[1];

julia> D(x -> exp(cos(x)), 1.0)
-1.952024889228184

julia> exp(cos(1.0)) * (-sin(1.0))
-1.4444065708474794

julia> exp(sin(1.0)) * (-sin(1.0))
-1.952024889228184

Surprisingly, everything is OK with sin derivatives:

julia> D(x -> exp(sin(x)), 1.0)
1.253380767493447

julia> exp(sin(1.0)) * cos(1.0)
1.253380767493447
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

1 participant