Skip to content

Consider renaming realpart to value or primalpart or similar #81

@jwscook

Description

@jwscook

This package works a treat for evaluating the derivative functions at complex locations:

julia> using DualNumbers

julia> f(x) = (1, -2 *x) .* exp(-x^2) # value and derivative
f (generic function with 1 method)

julia> z = 1.0 + im # some complex location to evaluate the derivative
1.0 + 1.0im

julia> f(z)
(-0.4161468365471424 - 0.9092974268256817im, -0.9863011805570786 + 2.650888526745648im)

julia> realpart(f(Dual(z, 1))[1])
-0.4161468365471424 - 0.9092974268256817im

julia> dualpart(f(Dual(z, 1))[1])
-0.9863011805570786 + 2.650888526745648im

In this instance, realpart returns a complex value, which is a little misleading. @goretkin suggested in Slack that primalpart could be a better adjective. Any thoughts?

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