使用SymPy求解方程组

时间:2021-12-24 12:36:50

I need to solve a system equation using the SymPy library in Python. For example:

我需要使用Python中的SymPy库来解决系统方程。例如:

y = x ** 2
x = 2

Solution: y = 4

解决方案:y = 4

How to do this with SymPy?

如何用SymPy做到这一点?

1 个解决方案

#1


0  

from sympy import *
x = Symbol('x')
y = Symbol('y')
solve([y - x ** 2, x - 2], [x, y])
// [(2, 4)]

#1


0  

from sympy import *
x = Symbol('x')
y = Symbol('y')
solve([y - x ** 2, x - 2], [x, y])
// [(2, 4)]