1、About SymPy:
SymPy is a Python library for symbolic mathematics. It aims to become a full-featured computer algebra system (CAS) while keeping the code as simple as possible
in order to be comprehensible and easily extensible. SymPy is written entirely in Python.
2、下载sympy软件包:
到官方网站:http://www.sympy.org/en/index.html下载
或者直接通过github下载:https://github.com/sympy/sympy/releases
选择:sympy-1.0.tar.gz,点击下载压缩文件:sympy-1.0.tar
3、解开压缩包,找到sympy包所在的文件夹,如图。
4、在上面所示的文件夹内,打开命令行窗口,执行:pip install sympy
出现下图,导入包结束。
5、示例:
import sympy
a,b = 500,600
print(a,b)
numbers = range(a,b)
prime_numbers = filter(sympy.isprime, numbers)
print("Prime numbers({}-{}:".format(a,b))
for prime_number in prime_numbers:
print(prime_number,end=",")
print()执行结果:
500 600
Prime numbers(500-600:
503,509,521,523,541,547,557,563,569,571,577,587,593,599,
Process finished with exit code 0
本文介绍了Sympy,一个用于符号数学的Python库,旨在成为一个功能齐全的计算机代数系统(CAS),其代码简洁易懂,易于扩展。内容包括Sympy的基本介绍和下载安装步骤。

2万+

被折叠的 条评论
为什么被折叠?



