Getting the real or imaginary part with SymPy.jl

How can I get the symbolic real or imaginary part of a Sym expression? real gives a BigFloat instead:

julia> sqrt(Sym(5))+im
√5 + ⅈ

julia> sqrt(Sym(5))+im |> real

There is (and to return the a and b of a+b im. But it seems the definitions of real and imag should be changed, as they are returning numeric values, not symbolic values. (`real` and `imag` · Issue #442 · JuliaPy/SymPy.jl · GitHub)

1 Like