iPython Notebook输出latex或mathjax

Rii*_*ina 2 python latex ipython mathjax

你如何让iPython使用乳胶输出结果?

例如,在此页面上:http://nbviewer.ipython.org/urls/raw.github.com/ipython/ipython/master/examples/notebooks/SymPy%20Examples.ipynb

如果我执行代码:

Rational(3,2)*pi + exp(I*x) / (x**2 + y)
Run Code Online (Sandbox Code Playgroud)

我得到输出:

Out[13]: 3*pi/2 + exp(I*x)/(x**2 + y)
Run Code Online (Sandbox Code Playgroud)

我想看看乳胶中的输出,如上面的链接所示.

arv*_*ve0 7

针对那些googlers的更新答案:

from IPython.display import Math
Math('3 \cdot \\frac{\pi}{2} + e^{\\frac{I*x}{x^2 + y}}')
Run Code Online (Sandbox Code Playgroud)

比SymPy更笨拙,但不需要额外的包.