partition_integer_by_ratio

mathtools.partition_integer_by_ratio(n, ratio)

Partitions positive integer-equivalent n by ratio.

>>> mathtools.partition_integer_by_ratio(10, [1, 2])
[3, 7]

Partitions positive integer-equivalent n by ratio with negative parts:

>>> mathtools.partition_integer_by_ratio(10, [1, -2])
[3, -7]

Partitions negative integer-equivalent n by ratio:

>>> mathtools.partition_integer_by_ratio(-10, [1, 2])
[-3, -7]

Partitions negative integer-equivalent n by ratio with negative parts:

>>> mathtools.partition_integer_by_ratio(-10, [1, -2])
[-3, 7]

Returns result with weight equal to absolute value of n.

Raises type error on noninteger n.

Returns list of integers.