ecl-logo Documentation

QuantityPartition

QuantityPartition[amount,maxAmount]amounts

divides amount into a list of amounts that are all equal to or below the maxAmount.

QuantityPartition[integer,maxInteger]integers

divides integer into a list of integers that are all equal to or below the maxInteger.

Details

    Input
    Output
    General Options
    Messages
  • IncompatibleUnitsSome provided quantities are not in compatible units. Please check CompatibleUnitQ on the inputs, and (if provided) the MinPartition option value.
    MinAboveMaxThe provided MinPartition option, `1`, exceeds the requested maximum partition size (`2`). Please ensure that the minimum partition size cutoff is below the maximum partiion size.

Examples

Basic Examples  (3)

Split a quantity into a list of quantities below a requested maximum, including a remainder:

Compatible but different units may be provided as the amount to split and the maximum amount:

If the amount to split is below the maximum amount, the input amount will be returned in a list:

Additional Examples  (4)

Split a mass for measurement into smaller amounts known to fit in a single weigh boat:

Determine the volumes of samples that will need to be gathered to match a total amount, with a known maximum amount per sample:

An empty list is returned if the amount to partition is below both the max and min partition thresholds:

The function can split Integers without units as well:

Options  (2)

MinPartition  (2)

Specify a minimum size for any remainder partitions:

Specify a minimum integer for any remainder partitions:

Messages  (2)

IncompatibleUnits  (1)

The amount to partition and max partition amount must be in compatible units:

MinAboveMax  (1)

The min partition option must be below the max partition amount: