mathtools.arithmetic_mean

abjad.tools.mathtools.arithmetic_mean.arithmetic_mean(sequence)[source]

New in version 1.1.

Arithmetic means of sequence as an exact integer:

abjad> from abjad.tools import mathtools
abjad> mathtools.arithmetic_mean([1, 2, 2, 20, 30])
11

As a rational:

abjad> mathtools.arithmetic_mean([1, 2, 20])
Fraction(23, 3)

As a float:

abjad> mathtools.arithmetic_mean([2, 2, 20.0])
8.0

Return number.

Changed in version 2.0: renamed sequencetools.arithmetic_mean() to mathtools.arithmetic_mean().

This Page