使用Solvers
# this is an example
>>> from sympy.solvers import solve
>>> from sympy import Symbol
>>> x = Symbol('x')
>>> solve(x ** 2 - 1, x)
[-1, 1]
由于等式具有一些浮点常量,所以最好使用nsolve
进行数值求解:
from sympy import Eq, log, exp, nsolve
from sympy.abc import x
c = 267
sol = nsolve(Eq(x ** 0.22 * (c * exp(-c * x ** 0.22) - 1), c * log(0.7657)), x, 1)
print(sol) # 264587674.024352