mathtools.cumulative_signed_weights

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

Cumulative signed weights of sequence:

abjad> from abjad.tools import mathtools
abjad> l = [1, -2, -3, 4, -5, -6, 7, -8, -9, 10]
abjad> mathtools.cumulative_signed_weights(l)
[1, -3, -6, 10, -15, -21, 28, -36, -45, 55]

Raise type error when sequence is not a list.

For cumulative (unsigned) weights use mathtools.cumulative_sums([abs(x) for x in l]).

Return list.

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

This Page