Cardinality of a set

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.




card(set) returns the cardinality of set.

If set is a DOM_SET, the number of operands is returned; card does not attempt to investigate whether the members of set really represent pairwise different mathematical objects.

card does not distinguish different infinite cardinals; it just returns infinity if set is infinite.

card returns a symbolic call to itself if it cannot determine the cardinality.

If applied to a domain d, card returns the domain entry d::size. A domain that does not have this entry is not regarded as a set.


Example 1

The cardinality of a finite set equals the number of its operands:

card({1, 2, 3})

This holds true even if there exist two operands of the set that represent the same mathematical object:

card({1, 1.0})

Example 2

card does not distinguish different sizes of infinite sets:

card(R_), card(Z_)

Example 3

Set-theoretic expressions containing symbols are legal input, but usually card will not be able to determine their cardinality:

card(S union {3})

Example 4

Domains that have a "size" entry are regarded as sets:




A set of type DOM_SET, or a set-theoretic expression


A domain representing a set

Return Values

Nonnegative integer, or infinity.

Overloaded By

d, set

See Also

MuPAD Functions

Was this topic helpful?