 Tally - Maple Help

Statistics

 Tally
 compute absolute frequencies Calling Sequence Tally(X, options) Parameters

 X - options - (optional) equation(s) of the form option=value where option is one of weights or output; specify options for the Tally function Description

 • The Tally function returns a table of distinct elements in X together with their frequencies. (See also Statistics[TallyInto]).
 • The first parameter X is the data set, given as e.g. a Vector. Options

 The options argument can contain one or more of the options shown below.
 • output=list or table -- Set the type of output returned. The default value is list. In either case, the output consists of equations of the form element=frequency.
 • weights=Array or list -- A vector of weights (one dimensional rtable). If weights are given, the Tally function will return distinct elements in X paired with their cumulative weights. Note that the weights provided must have type/realcons and the returned frequencies are floating-point, even if the problem is specified with exact values. Both the data array and the weights array must have the same number of elements. Notes

 • If the value of the output option is set to output=list, the order of elements in the list is session dependent. Examples

 > $\mathrm{with}\left(\mathrm{Statistics}\right):$
 > $A≔\mathrm{Array}\left(\left[3,3,3,1,1,a,b,b,a,a,a,a,\mathrm{\pi },\mathrm{\pi },\mathrm{\pi },\mathrm{\pi }\right]\right)$
 ${A}{≔}\left[\begin{array}{cccccccccccccccc}{3}& {3}& {3}& {1}& {1}& {a}& {b}& {b}& {a}& {a}& {a}& {a}& {\mathrm{\pi }}& {\mathrm{\pi }}& {\mathrm{\pi }}& {\mathrm{\pi }}\end{array}\right]$ (1)
 > $\mathrm{Tally}\left(A\right)$
 $\left[{1}{=}{2}{,}{\mathrm{\pi }}{=}{4}{,}{3}{=}{3}{,}{a}{=}{5}{,}{b}{=}{2}\right]$ (2)
 > $\mathrm{Tally}\left(A,\mathrm{output}=\mathrm{table}\right)$
 ${table}{}\left(\left[{1}{=}{2}{,}{\mathrm{\pi }}{=}{4}{,}{3}{=}{3}{,}{a}{=}{5}{,}{b}{=}{2}\right]\right)$ (3)
 > $C≔\mathrm{Array}\left(\left[3,3,1,a,b,\mathrm{\pi }\right]\right)$
 ${C}{≔}\left[\begin{array}{cccccc}{3}& {3}& {1}& {a}& {b}& {\mathrm{\pi }}\end{array}\right]$ (4)
 > $W≔\mathrm{Array}\left(\left[0.25,0.5,0.125,0.5,0.375,0.5625\right]\right)$
 ${W}{≔}\left[\begin{array}{cccccc}{0.25}& {0.5}& {0.125}& {0.5}& {0.375}& {0.5625}\end{array}\right]$ (5)
 > $\mathrm{Tally}\left(C,\mathrm{weights}=W\right)$
 $\left[{1}{=}{0.125000000000000}{,}{\mathrm{\pi }}{=}{0.562500000000000}{,}{3}{=}{0.750000000000000}{,}{a}{=}{0.500000000000000}{,}{b}{=}{0.375000000000000}\right]$ (6)