我是sympy的新手,对Python仍然天真......我想解决一个三角方程,找到它的零点。 (一旦我有语法,那么我将使用更复杂的功能。)在Sympy中访问mpmath模块(python)
我还找不到合适的语法。以下是我在IPython的控制台Spyder的尝试(Python 2.7版):
from sympy.solvers import solve
from sympy import Symbol
x = Symbol('x')
solve(sin(x), x)
我得到这个错误:
Traceback (most recent call last):
File "", line 1, in solve(sin(x), x)
NameError: name 'sin' is not defined
OK,所以我需要有正确的参考正弦函数。
按照sympy文档,我认为这是在mpath
,但这并没有工作:
from mpmath import *
Traceback (most recent call last):
File "<ipython-input-7-8dcdd12d9679>", line 1, in <module>
from mpmath import *
ImportError: No module named mpmath
如何加载/访问mpmath或一些其他的方式来获取正弦函数?