# Getting the real or imaginary part with SymPy.jl

**URL:** <https://discourse.julialang.org/t/getting-the-real-or-imaginary-part-with-sympy-jl/70400>\
**Category:** General Usage\
**Tags:** sympy\
**Created:** [October 26, 2021, 12:12pm UTC](https://discourse.julialang.org/t/getting-the-real-or-imaginary-part-with-sympy-jl/70400 "2021-10-26T12:12:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sijo](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@sijo](https://discourse.julialang.org/u/sijo)\
**Post date:** [October 26, 2021, 12:12pm UTC](https://discourse.julialang.org/t/getting-the-real-or-imaginary-part-with-sympy-jl/70400/1 "2021-10-26T12:12:12Z")

</div>

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

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

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

```

---

<div class="post-metadata">

**Author:** ![j\_verzani](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/j_verzani/32/8551_2.png) [@j\_verzani](https://discourse.julialang.org/u/j_verzani)\
**Post date:** [October 26, 2021, 12:51pm UTC](https://discourse.julialang.org/t/getting-the-real-or-imaginary-part-with-sympy-jl/70400/2 "2021-10-26T12:51:30Z")

</div>

> [@sijo](#):
>
> `sqrt(Sym(5))+im`

There is `sympy.re` (and `sympy.im`) 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](https://github.com/JuliaPy/SymPy.jl/issues/442))
