Forgot password?
 Register account
View 148|Reply 0

[SymPy] solve a system of polynomial equations

[Copy link]

3157

Threads

7925

Posts

610K

Credits

Credits
64218
QQ

Show all posts

hbghlyj Posted 2022-12-24 10:09 |Read mode
Systems of Polynomial Equations
例如$\cases{xy - 2y=0\\2y^2 - x^2=0}$
from sympy import solve_poly_system
from sympy.abc import x, y
solve_poly_system([x*y - 2*y, 2*y**2 - x**2], x, y)

[(0, 0), (2, -sqrt(2)), (2, sqrt(2))]

得方程组的解$\cases{x=0\\y=0}\cases{x=2\\y=-\sqrt2}\cases{x=2\\y=\sqrt2}$

使用Gianni-Kalkbrenner算法
The algorithm proceeds by computing one Groebner basis in the ground domain and then by iteratively computing polynomial factorizations in appropriately constructed algebraic extensions of the ground domain.
该算法在基域中计算 Groebner 基,然后在基域的适当的代数扩张中逐次分解多项式。
例如$\cases{x^2 + y + z - 1=0\\ x + y^2 + z - 1=0\\ x + y + z^2 - 1=0}$
from sympy import solve_triangulated
from sympy.abc import x, y, z
F = [x**2 + y + z - 1, x + y**2 + z - 1, x + y + z**2 - 1]
solve_triangulated(F, x, y, z)

[(0, 0, 1), (0, 1, 0), (1, 0, 0)]

得方程组的解$\cases{x=0\\y=0\\z=1}\cases{x=0\\y=1\\z=0}\cases{x=1\\y=0\\z=0}$

Mobile version|Discuz Math Forum

2025-6-6 15:48 GMT+8

Powered by Discuz!

× Quick Reply To Top Edit