本文整理汇总了Python中sympy.polys.domains.ZZ类的典型用法代码示例。如果您正苦于以下问题:Python ZZ类的具体用法?Python ZZ怎么用?Python ZZ使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ZZ类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_dup_cancel
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)])
开发者ID:jenshnielsen,项目名称:sympy,代码行数:29,代码来源:test_euclidtools.py
示例2: test_globalring
def test_globalring():
Qxy = QQ.old_frac_field(x, y)
R = QQ.old_poly_ring(x, y)
X = R.convert(x)
Y = R.convert(y)
assert x in R
assert 1/x not in R
assert 1/(1 + x) not in R
assert Y in R
assert X.ring == R
assert X * (Y**2 + 1) == R.convert(x * (y**2 + 1))
assert X * y == X * Y == R.convert(x * y) == x * Y
assert X + y == X + Y == R.convert(x + y) == x + Y
assert X - y == X - Y == R.convert(x - y) == x - Y
assert X + 1 == R.convert(x + 1)
raises(ExactQuotientFailed, lambda: X/Y)
raises(ExactQuotientFailed, lambda: x/Y)
raises(ExactQuotientFailed, lambda: X/y)
assert X**2 / X == X
assert R.from_GlobalPolynomialRing(ZZ.old_poly_ring(x, y).convert(x), ZZ.old_poly_ring(x, y)) == X
assert R.from_FractionField(Qxy.convert(x), Qxy) == X
assert R.from_FractionField(Qxy.convert(x)/y, Qxy) is None
assert R._sdm_to_vector(R._vector_to_sdm([X, Y], R.order), 2) == [X, Y]
开发者ID:AALEKH,项目名称:sympy,代码行数:26,代码来源:test_polynomialring.py
示例3: test_Domain_get_ring
def test_Domain_get_ring():
assert ZZ.has_assoc_Ring is True
assert QQ.has_assoc_Ring is True
assert ZZ[x].has_assoc_Ring is True
assert QQ[x].has_assoc_Ring is True
assert ZZ[x, y].has_assoc_Ring is True
assert QQ[x, y].has_assoc_Ring is True
assert ZZ.frac_field(x).has_assoc_Ring is True
assert QQ.frac_field(x).has_assoc_Ring is True
assert ZZ.frac_field(x, y).has_assoc_Ring is True
assert QQ.frac_field(x, y).has_assoc_Ring is True
assert EX.has_assoc_Ring is False
assert RR.has_assoc_Ring is False
assert ALG.has_assoc_Ring is False
assert ZZ.get_ring() == ZZ
assert QQ.get_ring() == ZZ
assert ZZ[x].get_ring() == ZZ[x]
assert QQ[x].get_ring() == QQ[x]
assert ZZ[x, y].get_ring() == ZZ[x, y]
assert QQ[x, y].get_ring() == QQ[x, y]
assert ZZ.frac_field(x).get_ring() == ZZ[x]
assert QQ.frac_field(x).get_ring() == QQ[x]
assert ZZ.frac_field(x, y).get_ring() == ZZ[x, y]
assert QQ.frac_field(x, y).get_ring() == QQ[x, y]
assert EX.get_ring() == EX
raises(DomainError, lambda: RR.get_ring())
raises(DomainError, lambda: ALG.get_ring())
开发者ID:JustinL42,项目名称:sympy,代码行数:31,代码来源:test_domains.py
示例4: test_Domain_get_ring
def test_Domain_get_ring():
assert ZZ.has_assoc_Ring is True
assert QQ.has_assoc_Ring is True
assert ZZ[x].has_assoc_Ring is True
assert QQ[x].has_assoc_Ring is True
assert ZZ[x, y].has_assoc_Ring is True
assert QQ[x, y].has_assoc_Ring is True
assert ZZ.frac_field(x).has_assoc_Ring is True
assert QQ.frac_field(x).has_assoc_Ring is True
assert ZZ.frac_field(x, y).has_assoc_Ring is True
assert QQ.frac_field(x, y).has_assoc_Ring is True
assert EX.has_assoc_Ring is False
assert RR.has_assoc_Ring is False
assert ALG.has_assoc_Ring is False
assert ZZ.get_ring() == ZZ
assert QQ.get_ring() == ZZ
assert ZZ[x].get_ring() == ZZ[x]
assert QQ[x].get_ring() == QQ[x]
assert ZZ[x, y].get_ring() == ZZ[x, y]
assert QQ[x, y].get_ring() == QQ[x, y]
assert ZZ.frac_field(x).get_ring() == ZZ[x]
assert QQ.frac_field(x).get_ring() == QQ[x]
assert ZZ.frac_field(x, y).get_ring() == ZZ[x, y]
assert QQ.frac_field(x, y).get_ring() == QQ[x, y]
assert EX.get_ring() == EX
assert RR.get_ring() == RR
# XXX: This should also be like RR
raises(DomainError, lambda: ALG.get_ring())
开发者ID:Lenqth,项目名称:sympy,代码行数:32,代码来源:test_domains.py
示例5: test_Domain_get_ring
def test_Domain_get_ring():
assert ZZ.has_assoc_Ring == True
assert QQ.has_assoc_Ring == True
assert ZZ[x].has_assoc_Ring == True
assert QQ[x].has_assoc_Ring == True
assert ZZ[x,y].has_assoc_Ring == True
assert QQ[x,y].has_assoc_Ring == True
assert ZZ.frac_field(x).has_assoc_Ring == True
assert QQ.frac_field(x).has_assoc_Ring == True
assert ZZ.frac_field(x,y).has_assoc_Ring == True
assert QQ.frac_field(x,y).has_assoc_Ring == True
assert EX.has_assoc_Ring == False
assert RR.has_assoc_Ring == False
assert ALG.has_assoc_Ring == False
assert ZZ.get_ring() == ZZ
assert QQ.get_ring() == ZZ
assert ZZ[x].get_ring() == ZZ[x]
assert QQ[x].get_ring() == QQ[x]
assert ZZ[x,y].get_ring() == ZZ[x,y]
assert QQ[x,y].get_ring() == QQ[x,y]
assert ZZ.frac_field(x).get_ring() == ZZ[x]
assert QQ.frac_field(x).get_ring() == QQ[x]
assert ZZ.frac_field(x,y).get_ring() == ZZ[x,y]
assert QQ.frac_field(x,y).get_ring() == QQ[x,y]
raises(DomainError, "EX.get_ring()")
raises(DomainError, "RR.get_ring()")
raises(DomainError, "ALG.get_ring()")
开发者ID:Jerryy,项目名称:sympy,代码行数:30,代码来源:test_domains.py
示例6: test_DMP_to_dict
def test_DMP_to_dict():
f = DMP([[3],[],[2],[],[8]], ZZ)
assert f.to_dict() == \
{(4, 0): 3, (2, 0): 2, (0, 0): 8}
assert f.to_sympy_dict() == \
{(4, 0): ZZ.to_sympy(3), (2, 0): ZZ.to_sympy(2), (0, 0): ZZ.to_sympy(8)}
开发者ID:addisonc,项目名称:sympy,代码行数:7,代码来源:test_polyclasses.py
示例7: test_localring
def test_localring():
Qxy = QQ.old_frac_field(x, y)
R = QQ.old_poly_ring(x, y, order="ilex")
X = R.convert(x)
Y = R.convert(y)
assert x in R
assert 1/x not in R
assert 1/(1 + x) in R
assert Y in R
assert X.ring == R
assert X*(Y**2 + 1)/(1 + X) == R.convert(x*(y**2 + 1)/(1 + x))
assert X*y == X*Y
raises(ExactQuotientFailed, lambda: X/Y)
raises(ExactQuotientFailed, lambda: x/Y)
raises(ExactQuotientFailed, lambda: X/y)
assert X + y == X + Y == R.convert(x + y) == x + Y
assert X - y == X - Y == R.convert(x - y) == x - Y
assert X + 1 == R.convert(x + 1)
assert X**2 / X == X
assert R.from_GlobalPolynomialRing(ZZ.old_poly_ring(x, y).convert(x), ZZ.old_poly_ring(x, y)) == X
assert R.from_FractionField(Qxy.convert(x), Qxy) == X
raises(CoercionFailed, lambda: R.from_FractionField(Qxy.convert(x)/y, Qxy))
raises(ExactQuotientFailed, lambda: X/Y)
raises(NotReversible, lambda: X.invert())
assert R._sdm_to_vector(
R._vector_to_sdm([X/(X + 1), Y/(1 + X*Y)], R.order), 2) == \
[X*(1 + X*Y), Y*(1 + X)]
开发者ID:AALEKH,项目名称:sympy,代码行数:30,代码来源:test_polynomialring.py
示例8: test_gf_monic
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])
开发者ID:AALEKH,项目名称:sympy,代码行数:8,代码来源:test_galoistools.py
示例9: test_Domain_map
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
开发者ID:Jerryy,项目名称:sympy,代码行数:8,代码来源:test_domains.py
示例10: test_dup_count_complex_roots_1
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
开发者ID:FireJade,项目名称:sympy,代码行数:8,代码来源:test_rootisolation.py
示例11: test_Domain_convert
def test_Domain_convert():
assert QQ.convert(10e-52) == QQ(
1684996666696915, 1684996666696914987166688442938726917102321526408785780068975640576
)
R, x = ring("x", ZZ)
assert ZZ.convert(x - x) == 0
assert ZZ.convert(x - x, R.to_domain()) == 0
开发者ID:latot,项目名称:sympy,代码行数:8,代码来源:test_domains.py
示例12: test_gf_frobenius_map
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
开发者ID:AALEKH,项目名称:sympy,代码行数:9,代码来源:test_galoistools.py
示例13: test_dmp_cancel
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)
开发者ID:addisonc,项目名称:sympy,代码行数:9,代码来源:test_euclidtools.py
示例14: test_dup_primitive_prs
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)]]
开发者ID:addisonc,项目名称:sympy,代码行数:9,代码来源:test_euclidtools.py
示例15: test_dup_lcm
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]
开发者ID:jenshnielsen,项目名称:sympy,代码行数:11,代码来源:test_euclidtools.py
示例16: test_Domain_preprocess
def test_Domain_preprocess():
assert Domain.preprocess(ZZ) == ZZ
assert Domain.preprocess(QQ) == QQ
assert Domain.preprocess(EX) == EX
assert Domain.preprocess(FF(2)) == FF(2)
assert Domain.preprocess(ZZ[x, y]) == ZZ[x, y]
assert Domain.preprocess('Z') == ZZ
assert Domain.preprocess('Q') == QQ
assert Domain.preprocess('ZZ') == ZZ
assert Domain.preprocess('QQ') == QQ
assert Domain.preprocess('EX') == EX
assert Domain.preprocess('FF(23)') == FF(23)
assert Domain.preprocess('GF(23)') == GF(23)
raises(OptionError, lambda: Domain.preprocess('Z[]'))
assert Domain.preprocess('Z[x]') == ZZ[x]
assert Domain.preprocess('Q[x]') == QQ[x]
assert Domain.preprocess('ZZ[x]') == ZZ[x]
assert Domain.preprocess('QQ[x]') == QQ[x]
assert Domain.preprocess('Z[x,y]') == ZZ[x, y]
assert Domain.preprocess('Q[x,y]') == QQ[x, y]
assert Domain.preprocess('ZZ[x,y]') == ZZ[x, y]
assert Domain.preprocess('QQ[x,y]') == QQ[x, y]
raises(OptionError, lambda: Domain.preprocess('Z()'))
assert Domain.preprocess('Z(x)') == ZZ.frac_field(x)
assert Domain.preprocess('Q(x)') == QQ.frac_field(x)
assert Domain.preprocess('ZZ(x)') == ZZ.frac_field(x)
assert Domain.preprocess('QQ(x)') == QQ.frac_field(x)
assert Domain.preprocess('Z(x,y)') == ZZ.frac_field(x, y)
assert Domain.preprocess('Q(x,y)') == QQ.frac_field(x, y)
assert Domain.preprocess('ZZ(x,y)') == ZZ.frac_field(x, y)
assert Domain.preprocess('QQ(x,y)') == QQ.frac_field(x, y)
assert Domain.preprocess('Q<I>') == QQ.algebraic_field(I)
assert Domain.preprocess('QQ<I>') == QQ.algebraic_field(I)
assert Domain.preprocess('Q<sqrt(2), I>') == QQ.algebraic_field(sqrt(2), I)
assert Domain.preprocess(
'QQ<sqrt(2), I>') == QQ.algebraic_field(sqrt(2), I)
raises(OptionError, lambda: Domain.preprocess('abc'))
开发者ID:A-turing-machine,项目名称:sympy,代码行数:54,代码来源:test_polyoptions.py
示例17: test_dup_count_complex_roots_8
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
开发者ID:FireJade,项目名称:sympy,代码行数:12,代码来源:test_rootisolation.py
示例18: test_Domain___eq__
def test_Domain___eq__():
assert (ZZ[x,y] == ZZ[x,y]) == True
assert (QQ[x,y] == QQ[x,y]) == True
assert (ZZ[x,y] == QQ[x,y]) == False
assert (QQ[x,y] == ZZ[x,y]) == False
assert (ZZ.frac_field(x,y) == ZZ.frac_field(x,y)) == True
assert (QQ.frac_field(x,y) == QQ.frac_field(x,y)) == True
assert (ZZ.frac_field(x,y) == QQ.frac_field(x,y)) == False
assert (QQ.frac_field(x,y) == ZZ.frac_field(x,y)) == False
开发者ID:Jerryy,项目名称:sympy,代码行数:12,代码来源:test_domains.py
示例19: test_Domain_preprocess
def test_Domain_preprocess():
assert Domain.preprocess(ZZ) == ZZ
assert Domain.preprocess(QQ) == QQ
assert Domain.preprocess(EX) == EX
assert Domain.preprocess(FF(2)) == FF(2)
assert Domain.preprocess(ZZ[x, y]) == ZZ[x, y]
assert Domain.preprocess("Z") == ZZ
assert Domain.preprocess("Q") == QQ
assert Domain.preprocess("ZZ") == ZZ
assert Domain.preprocess("QQ") == QQ
assert Domain.preprocess("EX") == EX
assert Domain.preprocess("FF(23)") == FF(23)
assert Domain.preprocess("GF(23)") == GF(23)
raises(OptionError, "Domain.preprocess('Z[]')")
assert Domain.preprocess("Z[x]") == ZZ[x]
assert Domain.preprocess("Q[x]") == QQ[x]
assert Domain.preprocess("ZZ[x]") == ZZ[x]
assert Domain.preprocess("QQ[x]") == QQ[x]
assert Domain.preprocess("Z[x,y]") == ZZ[x, y]
assert Domain.preprocess("Q[x,y]") == QQ[x, y]
assert Domain.preprocess("ZZ[x,y]") == ZZ[x, y]
assert Domain.preprocess("QQ[x,y]") == QQ[x, y]
raises(OptionError, "Domain.preprocess('Z()')")
assert Domain.preprocess("Z(x)") == ZZ.frac_field(x)
assert Domain.preprocess("Q(x)") == QQ.frac_field(x)
assert Domain.preprocess("ZZ(x)") == ZZ.frac_field(x)
assert Domain.preprocess("QQ(x)") == QQ.frac_field(x)
assert Domain.preprocess("Z(x,y)") == ZZ.frac_field(x, y)
assert Domain.preprocess("Q(x,y)") == QQ.frac_field(x, y)
assert Domain.preprocess("ZZ(x,y)") == ZZ.frac_field(x, y)
assert Domain.preprocess("QQ(x,y)") == QQ.frac_field(x, y)
assert Domain.preprocess("Q<I>") == QQ.algebraic_field(I)
assert Domain.preprocess("QQ<I>") == QQ.algebraic_field(I)
assert Domain.preprocess("Q<sqrt(2), I>") == QQ.algebraic_field(sqrt(2), I)
assert Domain.preprocess("QQ<sqrt(2), I>") == QQ.algebraic_field(sqrt(2), I)
raises(OptionError, "Domain.preprocess('abc')")
开发者ID:,项目名称:,代码行数:53,代码来源:
示例20: test_Domain_get_exact
def test_Domain_get_exact():
assert EX.get_exact() == EX
assert ZZ.get_exact() == ZZ
assert QQ.get_exact() == QQ
assert RR.get_exact() == QQ
assert ALG.get_exact() == ALG
assert ZZ[x].get_exact() == ZZ[x]
assert QQ[x].get_exact() == QQ[x]
assert ZZ[x,y].get_exact() == ZZ[x,y]
assert QQ[x,y].get_exact() == QQ[x,y]
assert ZZ.frac_field(x).get_exact() == ZZ.frac_field(x)
assert QQ.frac_field(x).get_exact() == QQ.frac_field(x)
assert ZZ.frac_field(x,y).get_exact() == ZZ.frac_field(x,y)
assert QQ.frac_field(x,y).get_exact() == QQ.frac_field(x,y)
开发者ID:Jerryy,项目名称:sympy,代码行数:14,代码来源:test_domains.py
注:本文中的sympy.polys.domains.ZZ类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论