本文整理汇总了Python中sympy.polys.domains.ZZ.map方法的典型用法代码示例。如果您正苦于以下问题:Python ZZ.map方法的具体用法?Python ZZ.map怎么用?Python ZZ.map使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sympy.polys.domains.ZZ
的用法示例。
在下文中一共展示了ZZ.map方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_dup_cancel
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import map [as 别名]
def test_dup_cancel():
f = ZZ.map([2, 0, -2])
g = ZZ.map([1, -2, 1])
p = [ZZ(2), ZZ(2)]
q = [ZZ(1), -ZZ(1)]
assert dup_cancel(f, g, ZZ) == (p, q)
assert dup_cancel(f, g, ZZ, include=False) == (ZZ(1), ZZ(1), p, q)
f = [-ZZ(1), -ZZ(2)]
g = [ ZZ(3), -ZZ(4)]
F = [ ZZ(1), ZZ(2)]
G = [-ZZ(3), ZZ(4)]
assert dup_cancel(f, g, ZZ) == (f, g)
assert dup_cancel(F, G, ZZ) == (f, g)
assert dup_cancel([], [], ZZ) == ([], [])
assert dup_cancel([], [], ZZ, include=False) == (ZZ(1), ZZ(1), [], [])
assert dup_cancel([ZZ(1), ZZ(0)], [], ZZ) == ([ZZ(1)], [])
assert dup_cancel(
[ZZ(1), ZZ(0)], [], ZZ, include=False) == (ZZ(1), ZZ(1), [ZZ(1)], [])
assert dup_cancel([], [ZZ(1), ZZ(0)], ZZ) == ([], [ZZ(1)])
assert dup_cancel(
[], [ZZ(1), ZZ(0)], ZZ, include=False) == (ZZ(1), ZZ(1), [], [ZZ(1)])
示例2: test_gf_monic
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import map [as 别名]
def test_gf_monic():
assert gf_monic(ZZ.map([]), 11, ZZ) == (0, [])
assert gf_monic(ZZ.map([1]), 11, ZZ) == (1, [1])
assert gf_monic(ZZ.map([2]), 11, ZZ) == (2, [1])
assert gf_monic(ZZ.map([1, 2, 3, 4]), 11, ZZ) == (1, [1, 2, 3, 4])
assert gf_monic(ZZ.map([2, 3, 4, 5]), 11, ZZ) == (2, [1, 7, 2, 8])
示例3: test_dup_count_complex_roots_1
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import map [as 别名]
def test_dup_count_complex_roots_1():
# z-1
assert dup_count_complex_roots(ZZ.map([1, -1]), ZZ, a, b) == 1
assert dup_count_complex_roots(ZZ.map([1, -1]), ZZ, c, d) == 1
# z+1
assert dup_count_complex_roots(ZZ.map([1, 1]), ZZ, a, b) == 1
assert dup_count_complex_roots(ZZ.map([1, 1]), ZZ, c, d) == 0
示例4: test_Domain_map
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import map [as 别名]
def test_Domain_map():
seq = ZZ.map([1, 2, 3, 4])
assert all([ ZZ.of_type(elt) for elt in seq ])
seq = ZZ.map([[1, 2, 3, 4]])
assert all([ ZZ.of_type(elt) for elt in seq[0] ]) and len(seq) == 1
示例5: test_gf_frobenius_map
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import map [as 别名]
def test_gf_frobenius_map():
f = ZZ.map([2, 0, 1, 0, 2, 2, 0, 2, 2, 2])
g = ZZ.map([1,1,0,2,0,1,0,2,0,1])
p = 3
n = 4
b = gf_frobenius_monomial_base(g, p, ZZ)
h = gf_frobenius_map(f, g, b, p, ZZ)
h1 = gf_pow_mod(f, p, g, p, ZZ)
assert h == h1
示例6: test_dmp_cancel
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import map [as 别名]
def test_dmp_cancel():
f = ZZ.map([[2], [0], [-2]])
g = ZZ.map([[1], [-2], [1]])
p = [[ZZ(2)], [ZZ(2)]]
q = [[ZZ(1)], [-ZZ(1)]]
assert dmp_cancel(f, g, 1, ZZ) == (p, q)
assert dmp_cancel(f, g, 1, ZZ, multout=False) == (ZZ(1), ZZ(1), p, q)
示例7: test_dup_primitive_prs
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import map [as 别名]
def test_dup_primitive_prs():
f = ZZ.map([1, 0, 1, 0, -3, -3, 8, 2, -5])
g = ZZ.map([3, 0, 5, 0, -4, -9, 21])
assert dup_primitive_prs(f, g, ZZ) == [f, g,
[-ZZ(5), ZZ(0), ZZ(1), ZZ(0), -ZZ(3)],
[ZZ(13), ZZ(25), -ZZ(49)],
[ZZ(4663), -ZZ(6150)],
[ZZ(1)]]
示例8: test_dup_lcm
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import map [as 别名]
def test_dup_lcm():
assert dup_lcm([2], [6], ZZ) == [6]
assert dup_lcm([2, 0, 0, 0], [6, 0], ZZ) == [6, 0, 0, 0]
assert dup_lcm([2, 0, 0, 0], [3, 0], ZZ) == [6, 0, 0, 0]
assert dup_lcm(ZZ.map([1, 1, 0]), ZZ.map([1, 0]), ZZ) == [1, 1, 0]
assert dup_lcm(ZZ.map([1, 1, 0]), ZZ.map([2, 0]), ZZ) == [2, 2, 0]
assert dup_lcm(ZZ.map([1, 2, 0]), ZZ.map([1, 0]), ZZ) == [1, 2, 0]
assert dup_lcm(ZZ.map([2, 1, 0]), ZZ.map([1, 0]), ZZ) == [2, 1, 0]
assert dup_lcm(ZZ.map([2, 1, 0]), ZZ.map([2, 0]), ZZ) == [4, 2, 0]
示例9: test_dup_count_complex_roots_8
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import map [as 别名]
def test_dup_count_complex_roots_8():
# (z-I-1)*(z+I-1)*(z-I+1)*(z+I+1)*(z-1)*(z+1)*(z-I)*(z+I)*z
assert dup_count_complex_roots(ZZ.map([1, 0, 0, 0, 3, 0, 0, 0, -4, 0]),
ZZ, a, b) == 9
assert dup_count_complex_roots(ZZ.map([1, 0, 0, 0, 3, 0, 0, 0, -4, 0]),
ZZ, c, d) == 4
# (z-I-1)*(z+I-1)*(z-I+1)*(z+I+1)*(z-1)*(z+1)*(z-I)*(z+I)*(z**2-2)*z
assert dup_count_complex_roots(ZZ.map(
[1, 0, -2, 0, 3, 0, -6, 0, -4, 0, 8, 0]), ZZ, a, b) == 9
assert dup_count_complex_roots(ZZ.map(
[1, 0, -2, 0, 3, 0, -6, 0, -4, 0, 8, 0]), ZZ, c, d) == 4
示例10: test_gf_compose
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import map [as 别名]
def test_gf_compose():
assert gf_compose([], [1, 0], 11, ZZ) == []
assert gf_compose_mod([], [1, 0], [1, 0], 11, ZZ) == []
assert gf_compose([1], [], 11, ZZ) == [1]
assert gf_compose([1, 0], [], 11, ZZ) == []
assert gf_compose([1, 0], [1, 0], 11, ZZ) == [1, 0]
f = ZZ.map([1, 1, 4, 9, 1])
g = ZZ.map([1, 1, 1])
h = ZZ.map([1, 0, 0, 2])
assert gf_compose(g, h, 11, ZZ) == [1, 0, 0, 5, 0, 0, 7]
assert gf_compose_mod(g, h, f, 11, ZZ) == [3, 9, 6, 10]
示例11: test_dup_count_real_roots
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import map [as 别名]
def test_dup_count_real_roots():
assert dup_count_real_roots([], ZZ) == 0
assert dup_count_real_roots([7], ZZ) == 0
assert dup_count_real_roots(ZZ.map([1, -1]), ZZ) == 1
assert dup_count_real_roots(ZZ.map([1, -1]), ZZ, inf=1) == 1
assert dup_count_real_roots(ZZ.map([1, -1]), ZZ, sup=0) == 0
assert dup_count_real_roots(ZZ.map([1, -1]), ZZ, sup=1) == 1
assert dup_count_real_roots(ZZ.map([1, -1]), ZZ, inf=0, sup=1) == 1
assert dup_count_real_roots(ZZ.map([1, -1]), ZZ, inf=0, sup=2) == 1
assert dup_count_real_roots(ZZ.map([1, -1]), ZZ, inf=1, sup=2) == 1
assert dup_count_real_roots(ZZ.map([1, 0, -2]), ZZ) == 2
assert dup_count_real_roots(ZZ.map([1, 0, -2]), ZZ, sup=0) == 1
assert dup_count_real_roots(ZZ.map([1, 0, -2]), ZZ, inf=-1, sup=1) == 0
示例12: test_dup_count_complex_roots_exclude
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import map [as 别名]
def test_dup_count_complex_roots_exclude():
f = ZZ.map([1, 0, 0, 0, -1, 0]) # z*(z-1)*(z+1)*(z-I)*(z+I)
a, b = (-QQ(1), QQ(0)), (QQ(1), QQ(1))
assert dup_count_complex_roots(f, ZZ, a, b) == 4
assert dup_count_complex_roots(f, ZZ, a, b, exclude=['S']) == 3
assert dup_count_complex_roots(f, ZZ, a, b, exclude=['N']) == 3
assert dup_count_complex_roots(f, ZZ, a, b, exclude=['S', 'N']) == 2
assert dup_count_complex_roots(f, ZZ, a, b, exclude=['E']) == 4
assert dup_count_complex_roots(f, ZZ, a, b, exclude=['W']) == 4
assert dup_count_complex_roots(f, ZZ, a, b, exclude=['E', 'W']) == 4
assert dup_count_complex_roots(
f, ZZ, a, b, exclude=['N', 'S', 'E', 'W']) == 2
assert dup_count_complex_roots(f, ZZ, a, b, exclude=['SW']) == 3
assert dup_count_complex_roots(f, ZZ, a, b, exclude=['SE']) == 3
assert dup_count_complex_roots(f, ZZ, a, b, exclude=['SW', 'SE']) == 2
assert dup_count_complex_roots(f, ZZ, a, b, exclude=['SW', 'SE', 'S']) == 1
assert dup_count_complex_roots(
f, ZZ, a, b, exclude=['SW', 'SE', 'S', 'N']) == 0
a, b = (QQ(0), QQ(0)), (QQ(1), QQ(1))
assert dup_count_complex_roots(f, ZZ, a, b, exclude=True) == 1
示例13: test_dup_count_complex_roots_implicit
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import map [as 别名]
def test_dup_count_complex_roots_implicit():
f = ZZ.map([1, 0, 0, 0, -1, 0]) # z*(z-1)*(z+1)*(z-I)*(z+I)
assert dup_count_complex_roots(f, ZZ) == 5
assert dup_count_complex_roots(f, ZZ, sup=(0, 0)) == 3
assert dup_count_complex_roots(f, ZZ, inf=(0, 0)) == 3
示例14: test_dup_cancel
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import map [as 别名]
def test_dup_cancel():
f = ZZ.map([2, 0, -2])
g = ZZ.map([1, -2, 1])
p = [ZZ(2), ZZ(2)]
q = [ZZ(1), -ZZ(1)]
assert dup_cancel(f, g, ZZ) == (p, q)
assert dup_cancel(f, g, ZZ, multout=False) == (ZZ(1), ZZ(1), p, q)
f = [-ZZ(1),-ZZ(2)]
g = [ ZZ(3),-ZZ(4)]
F = [ ZZ(1), ZZ(2)]
G = [-ZZ(3), ZZ(4)]
dup_cancel(f, g, ZZ) == (f, g)
dup_cancel(F, G, ZZ) == (f, g)
示例15: test_dmp_cancel
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import map [as 别名]
def test_dmp_cancel():
f = ZZ.map([[2], [0], [-2]])
g = ZZ.map([[1], [-2], [1]])
p = [[ZZ(2)], [ZZ(2)]]
q = [[ZZ(1)], [-ZZ(1)]]
assert dmp_cancel(f, g, 1, ZZ) == (p, q)
assert dmp_cancel(f, g, 1, ZZ, include=False) == (ZZ(1), ZZ(1), p, q)
assert dmp_cancel([[]], [[]], 1, ZZ) == ([[]], [[]])
assert dmp_cancel([[]], [[]], 1, ZZ, include=False) == (ZZ(1), ZZ(1), [[]], [[]])
assert dmp_cancel([[ZZ(1), ZZ(0)]], [[]], 1, ZZ) == ([[ZZ(1)]], [[]])
assert dmp_cancel([[ZZ(1), ZZ(0)]], [[]], 1, ZZ, include=False) == (ZZ(1), ZZ(1), [[ZZ(1)]], [[]])
assert dmp_cancel([[]], [[ZZ(1), ZZ(0)]], 1, ZZ) == ([[]], [[ZZ(1)]])
assert dmp_cancel([[]], [[ZZ(1), ZZ(0)]], 1, ZZ, include=False) == (ZZ(1), ZZ(1), [[]], [[ZZ(1)]])