StringTools - Maple Programming Help

Home : Support : Online Help : Programming : Names and Strings : StringTools Package : Statistics : StringTools/ArithmeticMean

StringTools

 ArithmeticMean
 compute the arithmetic mean of the characters (bytes) in a string

 Calling Sequence ArithmeticMean( s )

Parameters

 s - Maple string

Description

 • The ArithmeticMean(s) command returns the arithmetic mean of the byte values of the characters present in the string s. The mean is computed as a floating-point number in hardware precision and is returned as a Maple float.
 • The arithmetic mean of a sufficiently long random string should be close to $128$.

Examples

 > $\mathrm{with}\left(\mathrm{StringTools}\right):$
 > $m≔\mathrm{ArithmeticMean}\left("cat"\right)$
 ${m}{≔}{104.}$ (1)
 > $\mathrm{Char}\left(\mathrm{round}\left(m\right)\right)$
 ${"h"}$ (2)
 > $\mathrm{ArithmeticMean}\left(\mathrm{Random}\left(1000000\right)\right)$
 ${128.004748000000006}$ (3)