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?
This package works a treat for evaluating the derivative functions at complex locations:
In this instance,
realpart
returns a complex value, which is a little misleading. @goretkin suggested in Slack thatprimalpart
could be a better adjective. Any thoughts?