Skip to content

incorrect 2nd derivative of complex exponential #653

@stevengj

Description

@stevengj

This, from discourse, looks like a bug:

julia> p(s) = exp(1im*(2π*s - π/2));

julia> p′(s) = ForwardDiff.derivative(p, s);

julia> p″(s) = ForwardDiff.derivative(p′, s);

julia> p″(0.2499999999999)
-39.47841760435743 + 2.4807694081270598e-11im

julia> p″(0.25)
0.0 + 0.0im

I don't think mere floating-point error can explain why p″(0.25) is suddenly zero — looks like a misplaced conditional or something. Note that the correct answer for p″(0.25) is exactly -(2π)² ≈ -39.47841760435743.

(The first derivative p′ looks okay.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions