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

Root finding fails for functions with complex numbers #147

Open
dpsanders opened this issue Feb 19, 2020 · 4 comments
Open

Root finding fails for functions with complex numbers #147

dpsanders opened this issue Feb 19, 2020 · 4 comments
Labels

Comments

@dpsanders
Copy link
Member

julia> g(x) = x^3 + x^2 + 3x + im

julia> roots(g, Complex(-5..5, -5..5))
promotion of types IntervalRootFinding.Compl{Interval{Float64}} and Complex{Int64} failed to change any arguments
@dpsanders
Copy link
Member Author

julia> IntervalRootFinding.roots(z->z^3 + z^2 + 3z + 1, Complex(-5..5, -5..5))
TypeError: non-boolean (Interval{Float64}) used in boolean context

@hongchengni
Copy link

Support. It would be great if complex root finding is supported.

@dpsanders
Copy link
Member Author

Since we can extract the Jacobian matrix of the pair of real functions (realpart, imagpart) from the complex derivative, it should be enough to provide the complex derivative, or calculate that using automatic differentiation if possible.

@dpsanders
Copy link
Member Author

dpsanders commented Mar 26, 2020

From Slack (Mason Protter): AD for complex functions works using ForwardDiff2.jl:

julia> using ForwardDiff2: DI

julia> f(z) = z^2 / (2z + 1)
f (generic function with 1 method)

julia> z = 1 + im
1 + 1im

julia> DI(f)(z)  2z*(z+1) / (2z + 1)^2
true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants