gpt4 book ai didi

sympy - IPython Notebook Sympy 数学渲染

转载 作者:行者123 更新时间:2023-12-03 20:23:30 25 4
gpt4 key购买 nike

我刚刚开始使用 IPython Notebook,并被它的强大功能所吸引。我一直在使用网络上提供的一些示例来开始使用。我正在关注本教程:http://nbviewer.ipython.org/url/finiterank.com/cuadernos/suavesylocas.ipynb但数学输出没有按预期呈现。下面是我的代码和输出:

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

我也尝试过其他示例,但它们也没有正确呈现。我哪里错了?

最佳答案

我有同样的问题。尝试

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

代替
%load_ext sympyprinting

我正在使用 sympy 0.7.2

关于sympy - IPython Notebook Sympy 数学渲染,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16152040/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com