找回密码
 快速注册
搜索
查看: 42|回复: 0

[SymPy] solve a system of polynomial equations

[复制链接]

3149

主题

8387

回帖

6万

积分

$\style{scale:11;fill:#eff}꩜$

积分
65397
QQ

显示全部楼层

hbghlyj 发表于 2022-12-24 10:09 |阅读模式
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}$

手机版|悠闲数学娱乐论坛(第3版)

GMT+8, 2025-3-4 18:18

Powered by Discuz!

× 快速回复 返回顶部 返回列表