mathtools.partition_integer_by_ratio

abjad.tools.mathtools.partition_integer_by_ratio.partition_integer_by_ratio(n, ratio)[source]

Partition positive integer-equivalent n by ratio:

abjad> from abjad.tools import mathtools
abjad> mathtools.partition_integer_by_ratio(10, [1, 2])
[3, 7]

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

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

Partition negative integer-equivalent n by ratio:

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

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

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

Return result with weight equal to absolute value of n.

Raise type error on noninteger n.

Return list of integers.

This Page