本文整理汇总了Python中sympy.polys.domains.ZZ.frac_field方法的典型用法代码示例。如果您正苦于以下问题:Python ZZ.frac_field方法的具体用法?Python ZZ.frac_field怎么用?Python ZZ.frac_field使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sympy.polys.domains.ZZ
的用法示例。
在下文中一共展示了ZZ.frac_field方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_Domain_get_ring
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import frac_field [as 别名]
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()")
示例2: test_Domain_get_ring
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import frac_field [as 别名]
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())
示例3: test_Domain_get_ring
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import frac_field [as 别名]
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())
示例4: test_Domain_preprocess
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import frac_field [as 别名]
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'))
示例5: test_Domain___eq__
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import frac_field [as 别名]
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
示例6: test_Domain_preprocess
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import frac_field [as 别名]
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')")
示例7: test_Domain_get_exact
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import frac_field [as 别名]
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)
示例8: test_Domain___eq__
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import frac_field [as 别名]
def test_Domain___eq__():
assert (ZZ[x, y] == ZZ[x, y]) is True
assert (QQ[x, y] == QQ[x, y]) is True
assert (ZZ[x, y] == QQ[x, y]) is False
assert (QQ[x, y] == ZZ[x, y]) is False
assert (ZZ.frac_field(x, y) == ZZ.frac_field(x, y)) is True
assert (QQ.frac_field(x, y) == QQ.frac_field(x, y)) is True
assert (ZZ.frac_field(x, y) == QQ.frac_field(x, y)) is False
assert (QQ.frac_field(x, y) == ZZ.frac_field(x, y)) is False
assert RealField()[x] == RR[x]
示例9: test_Domain_get_field
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import frac_field [as 别名]
def test_Domain_get_field():
assert EX.has_assoc_Field == True
assert ZZ.has_assoc_Field == True
assert QQ.has_assoc_Field == True
assert RR.has_assoc_Field == False
assert ALG.has_assoc_Field == True
assert ZZ[x].has_assoc_Field == True
assert QQ[x].has_assoc_Field == True
assert ZZ[x,y].has_assoc_Field == True
assert QQ[x,y].has_assoc_Field == True
assert EX.get_field() == EX
assert ZZ.get_field() == QQ
assert QQ.get_field() == QQ
raises(DomainError, "RR.get_field()")
assert ALG.get_field() == ALG
assert ZZ[x].get_field() == ZZ.frac_field(x)
assert QQ[x].get_field() == QQ.frac_field(x)
assert ZZ[x,y].get_field() == ZZ.frac_field(x,y)
assert QQ[x,y].get_field() == QQ.frac_field(x,y)
示例10: test_Domain_get_field
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import frac_field [as 别名]
def test_Domain_get_field():
assert EX.has_assoc_Field is True
assert ZZ.has_assoc_Field is True
assert QQ.has_assoc_Field is True
assert RR.has_assoc_Field is True
assert ALG.has_assoc_Field is True
assert ZZ[x].has_assoc_Field is True
assert QQ[x].has_assoc_Field is True
assert ZZ[x, y].has_assoc_Field is True
assert QQ[x, y].has_assoc_Field is True
assert EX.get_field() == EX
assert ZZ.get_field() == QQ
assert QQ.get_field() == QQ
assert RR.get_field() == RR
assert ALG.get_field() == ALG
assert ZZ[x].get_field() == ZZ.frac_field(x)
assert QQ[x].get_field() == QQ.frac_field(x)
assert ZZ[x, y].get_field() == ZZ.frac_field(x, y)
assert QQ[x, y].get_field() == QQ.frac_field(x, y)
示例11: test_Domain_unify_composite
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import frac_field [as 别名]
def test_Domain_unify_composite():
assert unify(ZZ.poly_ring(x), ZZ) == ZZ.poly_ring(x)
assert unify(ZZ.poly_ring(x), QQ) == QQ.poly_ring(x)
assert unify(QQ.poly_ring(x), ZZ) == QQ.poly_ring(x)
assert unify(QQ.poly_ring(x), QQ) == QQ.poly_ring(x)
assert unify(ZZ, ZZ.poly_ring(x)) == ZZ.poly_ring(x)
assert unify(QQ, ZZ.poly_ring(x)) == QQ.poly_ring(x)
assert unify(ZZ, QQ.poly_ring(x)) == QQ.poly_ring(x)
assert unify(QQ, QQ.poly_ring(x)) == QQ.poly_ring(x)
assert unify(ZZ.poly_ring(x, y), ZZ) == ZZ.poly_ring(x, y)
assert unify(ZZ.poly_ring(x, y), QQ) == QQ.poly_ring(x, y)
assert unify(QQ.poly_ring(x, y), ZZ) == QQ.poly_ring(x, y)
assert unify(QQ.poly_ring(x, y), QQ) == QQ.poly_ring(x, y)
assert unify(ZZ, ZZ.poly_ring(x, y)) == ZZ.poly_ring(x, y)
assert unify(QQ, ZZ.poly_ring(x, y)) == QQ.poly_ring(x, y)
assert unify(ZZ, QQ.poly_ring(x, y)) == QQ.poly_ring(x, y)
assert unify(QQ, QQ.poly_ring(x, y)) == QQ.poly_ring(x, y)
assert unify(ZZ.frac_field(x), ZZ) == ZZ.frac_field(x)
assert unify(ZZ.frac_field(x), QQ) == QQ.frac_field(x)
assert unify(QQ.frac_field(x), ZZ) == QQ.frac_field(x)
assert unify(QQ.frac_field(x), QQ) == QQ.frac_field(x)
assert unify(ZZ, ZZ.frac_field(x)) == ZZ.frac_field(x)
assert unify(QQ, ZZ.frac_field(x)) == QQ.frac_field(x)
assert unify(ZZ, QQ.frac_field(x)) == QQ.frac_field(x)
assert unify(QQ, QQ.frac_field(x)) == QQ.frac_field(x)
assert unify(ZZ.frac_field(x, y), ZZ) == ZZ.frac_field(x, y)
assert unify(ZZ.frac_field(x, y), QQ) == QQ.frac_field(x, y)
assert unify(QQ.frac_field(x, y), ZZ) == QQ.frac_field(x, y)
assert unify(QQ.frac_field(x, y), QQ) == QQ.frac_field(x, y)
assert unify(ZZ, ZZ.frac_field(x, y)) == ZZ.frac_field(x, y)
assert unify(QQ, ZZ.frac_field(x, y)) == QQ.frac_field(x, y)
assert unify(ZZ, QQ.frac_field(x, y)) == QQ.frac_field(x, y)
assert unify(QQ, QQ.frac_field(x, y)) == QQ.frac_field(x, y)
assert unify(ZZ.poly_ring(x), ZZ.poly_ring(x)) == ZZ.poly_ring(x)
assert unify(ZZ.poly_ring(x), QQ.poly_ring(x)) == QQ.poly_ring(x)
assert unify(QQ.poly_ring(x), ZZ.poly_ring(x)) == QQ.poly_ring(x)
assert unify(QQ.poly_ring(x), QQ.poly_ring(x)) == QQ.poly_ring(x)
assert unify(ZZ.poly_ring(x, y), ZZ.poly_ring(x)) == ZZ.poly_ring(x, y)
assert unify(ZZ.poly_ring(x, y), QQ.poly_ring(x)) == QQ.poly_ring(x, y)
assert unify(QQ.poly_ring(x, y), ZZ.poly_ring(x)) == QQ.poly_ring(x, y)
assert unify(QQ.poly_ring(x, y), QQ.poly_ring(x)) == QQ.poly_ring(x, y)
assert unify(ZZ.poly_ring(x), ZZ.poly_ring(x, y)) == ZZ.poly_ring(x, y)
assert unify(ZZ.poly_ring(x), QQ.poly_ring(x, y)) == QQ.poly_ring(x, y)
assert unify(QQ.poly_ring(x), ZZ.poly_ring(x, y)) == QQ.poly_ring(x, y)
assert unify(QQ.poly_ring(x), QQ.poly_ring(x, y)) == QQ.poly_ring(x, y)
assert unify(ZZ.poly_ring(x, y), ZZ.poly_ring(x, z)) == ZZ.poly_ring(x, y, z)
assert unify(ZZ.poly_ring(x, y), QQ.poly_ring(x, z)) == QQ.poly_ring(x, y, z)
assert unify(QQ.poly_ring(x, y), ZZ.poly_ring(x, z)) == QQ.poly_ring(x, y, z)
assert unify(QQ.poly_ring(x, y), QQ.poly_ring(x, z)) == QQ.poly_ring(x, y, z)
assert unify(ZZ.frac_field(x), ZZ.frac_field(x)) == ZZ.frac_field(x)
assert unify(ZZ.frac_field(x), QQ.frac_field(x)) == QQ.frac_field(x)
assert unify(QQ.frac_field(x), ZZ.frac_field(x)) == QQ.frac_field(x)
assert unify(QQ.frac_field(x), QQ.frac_field(x)) == QQ.frac_field(x)
assert unify(ZZ.frac_field(x, y), ZZ.frac_field(x)) == ZZ.frac_field(x, y)
assert unify(ZZ.frac_field(x, y), QQ.frac_field(x)) == QQ.frac_field(x, y)
assert unify(QQ.frac_field(x, y), ZZ.frac_field(x)) == QQ.frac_field(x, y)
assert unify(QQ.frac_field(x, y), QQ.frac_field(x)) == QQ.frac_field(x, y)
assert unify(ZZ.frac_field(x), ZZ.frac_field(x, y)) == ZZ.frac_field(x, y)
assert unify(ZZ.frac_field(x), QQ.frac_field(x, y)) == QQ.frac_field(x, y)
assert unify(QQ.frac_field(x), ZZ.frac_field(x, y)) == QQ.frac_field(x, y)
assert unify(QQ.frac_field(x), QQ.frac_field(x, y)) == QQ.frac_field(x, y)
assert unify(ZZ.frac_field(x, y), ZZ.frac_field(x, z)) == ZZ.frac_field(x, y, z)
assert unify(ZZ.frac_field(x, y), QQ.frac_field(x, z)) == QQ.frac_field(x, y, z)
assert unify(QQ.frac_field(x, y), ZZ.frac_field(x, z)) == QQ.frac_field(x, y, z)
assert unify(QQ.frac_field(x, y), QQ.frac_field(x, z)) == QQ.frac_field(x, y, z)
assert unify(ZZ.poly_ring(x), ZZ.frac_field(x)) == ZZ.frac_field(x)
assert unify(ZZ.poly_ring(x), QQ.frac_field(x)) == ZZ.frac_field(x)
assert unify(QQ.poly_ring(x), ZZ.frac_field(x)) == ZZ.frac_field(x)
assert unify(QQ.poly_ring(x), QQ.frac_field(x)) == QQ.frac_field(x)
assert unify(ZZ.poly_ring(x, y), ZZ.frac_field(x)) == ZZ.frac_field(x, y)
assert unify(ZZ.poly_ring(x, y), QQ.frac_field(x)) == ZZ.frac_field(x, y)
assert unify(QQ.poly_ring(x, y), ZZ.frac_field(x)) == ZZ.frac_field(x, y)
assert unify(QQ.poly_ring(x, y), QQ.frac_field(x)) == QQ.frac_field(x, y)
assert unify(ZZ.poly_ring(x), ZZ.frac_field(x, y)) == ZZ.frac_field(x, y)
assert unify(ZZ.poly_ring(x), QQ.frac_field(x, y)) == ZZ.frac_field(x, y)
assert unify(QQ.poly_ring(x), ZZ.frac_field(x, y)) == ZZ.frac_field(x, y)
assert unify(QQ.poly_ring(x), QQ.frac_field(x, y)) == QQ.frac_field(x, y)
assert unify(ZZ.poly_ring(x, y), ZZ.frac_field(x, z)) == ZZ.frac_field(x, y, z)
assert unify(ZZ.poly_ring(x, y), QQ.frac_field(x, z)) == ZZ.frac_field(x, y, z)
assert unify(QQ.poly_ring(x, y), ZZ.frac_field(x, z)) == ZZ.frac_field(x, y, z)
assert unify(QQ.poly_ring(x, y), QQ.frac_field(x, z)) == QQ.frac_field(x, y, z)
#.........这里部分代码省略.........
示例12: test_construct_domain
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import frac_field [as 别名]
def test_construct_domain():
assert construct_domain([1, 2, 3]) == (ZZ, [ZZ(1), ZZ(2), ZZ(3)])
assert construct_domain([1, 2, 3], field=True) == (QQ, [QQ(1), QQ(2), QQ(3)])
assert construct_domain([S(1), S(2), S(3)]) == (ZZ, [ZZ(1), ZZ(2), ZZ(3)])
assert construct_domain([S(1), S(2), S(3)], field=True) == (QQ, [QQ(1), QQ(2), QQ(3)])
assert construct_domain([S(1)/2, S(2)]) == (QQ, [QQ(1, 2), QQ(2)])
result = construct_domain([3.14, 1, S(1)/2])
assert isinstance(result[0], RealField)
assert result[1] == [RR(3.14), RR(1.0), RR(0.5)]
assert construct_domain([3.14, sqrt(2)], extension=None) == (EX, [EX(3.14), EX(sqrt(2))])
assert construct_domain([3.14, sqrt(2)], extension=True) == (EX, [EX(3.14), EX(sqrt(2))])
assert construct_domain([1, sqrt(2)], extension=None) == (EX, [EX(1), EX(sqrt(2))])
assert construct_domain([x, sqrt(x)]) == (EX, [EX(x), EX(sqrt(x))])
assert construct_domain([x, sqrt(x), sqrt(y)]) == (EX, [EX(x), EX(sqrt(x)), EX(sqrt(y))])
alg = QQ.algebraic_field(sqrt(2))
assert construct_domain([7, S(1)/2, sqrt(2)], extension=True) == \
(alg, [alg.convert(7), alg.convert(S(1)/2), alg.convert(sqrt(2))])
alg = QQ.algebraic_field(sqrt(2) + sqrt(3))
assert construct_domain([7, sqrt(2), sqrt(3)], extension=True) == \
(alg, [alg.convert(7), alg.convert(sqrt(2)), alg.convert(sqrt(3))])
dom = ZZ[x]
assert construct_domain([2*x, 3]) == \
(dom, [dom.convert(2*x), dom.convert(3)])
dom = ZZ[x, y]
assert construct_domain([2*x, 3*y]) == \
(dom, [dom.convert(2*x), dom.convert(3*y)])
dom = QQ[x]
assert construct_domain([x/2, 3]) == \
(dom, [dom.convert(x/2), dom.convert(3)])
dom = QQ[x, y]
assert construct_domain([x/2, 3*y]) == \
(dom, [dom.convert(x/2), dom.convert(3*y)])
dom = RR[x]
assert construct_domain([x/2, 3.5]) == \
(dom, [dom.convert(x/2), dom.convert(3.5)])
dom = RR[x, y]
assert construct_domain([x/2, 3.5*y]) == \
(dom, [dom.convert(x/2), dom.convert(3.5*y)])
dom = ZZ.frac_field(x)
assert construct_domain([2/x, 3]) == \
(dom, [dom.convert(2/x), dom.convert(3)])
dom = ZZ.frac_field(x, y)
assert construct_domain([2/x, 3*y]) == \
(dom, [dom.convert(2/x), dom.convert(3*y)])
dom = RR.frac_field(x)
assert construct_domain([2/x, 3.5]) == \
(dom, [dom.convert(2/x), dom.convert(3.5)])
dom = RR.frac_field(x, y)
assert construct_domain([2/x, 3.5*y]) == \
(dom, [dom.convert(2/x), dom.convert(3.5*y)])
dom = RealField(prec=336)[x]
assert construct_domain([pi.evalf(100)*x]) == \
(dom, [dom.convert(pi.evalf(100)*x)])
assert construct_domain(2) == (ZZ, ZZ(2))
assert construct_domain(S(2)/3) == (QQ, QQ(2, 3))
assert construct_domain({}) == (ZZ, {})
示例13: test_Domain__unify
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import frac_field [as 别名]
def test_Domain__unify():
assert ZZ.unify(ZZ) == ZZ
assert QQ.unify(QQ) == QQ
assert ZZ.unify(QQ) == QQ
assert QQ.unify(ZZ) == QQ
assert EX.unify(EX) == EX
assert ZZ.unify(EX) == EX
assert QQ.unify(EX) == EX
assert EX.unify(ZZ) == EX
assert EX.unify(QQ) == EX
assert ZZ.poly_ring('x').unify(EX) == EX
assert ZZ.frac_field('x').unify(EX) == EX
assert EX.unify(ZZ.poly_ring('x')) == EX
assert EX.unify(ZZ.frac_field('x')) == EX
assert ZZ.poly_ring('x','y').unify(EX) == EX
assert ZZ.frac_field('x','y').unify(EX) == EX
assert EX.unify(ZZ.poly_ring('x','y')) == EX
assert EX.unify(ZZ.frac_field('x','y')) == EX
assert QQ.poly_ring('x').unify(EX) == EX
assert QQ.frac_field('x').unify(EX) == EX
assert EX.unify(QQ.poly_ring('x')) == EX
assert EX.unify(QQ.frac_field('x')) == EX
assert QQ.poly_ring('x','y').unify(EX) == EX
assert QQ.frac_field('x','y').unify(EX) == EX
assert EX.unify(QQ.poly_ring('x','y')) == EX
assert EX.unify(QQ.frac_field('x','y')) == EX
assert ZZ.poly_ring('x').unify(ZZ) == ZZ.poly_ring('x')
assert ZZ.poly_ring('x').unify(QQ) == QQ.poly_ring('x')
assert QQ.poly_ring('x').unify(ZZ) == QQ.poly_ring('x')
assert QQ.poly_ring('x').unify(QQ) == QQ.poly_ring('x')
assert ZZ.unify(ZZ.poly_ring('x')) == ZZ.poly_ring('x')
assert QQ.unify(ZZ.poly_ring('x')) == QQ.poly_ring('x')
assert ZZ.unify(QQ.poly_ring('x')) == QQ.poly_ring('x')
assert QQ.unify(QQ.poly_ring('x')) == QQ.poly_ring('x')
assert ZZ.poly_ring('x','y').unify(ZZ) == ZZ.poly_ring('x','y')
assert ZZ.poly_ring('x','y').unify(QQ) == QQ.poly_ring('x','y')
assert QQ.poly_ring('x','y').unify(ZZ) == QQ.poly_ring('x','y')
assert QQ.poly_ring('x','y').unify(QQ) == QQ.poly_ring('x','y')
assert ZZ.unify(ZZ.poly_ring('x','y')) == ZZ.poly_ring('x','y')
assert QQ.unify(ZZ.poly_ring('x','y')) == QQ.poly_ring('x','y')
assert ZZ.unify(QQ.poly_ring('x','y')) == QQ.poly_ring('x','y')
assert QQ.unify(QQ.poly_ring('x','y')) == QQ.poly_ring('x','y')
assert ZZ.frac_field('x').unify(ZZ) == ZZ.frac_field('x')
assert ZZ.frac_field('x').unify(QQ) == EX # QQ.frac_field('x')
assert QQ.frac_field('x').unify(ZZ) == EX # QQ.frac_field('x')
assert QQ.frac_field('x').unify(QQ) == QQ.frac_field('x')
assert ZZ.unify(ZZ.frac_field('x')) == ZZ.frac_field('x')
assert QQ.unify(ZZ.frac_field('x')) == EX # QQ.frac_field('x')
assert ZZ.unify(QQ.frac_field('x')) == EX # QQ.frac_field('x')
assert QQ.unify(QQ.frac_field('x')) == QQ.frac_field('x')
assert ZZ.frac_field('x','y').unify(ZZ) == ZZ.frac_field('x','y')
assert ZZ.frac_field('x','y').unify(QQ) == EX # QQ.frac_field('x','y')
assert QQ.frac_field('x','y').unify(ZZ) == EX # QQ.frac_field('x','y')
assert QQ.frac_field('x','y').unify(QQ) == QQ.frac_field('x','y')
assert ZZ.unify(ZZ.frac_field('x','y')) == ZZ.frac_field('x','y')
assert QQ.unify(ZZ.frac_field('x','y')) == EX # QQ.frac_field('x','y')
assert ZZ.unify(QQ.frac_field('x','y')) == EX # QQ.frac_field('x','y')
assert QQ.unify(QQ.frac_field('x','y')) == QQ.frac_field('x','y')
assert ZZ.poly_ring('x').unify(ZZ.poly_ring('x')) == ZZ.poly_ring('x')
assert ZZ.poly_ring('x').unify(QQ.poly_ring('x')) == QQ.poly_ring('x')
assert QQ.poly_ring('x').unify(ZZ.poly_ring('x')) == QQ.poly_ring('x')
assert QQ.poly_ring('x').unify(QQ.poly_ring('x')) == QQ.poly_ring('x')
assert ZZ.poly_ring('x','y').unify(ZZ.poly_ring('x')) == ZZ.poly_ring('x','y')
assert ZZ.poly_ring('x','y').unify(QQ.poly_ring('x')) == QQ.poly_ring('x','y')
assert QQ.poly_ring('x','y').unify(ZZ.poly_ring('x')) == QQ.poly_ring('x','y')
assert QQ.poly_ring('x','y').unify(QQ.poly_ring('x')) == QQ.poly_ring('x','y')
assert ZZ.poly_ring('x').unify(ZZ.poly_ring('x','y')) == ZZ.poly_ring('x','y')
assert ZZ.poly_ring('x').unify(QQ.poly_ring('x','y')) == QQ.poly_ring('x','y')
assert QQ.poly_ring('x').unify(ZZ.poly_ring('x','y')) == QQ.poly_ring('x','y')
assert QQ.poly_ring('x').unify(QQ.poly_ring('x','y')) == QQ.poly_ring('x','y')
assert ZZ.poly_ring('x','y').unify(ZZ.poly_ring('x','z')) == ZZ.poly_ring('x','y','z')
assert ZZ.poly_ring('x','y').unify(QQ.poly_ring('x','z')) == QQ.poly_ring('x','y','z')
assert QQ.poly_ring('x','y').unify(ZZ.poly_ring('x','z')) == QQ.poly_ring('x','y','z')
assert QQ.poly_ring('x','y').unify(QQ.poly_ring('x','z')) == QQ.poly_ring('x','y','z')
assert ZZ.frac_field('x').unify(ZZ.frac_field('x')) == ZZ.frac_field('x')
assert ZZ.frac_field('x').unify(QQ.frac_field('x')) == QQ.frac_field('x')
assert QQ.frac_field('x').unify(ZZ.frac_field('x')) == QQ.frac_field('x')
assert QQ.frac_field('x').unify(QQ.frac_field('x')) == QQ.frac_field('x')
assert ZZ.frac_field('x','y').unify(ZZ.frac_field('x')) == ZZ.frac_field('x','y')
#.........这里部分代码省略.........
示例14: _construct_composite
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import frac_field [as 别名]
def _construct_composite(coeffs, opt):
"""Handle composite domains, e.g.: ZZ[X], QQ[X], ZZ(X), QQ(X). """
numers, denoms = [], []
for coeff in coeffs:
numer, denom = coeff.as_numer_denom()
numers.append(numer)
denoms.append(denom)
polys, gens = parallel_dict_from_basic(numers + denoms) # XXX: sorting
if any(gen.is_number for gen in gens):
return None # generators are number-like so lets better use EX
n = len(gens)
k = len(polys) // 2
numers = polys[:k]
denoms = polys[k:]
if opt.field:
fractions = True
else:
fractions, zeros = False, (0,) * n
for denom in denoms:
if len(denom) > 1 or zeros not in denom:
fractions = True
break
result = []
if not fractions:
coeffs = set([])
for numer, denom in zip(numers, denoms):
denom = denom[zeros]
for monom, coeff in numer.iteritems():
coeff /= denom
coeffs.add(coeff)
numer[monom] = coeff
rationals, reals = False, False
for coeff in coeffs:
if coeff.is_Rational:
if not coeff.is_Integer:
rationals = True
elif coeff.is_Real:
reals = True
break
if reals:
ground = RR
elif rationals:
ground = QQ
else:
ground = ZZ
domain = ground.poly_ring(*gens)
for numer in numers:
for monom, coeff in numer.iteritems():
numer[monom] = ground.from_sympy(coeff)
result.append(domain(numer))
else:
domain = ZZ.frac_field(*gens)
for numer, denom in zip(numers, denoms):
for monom, coeff in numer.iteritems():
numer[monom] = ZZ.from_sympy(coeff)
for monom, coeff in denom.iteritems():
denom[monom] = ZZ.from_sympy(coeff)
result.append(domain((numer, denom)))
return domain, result
示例15: test_FractionField__init
# 需要导入模块: from sympy.polys.domains import ZZ [as 别名]
# 或者: from sympy.polys.domains.ZZ import frac_field [as 别名]
def test_FractionField__init():
F, = field("", ZZ)
assert ZZ.frac_field() == F.to_domain()