MATHEMATICS

Minggu, 11 Maret 2012

Sets and multisets

A set is a collection of well defined and distinct objects. I remember it as I have learned the Set interface in Java, a Set has no duplicates and is not sorted: 'it models the mathematical set abstraction'.

But what if we want to study collections of well defined but not necessarily distinct objects? The easy way out is to simply define another base abstraction. The beauty of mathematics is that you don't have to. The body of mathematical knowledge is built from a minimal number of base abstractions. Then how should we define a multi-set?

Definition: Let S be a nonempty set. A multi-set M with underlying set S is a set of ordered pairs: $$M=\left\{ (s_i,n_i) | s_i \in S, n_i \in \mathbb{Z}^+ \right\},$$ where $n_i$ is the multiplicity of the element $s_i$.

A multi-set defined as, or using, a set.

Tidak ada komentar:

Posting Komentar