Previous Up Next

7.1.11  Frequencies: frequencies frequences

Given a list of numbers, the frequencies (or frequences) command will return the numbers in the list with their frequencies; i.e., the fraction of list items equal to the number. For example,


will return


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, you can enter

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

and you might get


Previous Up Next