Frequencies: frequencies frequences

### 9.1.12 Frequencies: frequencies frequences

The frequency of a number in a list is the fraction of the list equal to the number. The frequencies command finds the frequencies of the numbers in a list.
frequences is a synonym for frequencies.

- frequencies takes one argument:
  L, a list of numbers.
- frequencies(L) returns a list whose elements are the numbers in the list and their frequencies.

Example.
Input:

frequencies([1,2,1,1,2,1,2,4,3,3])

Output:

⎡ ⎢ ⎢ ⎢ ⎣ |
1 | 0.4
2 | 0.3
3 | 0.2
4 | 0.1
| ⎤ ⎥ ⎥ ⎥ ⎦

You can use this, for example, to simulate flipping a fair coin and seeing how many times each side appears; to flip a coin 1000 times, for example:
Input:

frequencies([rand(2) $ (k=1..1000)])

Output (for example):

⎡ ⎢ ⎣ |
0 | 0.484
1 | 0.516
| ⎤ ⎥ ⎦

(See Section 9.3.1 for information on rand.)