# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# `card`

Cardinality of a set

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

## Syntax

```card(`set`)
card(`d`)
```

## Description

`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.

## Examples

### 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:

`card(Dom::IntegerMod(7))`

## Parameters

 `set` A set of type `DOM_SET`, or a set-theoretic expression `d` A domain representing a set

## Return Values

Nonnegative integer, or `infinity`.

` d`, `set`