Error with substitution of a Complex{Float64} value in polynomial with complex coefficients
Paul-Roux-Phys opened this issue · comments
Hi, thanks for the great package!
Here is my problem ; when I try to substitute a complex value in a polynomial with complex coefficients, I get an error
julia> using Symbolics
julia> @variables x
julia> p = 0.4 + 1.7im*x
julia> substitute(p, Dict( x => 0.2 + 1.0im))
ERROR: InexactError: Real(0.34 + 1.7im)
Stacktrace:
[1] Real
@ ./complex.jl:44 [inlined]
[2] convert
@ ./number.jl:7 [inlined]
[3] Complex{Real}(re::Float64, im::ComplexF64)
@ Base ./complex.jl:14
[4] substitute(expr::Symbolics.ComplexTerm{Real}, dict::Dict{SymbolicUtils.BasicSymbolic{Real}, ComplexF64}; fold::Bool)
@ SymbolicUtils ~/.julia/packages/SymbolicUtils/c0xQb/src/substitute.jl:28
[5] substitute
@ ~/.julia/packages/SymbolicUtils/c0xQb/src/substitute.jl:16 [inlined]
[6] #16#17
@ ~/.julia/packages/Symbolics/OrNx6/src/num.jl:84 [inlined]
[7] (::Symbolics.var"#16#19"{Symbolics.var"#16#17#20"{Dict{SymbolicUtils.BasicSymbolic{Real}, ComplexF64}}})(expr::Symbolics.ComplexTerm{Real})
@ Symbolics ~/.julia/packages/Symbolics/OrNx6/src/num.jl:84
[8] substitute(expr::Complex{Num}, s::Dict{Num, ComplexF64}; kw::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
@ Symbolics ~/.julia/packages/Symbolics/OrNx6/src/Symbolics.jl:161
[9] substitute(expr::Complex{Num}, s::Dict{Num, ComplexF64})
@ Symbolics ~/.julia/packages/Symbolics/OrNx6/src/Symbolics.jl:161
[10] top-level scope
@ REPL[65]:1
Am I doing something incorrect, or is this a bug ?