求解一个方程
import sympy as sy
# Symbols have to be defined before one can use them
x = sy.S('x')
# Definition of the equation to be solved
eq=sy.Eq(x**2 + 2, 6)
#Print the solution of the equation
print sy.solve(eq)
打印结果将是:
[-2, 2]
import sympy as sy
# Symbols have to be defined before one can use them
x = sy.S('x')
# Definition of the equation to be solved
eq=sy.Eq(x**2 + 2, 6)
#Print the solution of the equation
print sy.solve(eq)
打印结果将是:
[-2, 2]