本文整理汇总了Python中sympy.polys.subresultants_qq_zz.sylvester函数的典型用法代码示例。如果您正苦于以下问题:Python sylvester函数的具体用法?Python sylvester怎么用?Python sylvester使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sylvester函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_bezout
def test_bezout():
x = var('x')
p = -2*x**5+7*x**3+9*x**2-3*x+1
q = -10*x**4+21*x**2+18*x-3
assert bezout(p, q, x, 'bz').det() == sylvester(p, q, x, 2).det()
assert bezout(p, q, x, 'bz').det() != sylvester(p, q, x, 1).det()
assert bezout(p, q, x, 'prs') == backward_eye(5) * bezout(p, q, x, 'bz') * backward_eye(5)
开发者ID:asmeurer,项目名称:sympy,代码行数:8,代码来源:test_subresultants_qq_zz.py
示例2: test_bezout
def test_bezout():
x = var("x")
p = -2 * x ** 5 + 7 * x ** 3 + 9 * x ** 2 - 3 * x + 1
q = -10 * x ** 4 + 21 * x ** 2 + 18 * x - 3
assert bezout(p, q, x, "bz").det() == sylvester(p, q, x, 2).det()
assert bezout(p, q, x, "bz").det() != sylvester(p, q, x, 1).det()
assert bezout(p, q, x, "prs") == backward_eye(5) * bezout(p, q, x, "bz") * backward_eye(5)
开发者ID:Carreau,项目名称:sympy,代码行数:8,代码来源:test_subresultants_qq_zz.py
示例3: test_euclid_pg
def test_euclid_pg():
x = var('x')
p = x**6+x**5-x**4-x**3+x**2-x+1
q = 6*x**5+5*x**4-4*x**3-3*x**2+2*x-1
assert euclid_pg(p, q, x)[-1] == sylvester(p, q, x).det()
assert euclid_pg(p, q, x) == subresultants_pg(p, q, x)
p = x**8 + x**6 - 3*x**4 - 3*x**3 + 8*x**2 + 2*x - 5
q = 3*x**6 + 5*x**4 - 4*x**2 - 9*x + 21
assert euclid_pg(p, q, x)[-1] != sylvester(p, q, x, 2).det()
sam_factors = [1, 1, -1, -1, 1, 1]
assert euclid_pg(p, q, x) == [i*j for i,j in zip(sam_factors, sturm_pg(p, q, x))]
开发者ID:deepak41,项目名称:sympy,代码行数:13,代码来源:test_subresultants_qq_zz.py
示例4: test_euclid_amv
def test_euclid_amv():
x = var("x")
p = x ** 3 - 7 * x + 7
q = 3 * x ** 2 - 7
assert euclid_amv(p, q, x)[-1] == sylvester(p, q, x).det()
assert euclid_amv(p, q, x) == subresultants_amv(p, q, x)
p = x ** 8 + x ** 6 - 3 * x ** 4 - 3 * x ** 3 + 8 * x ** 2 + 2 * x - 5
q = 3 * x ** 6 + 5 * x ** 4 - 4 * x ** 2 - 9 * x + 21
assert euclid_amv(p, q, x)[-1] != sylvester(p, q, x, 2).det()
sam_factors = [1, 1, -1, -1, 1, 1]
assert euclid_amv(p, q, x) == [i * j for i, j in zip(sam_factors, sturm_amv(p, q, x))]
开发者ID:Carreau,项目名称:sympy,代码行数:13,代码来源:test_subresultants_qq_zz.py
示例5: test_sturm_amv
def test_sturm_amv():
x = var('x')
p = x**8 + x**6 - 3*x**4 - 3*x**3 + 8*x**2 + 2*x - 5
q = 3*x**6 + 5*x**4 - 4*x**2 - 9*x + 21
assert sturm_amv(p, q, x)[-1] != sylvester(p, q, x, 2).det()
sam_factors = [1, 1, -1, -1, 1, 1]
assert sturm_amv(p, q, x) == [i*j for i,j in zip(sam_factors, euclid_amv(p, q, x))]
p = -9*x**5 - 5*x**3 - 9
q = -45*x**4 - 15*x**2
assert sturm_amv(p, q, x, 1)[-1] == sylvester(p, q, x, 1).det()
assert sturm_amv(p, q, x)[-1] != sylvester(p, q, x, 2).det()
assert sturm_amv(-p, q, x)[-1] == sylvester(-p, q, x, 2).det()
assert sturm_pg(-p, q, x) == modified_subresultants_pg(-p, q, x)
开发者ID:deepak41,项目名称:sympy,代码行数:15,代码来源:test_subresultants_qq_zz.py
示例6: test_subresultants_vv_2
def test_subresultants_vv_2():
x = var('x')
p = x**8 + x**6 - 3*x**4 - 3*x**3 + 8*x**2 + 2*x - 5
q = 3*x**6 + 5*x**4 - 4*x**2 - 9*x + 21
assert subresultants_vv_2(p, q, x) == subresultants(p, q, x)
assert subresultants_vv_2(p, q, x)[-1] == sylvester(p, q, x).det()
assert subresultants_vv_2(p, q, x) != euclid_amv(p, q, x)
amv_factors = [1, 1, -1, 1, -1, 1]
assert subresultants_vv_2(p, q, x) == [i*j for i, j in zip(amv_factors, modified_subresultants_amv(p, q, x))]
p = x**3 - 7*x + 7
q = 3*x**2 - 7
assert subresultants_vv_2(p, q, x) == euclid_amv(p, q, x)
开发者ID:deepak41,项目名称:sympy,代码行数:14,代码来源:test_subresultants_qq_zz.py
示例7: test_modified_subresultants_amv
def test_modified_subresultants_amv():
x = var('x')
p = x**8 + x**6 - 3*x**4 - 3*x**3 + 8*x**2 + 2*x - 5
q = 3*x**6 + 5*x**4 - 4*x**2 - 9*x + 21
amv_factors = [1, 1, -1, 1, -1, 1]
assert modified_subresultants_amv(p, q, x) == [i*j for i, j in zip(amv_factors, subresultants_amv(p, q, x))]
assert modified_subresultants_amv(p, q, x)[-1] != sylvester(p + x**8, q, x).det()
assert modified_subresultants_amv(p, q, x) != sturm_amv(p, q, x)
p = x**3 - 7*x + 7
q = 3*x**2 - 7
assert modified_subresultants_amv(p, q, x) == sturm_amv(p, q, x)
assert modified_subresultants_amv(-p, q, x) != sturm_amv(-p, q, x)
开发者ID:deepak41,项目名称:sympy,代码行数:14,代码来源:test_subresultants_qq_zz.py
示例8: test_sylvester
def test_sylvester():
x = var('x')
assert sylvester(x**3 -7, 0, x) == sylvester(x**3 -7, 0, x, 1) == Matrix([[0]])
assert sylvester(0, x**3 -7, x) == sylvester(0, x**3 -7, x, 1) == Matrix([[0]])
assert sylvester(x**3 -7, 0, x, 2) == Matrix([[0]])
assert sylvester(0, x**3 -7, x, 2) == Matrix([[0]])
assert sylvester(x**3 -7, 7, x).det() == sylvester(x**3 -7, 7, x, 1).det() == 343
assert sylvester(7, x**3 -7, x).det() == sylvester(7, x**3 -7, x, 1).det() == 343
assert sylvester(x**3 -7, 7, x, 2).det() == -343
assert sylvester(7, x**3 -7, x, 2).det() == -343
assert sylvester(3, 7, x).det() == sylvester(3, 7, x, 1).det() == sylvester(3, 7, x, 2).det() == 1
assert sylvester(3, 0, x).det() == sylvester(3, 0, x, 1).det() == sylvester(3, 0, x, 2).det() == 1
assert sylvester(x - 3, x - 8, x) == sylvester(x - 3, x - 8, x, 1) == sylvester(x - 3, x - 8, x, 2) == Matrix([[1, -3], [1, -8]])
assert sylvester(x**3 - 7*x + 7, 3*x**2 - 7, x) == sylvester(x**3 - 7*x + 7, 3*x**2 - 7, x, 1) == Matrix([[1, 0, -7, 7, 0], [0, 1, 0, -7, 7], [3, 0, -7, 0, 0], [0, 3, 0, -7, 0], [0, 0, 3, 0, -7]])
assert sylvester(x**3 - 7*x + 7, 3*x**2 - 7, x, 2) == Matrix([
[1, 0, -7, 7, 0, 0], [0, 3, 0, -7, 0, 0], [0, 1, 0, -7, 7, 0], [0, 0, 3, 0, -7, 0], [0, 0, 1, 0, -7, 7], [0, 0, 0, 3, 0, -7]])
开发者ID:deepak41,项目名称:sympy,代码行数:23,代码来源:test_subresultants_qq_zz.py
注:本文中的sympy.polys.subresultants_qq_zz.sylvester函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论