cumulative_signed_weights

mathtools.cumulative_signed_weights(argument)

Gets cumulative signed weights of argument.

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

Raises type error when argument is not iterable.

Returns new object of argument type.