使用sympy
1.解一元方程 x^2+2x=0
from sympy import *
x=Symbol('x')
print(x,solve(x**2+2*x))
2.解二元方程组 x+y=4 2x+3y=10
from sympy import *
x,y=symbols('x y')
sol=solve((x+y-4,
2*x+3*y-10))
print(sol)
运行结果:
标签:方程解,10,方程,python,2x,sol,solve,sympy,import
来源: https://www.cnblogs.com/StarZhai/p/15417046.html