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

  • 關於本站
  • 免責聲明