小编hah*_*hah的帖子

Python解决一个变量的等式

我正在尝试使用SymPy在python中解决方程式.我有一个生成的等式(function = y(8.0-(y**3.0))我和SymPy一起用来创建一个像这样的新等式:eq = sympy.Eq(function, 2)输出y(8.0-(y**3.0)) == 2.但sympy.solve(eq)似乎不起作用.

>>> from sympy import Eq, Symbol as sym, solve
>>> y = sym('y')
>>> eqa = Eq(y(8.0-(y**3.0)), 8)
>>> solve(eqa)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/pymodules/python2.6/sympy/solvers/solvers.py", line 332, in solve
    result = tsolve(f, *symbols)
  File "/usr/lib/pymodules/python2.6/sympy/solvers/solvers.py", line 716, in tsolve
    raise NotImplementedError("Unable to solve the equation.")
NotImplementedError: Unable to solve the equation.
Run Code Online (Sandbox Code Playgroud)

谢谢阅读.

python solver sympy equations

6
推荐指数
3
解决办法
3万
查看次数

标签 统计

equations ×1

python ×1

solver ×1

sympy ×1