IPython Notebook Sympy数学渲染 [英] IPython Notebook Sympy Math Rendering

查看:159
本文介绍了IPython Notebook Sympy数学渲染的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始使用IPython Notebook,并且对它的强大功能着迷.我一直在使用网上提供的一些示例来开始使用.我正在学习本教程: http://nbviewer.ipython.org/url/finiterank.com/cuadernos/suavesylocas.ipynb ,但是数学输出未达到预期的效果.下面是我的代码和输出:

I have just started with using IPython Notebook and have been fascinated by its power. I have been using a few examples available on the net to get started with. I was following this tutorial: http://nbviewer.ipython.org/url/finiterank.com/cuadernos/suavesylocas.ipynb but the maths output is not getting rendered as expected. Below is the my code and the output:

In [30]:

%load_ext sympyprinting
%pylab inline

from __future__ import division
import sympy as sym
from sympy import *

init_printing()

x,y,z=symbols("x y z")
k,m,n=symbols("k m n", integer=True)

The sympyprinting extension is already loaded. To reload it, use:
  %reload_ext sympyprinting

Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.kernel.zmq.pylab.backend_inline].
For more information, type 'help(pylab)'.

In [31]:

t = sin(2*pi*x*(k**2))/ (4*(pi**2)*(k**5)) + (x**2) / (2*k)
t
Out[31]:
  2      ⎛     2  ⎞
 x    sin⎝2⋅π⋅k ⋅x⎠
─── + ─────────────
2⋅k         2  5   
         4⋅π ⋅k   

我也尝试了其他示例,但是它们也无法正确渲染.我要去哪里错了?

I have tried other examples also, and they are also not getting rendered properly. Where am I going wrong?

推荐答案

我遇到了同样的问题.试试

I had the same problem. Try

from sympy.interactive import printing
printing.init_printing(use_latex=True)

代替

%load_ext sympyprinting

我正在使用sympy 0.7.2

I am using sympy 0.7.2

这篇关于IPython Notebook Sympy数学渲染的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆