我试图获得弗洛伊登斯坦方程(psi)的角度之一:
k1 * cos(psi) - k2 * cos(fi) + k3 - cos(psi - fi) = 0
我有 k1、k2、k3 和 fi 值。我尝试了以下方法:
from sympy import Symbol, solve, cos
x = Symbol('x')
realPsi = solve(k1 * cos(x) - k2 * cos(fi) + k3 - cos(x - fi), x)
我收到此错误:
File "/usr/lib/python2.7/dist-packages/sympy/solvers/solvers.py", line 484, in solve solution = _solve(f, *symbols, **flags)
File "/usr/lib/python2.7/dist-packages/sympy/solvers/solvers.py", line 700, in _solve soln = tsolve(f_num, symbol)
File "/usr/lib/python2.7/dist-packages/sympy/solvers/solvers.py", line 1143, in tsolve "(tsolve: at least one Function expected at this point")
NotImplementedError: Unable to solve the equation(tsolve: at least one Function expected at this point
我以前不使用这种工具,也许我做错了什么……
知道吗?
谢谢,
赫克托。
编辑:
感谢您的快速响应。
我尝试了以下方法(带有 cos 的简单方程):
eq = 3.2 * cos(x + 0.2).rewrite(exp) + 1.7
eq
Out[1]: 1.6*exp(I*(-x - 0.2)) + 1.6*exp(I*(x + 0.2)) + 1.7
solve(1.6*exp(I*(-x - 0.2)) + 1.6*exp(I*(x + 0.2)) + 1.7, x)
NotImplementedError: Unable to solve the equation(tsolve: at least one Function expected at this point
我是否正确使用.rewrite?