logo
  • 教程列表
  • SO官方文档
  • 方程
    • 求解线性方程组
    • 求解一个方程
    • 用数值方法求解非线性方程组
  1. StackOverflow 文档
  2. sympy 教程
  3. 方程
  4. 求解一个方程

求解一个方程

Created: November-22, 2018

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]
  • 用数值方法求解非线性方程组
  • 求解线性方程组

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 关于我们
  • 免责声明