from sympy import * import numpy as np from numpy import linalg # 方程中的符号 x = Symbol('x') # 计算 result1 = solve(x**2 - 2*x - 2, x) print("result1[0] = %s" %float(result1[0])) result2 = solve((np.e)**((5-x)**2) - 8, x) print("result2 = %s" %result2)