# Feature or bug? using SymPy; Sym(-1)^(1//4)

**URL:** <https://discourse.julialang.org/t/feature-or-bug-using-sympy-sym-1-1-4/15135>\
**Category:** General Usage\
**Created:** [September 18, 2018, 4:14pm UTC](https://discourse.julialang.org/t/feature-or-bug-using-sympy-sym-1-1-4/15135 "2018-09-18T16:14:17Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![loisel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/loisel/32/50626_2.png) [@loisel](https://discourse.julialang.org/u/loisel)\
**Post date:** [September 18, 2018, 4:14pm UTC](https://discourse.julialang.org/t/feature-or-bug-using-sympy-sym-1-1-4/15135/1 "2018-09-18T16:14:17Z")

</div>

In Jupyter, I get some sort of broken output:

[[Album] imgur.com ![](https://global.discourse-cdn.com/julialang/original/3X/f/9/f9147fc5eb4f271b03fa5ff88d73d063beb5fe09.jpeg "imgur.com") ](https://imgur.com/a/5TQEGn0)

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [September 18, 2018, 4:17pm UTC](https://discourse.julialang.org/t/feature-or-bug-using-sympy-sym-1-1-4/15135/2 "2018-09-18T16:17:22Z")

</div>

See [MathJax doesn't render higher order roots · Issue #409 · JuliaLang/IJulia.jl · GitHub](https://github.com/JuliaLang/IJulia.jl/issues/409)

---

<div class="post-metadata">

**Author:** ![loisel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/loisel/32/50626_2.png) [@loisel](https://discourse.julialang.org/u/loisel)\
**Post date:** [September 18, 2018, 4:47pm UTC](https://discourse.julialang.org/t/feature-or-bug-using-sympy-sym-1-1-4/15135/3 "2018-09-18T16:47:14Z")

</div>

OK so this is maybe some sort of upstream bug. Thanks.

---

<div class="post-metadata">

**Author:** ![loisel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/loisel/32/50626_2.png) [@loisel](https://discourse.julialang.org/u/loisel)\
**Post date:** [September 18, 2018, 4:55pm UTC](https://discourse.julialang.org/t/feature-or-bug-using-sympy-sym-1-1-4/15135/4 "2018-09-18T16:55:36Z")

</div>

Hm actually,

This seems to have been fixed upstreams years ago. Older versions of sympy would output \root{a}{b} which was wrong, but more recent versions output \sqrt[a]{b}. Why is the builtin Julia python sympy doing this old thing?

[[Album] imgur.com ![](https://global.discourse-cdn.com/julialang/original/3X/8/2/826c78e85df303f559a6f303c606281381eef423.jpeg "imgur.com") ](https://imgur.com/a/q4MHzG4)

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [September 18, 2018, 5:07pm UTC](https://discourse.julialang.org/t/feature-or-bug-using-sympy-sym-1-1-4/15135/5 "2018-09-18T17:07:47Z")

</div>

> [@loisel](#):
>
> Why is the builtin Julia python sympy doing this old thing?

By default, PyCall and SymPy.jl use the Anaconda Python distribution, so they get whatever SymPy version Anaconda ships. There is no “Julia python” per se.

The issue seems to be that [SymPy.jl is calling](https://github.com/JuliaPy/SymPy.jl/blob/a1ffa2c7c9bb43bc0f09f3322ddd3711887762fd/src/display.jl#L62) `latex(expr, itex=true)`, and the `itex=true` keyword [causes sympy to use `\root`](https://github.com/sympy/sympy/blob/78e604156b0ff216c0b4486bb077132dc12bbf93/sympy/printing/latex.py#L497-L498). I’m not sure why SymPy.jl uses the `itex=true` setting.

---

<div class="post-metadata">

**Author:** ![loisel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/loisel/32/50626_2.png) [@loisel](https://discourse.julialang.org/u/loisel)\
**Post date:** [September 18, 2018, 5:26pm UTC](https://discourse.julialang.org/t/feature-or-bug-using-sympy-sym-1-1-4/15135/6 "2018-09-18T17:26:01Z")

</div>

Hm, even putting itex=false doesn’t fully solve the problem. The wrong brackets come out.

[[Album] imgur.com ![](https://global.discourse-cdn.com/julialang/original/3X/0/9/09737dfbb46e02213f7d1779a7515208819fa8d4.jpeg "imgur.com") ](https://imgur.com/a/c76UQrS)

Should I file an issue with SymPy.jl?

---

<div class="post-metadata">

**Author:** ![loisel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/loisel/32/50626_2.png) [@loisel](https://discourse.julialang.org/u/loisel)\
**Post date:** [September 18, 2018, 5:31pm UTC](https://discourse.julialang.org/t/feature-or-bug-using-sympy-sym-1-1-4/15135/7 "2018-09-18T17:31:25Z")

</div>

Nevermind, this works fully. Maybe indeed file a bug with SymPy.jl?

 ![](https://global.discourse-cdn.com/julialang/original/3X/4/f/4fee7d1a6583c164257843ef17d15120cf74f114.png)

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [September 18, 2018, 5:39pm UTC](https://discourse.julialang.org/t/feature-or-bug-using-sympy-sym-1-1-4/15135/8 "2018-09-18T17:39:29Z")

</div>

> [@loisel](#):
>
> Maybe indeed file a bug with SymPy.jl?

Yes. There may be some other reason that it is using `itex=true`, but a SymPy.jl issue would be the place to have that discussion.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [September 18, 2018, 7:34pm UTC](https://discourse.julialang.org/t/feature-or-bug-using-sympy-sym-1-1-4/15135/9 "2018-09-18T19:34:46Z")

</div>

[https://github.com/JuliaPy/SymPy.jl/issues/240](https://github.com/JuliaPy/SymPy.jl/issues/240)

---

<div class="post-metadata">

**Author:** ![loisel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/loisel/32/50626_2.png) [@loisel](https://discourse.julialang.org/u/loisel)\
**Post date:** [September 19, 2018, 12:30am UTC](https://discourse.julialang.org/t/feature-or-bug-using-sympy-sym-1-1-4/15135/10 "2018-09-19T00:30:27Z")

</div>

thanks for linking the issue 🙂
