Skip to content

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

Description

@astrozot

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions