当前位置: 首页>>代码示例>>Python>>正文


Python FiniteSet.subset方法代码示例

本文整理汇总了Python中sympy.FiniteSet.subset方法的典型用法代码示例。如果您正苦于以下问题:Python FiniteSet.subset方法的具体用法?Python FiniteSet.subset怎么用?Python FiniteSet.subset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sympy.FiniteSet的用法示例。


在下文中一共展示了FiniteSet.subset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_finite_basic

# 需要导入模块: from sympy import FiniteSet [as 别名]
# 或者: from sympy.FiniteSet import subset [as 别名]
def test_finite_basic():
    x = Symbol('x')
    A = FiniteSet(1, 2, 3)
    B = FiniteSet(3, 4, 5)
    AorB = Union(A, B)
    AandB = A.intersect(B)
    assert AorB.subset(A) and AorB.subset(B)
    assert A.subset(AandB)
    assert AandB == FiniteSet(3)

    assert A.inf == 1 and A.sup == 3
    assert AorB.inf == 1 and AorB.sup == 5
    assert FiniteSet(x, 1, 5).sup == Max(x, 5)
    assert FiniteSet(x, 1, 5).inf == Min(x, 1)

    # Ensure a variety of types can exist in a FiniteSet
    S = FiniteSet((1, 2), Float, A, -5, x, 'eggs', x**2, Interval)

    assert (A > B) is False
    assert (A >= B) is False
    assert (A < B) is False
    assert (A <= B) is False
    assert AorB > A and AorB > B
    assert AorB >= A and AorB >= B
    assert A >= A and A <= A
    assert A >= AandB and B >= AandB
    assert A > AandB and B > AandB
开发者ID:JoelBondurant,项目名称:sympy,代码行数:29,代码来源:test_sets.py

示例2: test_finite_basic

# 需要导入模块: from sympy import FiniteSet [as 别名]
# 或者: from sympy.FiniteSet import subset [as 别名]
def test_finite_basic():
    x = Symbol("x")
    A = FiniteSet(1, 2, 3)
    B = FiniteSet(3, 4, 5)
    AorB = Union(A, B)
    AandB = A.intersect(B)
    assert AorB.subset(A) and AorB.subset(B)
    assert A.subset(AandB)
    assert AandB == FiniteSet(3)

    assert A.inf == 1 and A.sup == 3
    assert AorB.inf == 1 and AorB.sup == 5
    assert FiniteSet(x, 1, 5).sup == Max(x, 5)
    assert FiniteSet(x, 1, 5).inf == Min(x, 1)

    # Ensure a variety of types can exist in a FiniteSet
    S = FiniteSet((1, 2), Float, A, -5, x, "eggs", x ** 2, Interval)
开发者ID:ness01,项目名称:sympy,代码行数:19,代码来源:test_sets.py

示例3: FiniteSet

# 需要导入模块: from sympy import FiniteSet [as 别名]
# 或者: from sympy.FiniteSet import subset [as 别名]
# Diferencia entre conjuntos
print A - B
print B - A

"""
Conjunto y operaciones con conjuntos usando la libreria SYMPY
"""

# Utilizando FiniteSet de sympy
from sympy import FiniteSet
C = FiniteSet(1, 2, 3)

# Subconjunto y subconjunto propio
A = FiniteSet(1,2,3)
B = FiniteSet(1,2,3,4,5)
A.subset(B)

# Union de dos conjuntos
A = FiniteSet(1, 2, 3)
B = FiniteSet(2, 4, 6)
A.union(B)


# Interseccion de dos conjuntos
A = FiniteSet(1, 2) 
B = FiniteSet(2, 3) 
A.intersect(B)


# Diferencia entre conjuntos
print A - B
开发者ID:josearcosaneas,项目名称:Matematicas-con-Python,代码行数:33,代码来源:conjuntos.py


注:本文中的sympy.FiniteSet.subset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。