Open In App

Python | sympy.combinatorics.Subset().cardinality method

Last Updated : 28 Aug, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

With the help of sympy.combinatorics.Subset().cardinality method, we can find the total cardinality of subsets by using sympy.combinatorics.Subset().cardinality method.

Syntax : sympy.combinatorics.Subset().cardinality
Return : Return the total cardinality of subset.

Example #1 :
In this example we can see that by using sympy.combinatorics.Subset().cardinality method, we are able to get the total cardinality of subset.




# import sympy and subset
from sympy.combinatorics.subsets import Subset
      
# Using sympy.combinatorics.Subset().cardinality method
gfg = Subset(['c', 'e'], ['a', 'b', 'c', 'e'])
    
print(gfg.cardinality)


Output :

16

Example #2 :




# import sympy and subset
from sympy.combinatorics.subsets import Subset
      
# Using sympy.combinatorics.Subset().cardinality method
gfg = Subset(['c', 'e', 'f'], ['a', 'f', 'c', 'e'])
    
print(gfg.cardinality)


Output :

16


Similar Reads

SymPy | Subset.cardinality() in Python
Subset.cardinality() : cardinality() is a sympy Python library function that returns the number of all possible subsets. Syntax : sympy.combinatorics.subset.Subset.cardinality() Return : number of all possible subsets Code #1 : cardinality() Example # Python code explaining # SymPy.Subset.cardinality() # importing SymPy libraries from sympy.combina
1 min read
Python | SymPy Permutation.cardinality() method
Permutation.cardinality() : cardinality() is a sympy Python library function that returns all the possible number of permutation. Syntax : sympy.combinatorics.permutations.Permutation.cardinality() Return : all the possible number of permutation Code #1 : cardinality() Example # Python code explaining # SymPy.Permutation.cardinality() # importing S
1 min read
Python | SymPy combinatorics.conjugate() method
With the help of sympy.combinatorics.partitions.IntegerPartition().conjugate method, we can get the conjugate value of integer array passed as parameter in the sympy.combinatorics.partitions.IntegerPartition() method. Syntax : sympy.combinatorics.partitions.IntegerPartition().conjugate Return : Return the conjugate value of integer array. Example #
1 min read
Python | SymPy combinatorics.next_lex() method
With the help of sympy.combinatorics.partitions.IntegerPartition().next_lex() method, we can get the next partition of integer n in lexical order by using sympy.combinatorics.partitions.IntegerPartition().next_lex() method. Syntax : sympy.combinatorics.partitions.IntegerPartition().next_lex() Return : Return the lexical value of next partition of i
1 min read
Python | SymPy combinatorics.prev_lex() method
With the help of sympy.combinatorics.partitions.IntegerPartition().prev_lex() method, we can get the previous partition of integer n in lexical order by using sympy.combinatorics.partitions.IntegerPartition().prev_lex() method. Syntax : sympy.combinatorics.partitions.IntegerPartition().prev_lex() Return : Return the lexical value of previous partit
1 min read
Python | SymPy combinatorics.random_integer_partition() method
With the help of sympy.combinatorics.partitions.random_integer_partition() method, we can get the random partition of n in the form of reversed sorted list by using sympy.combinatorics.partitions.random_integer_partition() method. Syntax : sympy.combinatorics.partitions.random_integer_partition(n) Return : Return reversed sorted list of n partition
1 min read
SymPy | Subset.subset() in Python
Subset.subset() : subset() is a sympy Python library function that returns the subset represented by the current instance. Syntax : sympy.combinatorics.subset.Subset.subset() Return : the subset represented by the current instance. Code #1 : subset() Example # Python code explaining # SymPy.Subset.subset() # importing SymPy libraries from sympy.com
1 min read
SymPy | Subset.next_lexicographic() in Python
Subset.next_lexicographic() : next_lexicographic() is a sympy Python library function that returns the next lexicographically ordered subset. Syntax : sympy.combinatorics.subset.Subset.next_lexicographic() Return : the next lexicographically ordered subset Code #1 : next_lexicographic() Example # Python code explaining # SymPy.Subset.next_lexicogra
1 min read
SymPy | Subset.next_gray() in Python
Subset.next_gray() : next_gray() is a sympy Python library function that returns the next Gray code ordered subset. Syntax : sympy.combinatorics.subset.Subset.next_gray() Return : the next Gray code ordered subset Code #1 : next_gray() Example # Python code explaining # SymPy.Subset.next_gray() # importing SymPy libraries from sympy.combinatorics i
1 min read
SymPy | Subset.bitlist_from_subset() in Python
Subset.bitlist_from_subset() : bitlist_from_subset() is a sympy Python library function that returns the bit list corresponding to a subset. Syntax : sympy.combinatorics.subset.Subset.bitlist_from_subset() Return : bitlist corresponding to a subset Code #1 : bitlist_from_subset() Example # Python code explaining # SymPy.Subset.bitlist_from_subset()
1 min read
Article Tags :
Practice Tags :