# NumberDecompose

NumberDecompose[x,{u1,,un}]

returns a list of coefficients {c1,,cn} of a decomposition of the number x in the basis {u1,,un}.

# Details • The basis {u1,,un} must be a list of nonincreasing positive numbers.
• The result has the same length of the basis, even if the initial coefficients are zero.
• The coefficients {c1,,cn-1} are integers, but cn will be exact or not depending on the precision of x and the basis elements.
• NumberDecompose[x,units] for negative x is equivalent to -NumberDecompose[-x,units].

# Examples

open allclose all

## Basic Examples(2)

Decompose an amount of money in different denominations:

Decompose an amount of seconds in days, hours, minutes, and seconds:

## Scope(3)

Decompose an exact number using a basis of exact numbers:

Decompose an exact numeric quantity using an exact basis:

Use inexact numbers:

Decompose a negative number:

This is equivalent to the negative of the decomposition of its absolute value:

## Applications(2)

Decompose an amount of United States dollars in the available banknote denominations:

Decompose an amount of Bahamian dollars in the available banknote denominations:

## Properties & Relations(7)

The result of NumberDecompose is a list of non-negative numbers for a positive input:

The result is a list of nonpositive numbers for a negative input:

NumberCompose is the inverse of NumberDecompose:

DMSList is a special case of NumberDecompose:

The length of the result equals the length of the basis:

For integers, NumberDecompose returns the last solution found by FrobeniusSolve:

IntegerDigits is equivalent to NumberDecompose for an adequate choice of basis of units:

IntegerDigits with a MixedRadix specification performs a NumberDecompose operation: