目录
先看几个
示例:
from sympy.solvers import solve
from sympy import Symbol
x = Symbol('x')
solve(x**2 - 1, x)
输出:
[-1, 1]
sympy.solvers的作用是求方程的解,例子中求解的 x 2 − 1 = 0 x^2-1=0 x2−1=0,解得 x = ± 1 x=±1 x=±1,两个解。
sympy.solvers.solvers.solve(f, *symbols, **flags)
示例:求二元一次方程
a, b = 2.96, 18.36
alpha = sympy.Symbol('alpha')
beta = sympy.Symbol('beta')
func = sympy.solve([a - alpha, b - beta - alpha * math.log(T)], [alpha, beta])
alpha, beta = func[alpha], func[beta]
参考链接:
[1] 官方链接 ;