FormatterWarning when to use sympy.Abs in IPython notebook

139 views
Skip to first unread message

chaowen guo

unread,
Feb 13, 2015, 2:00:04 PM2/13/15
to sy...@googlegroups.com
I run the following code in IPython notebook

import sympy
sympy.init_printing()
x=sympy.symbols("x",real=True)
sympy.Abs(x)

and always get the following warning:

/usr/lib/python3/dist-packages/IPython/core/formatters.py:239: FormatterWarning: Exception in image/png formatter: 
\left\lvert{x}\right\rvert
     ^
Expected a delimiter (at char 5), (line:1, col:6)
  FormatterWarning,

Although the answer is correct, my program has a lot of formula with sympy.Abs. So it prints a lot of warning messages like the above one. It is pretty annoying.

How to fix the problem?

Chaowen GUO

Jason Moore

unread,
Feb 13, 2015, 2:03:17 PM2/13/15
to sy...@googlegroups.com
Chaowen,

This has been fixed, see https://github.com/sympy/sympy/issues/2822.

If you upgrade to SymPy 0.7.6, you shouldn't get the warning anymore.

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/bb5ae430-2d7c-4b15-ae39-3fad8876988d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Aaron Meurer

unread,
Feb 13, 2015, 2:50:47 PM2/13/15
to sy...@googlegroups.com
I don't remember fixing abs(). As far as I know, it wasn't fixed.
latex(abs(x)) still gives a result using \lvert.

We should probably just use \left \| instead of \lvert. Any reason to
use the latter?

Aaron Meurer
> https://groups.google.com/d/msgid/sympy/CAP7f1AixSCrF7hO0kypYXm0_SzTdvPS4yn4Ss_%2BAWbCwWQCZ5w%40mail.gmail.com.

chaowen guo

unread,
Feb 13, 2015, 3:05:38 PM2/13/15
to sy...@googlegroups.com
No, I already use 0.7.6. The problem remains.

Aaron Meurer

unread,
Feb 13, 2015, 3:27:05 PM2/13/15
to sy...@googlegroups.com
I opened https://github.com/sympy/sympy/issues/8984 for it. It's a
good easy to fix issue if someone is looking for one.

Aaron Meurer
> https://groups.google.com/d/msgid/sympy/1da9d427-1b52-41f1-a7c1-1b75b48d4b03%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages