n0rbed / Root-finding

root finding for Symbolics.jl
0 stars 1 forks source link

filter_poly not working correctly #6

Open n0rbed opened 6 days ago

n0rbed commented 6 days ago
julia> RootFinding.filter_poly(x^3 + x*sqrt(complex(-2)) + 2, x)
(Dict{Any, Any}(I0 => im, c1 => 1.4142135623730951), 2 + 1.4142135623730951I0*x + x^3)

Output should be: x^3 + c1I0x + 2

julia> RootFinding.filter_poly(im*x + Symbolics.term(sqrt, 2), x)
(Dict{Any, Any}(c1 => (im*x) + sqrt(2)), c1)

Output should be: I0x + c1

n0rbed commented 6 days ago

This is resulting in some limitations such as:

julia> RootFinding.solve(x^3 + x*sqrt(complex(-2)) + 2, x)
ERROR: AssertionError: Coefficients must be integer or rational
n0rbed commented 6 days ago

update:

julia> RootFinding.filter_poly(poly, x)
(Dict{Any, Any}(I0 => im, c1 => 1.4142135623730951), 2 + I0*c1*x + x^3)

julia> RootFinding.filter_poly(im*x + Symbolics.term(sqrt, 2), x)
(Dict{Any, Any}(c1 => (im*x) + sqrt(2)), c1)

Second case is dependent on Symbolics.get_variables. It can not see that the input polynomial has x in the equation.