cumulative_signed_weights

mathtools.cumulative_signed_weights(sequence)

Cumulative signed weights of sequence.

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

Raises type error when sequence is not a list.

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

Returns list.