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


  • 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.


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  (2)

Decompose an exact number using a basis of exact numbers:

Decompose an exact numeric quantity using an exact basis:

Use inexact numbers:

Properties & Relations  (6)

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:

Introduced in 2015