Formatter error from sympy in ipython notebook

jupyter-notebook, sympy

Solution

This is a bug, which has been fixed in the git version of SymPy. You can safely ignore it. It will only be an issue if you export your notebook to a format that uses png for the math. If you want to suppress the error entirely, you can use `init_printing(use_latex='mathjax')`.

Problem

I have the following Sympy related code in iPython Notebook: ``` from sympy import * init_printing() ``` ... define constants ``` c, d, e, f = symbols("c, d, e, f") ``` ... define two matrices ``` v = Matrix(2,1,[1,1]) w = Matrix(2,1,[2,3]) ``` define symbolic matrices ``` v, v1, v2 = symbols("v, v1, v2") v = Matrix(2,1, [v1, v2]) w, w1, w2 = symbols("w, w1, w2") w = Matrix(2,1, [w1, w2]) ``` addition of symbolic vectors v & w ``` v + w ``` results in the following error message ``` /home/ron/anaconda/lib/python2.7/site-packages/IPython/core/formatters.py:239: FormatterWarning: Exception in image/png formatter: \left[\begin{smallmatrix}v_{1} + w_{1}\\v_{2} + w_{2}\end{smallmatrix}\right] ^ Expected "\right" (at char 6), (line:1, col:7) FormatterWarning, ``` and then produces the correct answer ``` [v1+w1v2+w2] ``` The interesting thing is that if I re-execute the cell the error message goes away. I've tried the same code in ipython qtconsole with identical results. Is this a bug or just poor coding on my part? After further searching I tried the following in the first cell: ``` from IPython.display import display from sympy.interactive import printing printing.init_printing(use_latex='mathjax') from __future__ import division import sympy as sym from sympy import * ``` This eliminates the above errors so far. New cell from SymPy: Open Source Symbolic Mathematics on nbviewer

Original source