]>
It possible to expand numbers in general bases.
Here we expand 111 in base 5. This means
You can expand fractions to form repeating expansions.
For bases from 11 to 36 the letters A through Z are used.
For bases greater than 36, the ragits are separated by blanks.
The RadixExpansion type provides operations to obtain the individual ragits. Here is a rational number in base 8.
The operation wholeRagitswholeRagitsRadixExpansion returns a list of the ragits for the integral part of the number.
The operations prefixRagitsprefixRagitsRadixExpansion and cycleRagitscycleRagitsRadixExpansion return lists of the initial and repeating ragits in the fractional part of the number.
You can construct any radix expansion by giving the whole, prefix and cycle parts. The declaration is necessary to let Axiom know the base of the ragits.
If there is no repeating part, then the list [0] should be used.
If you are not interested in the repeating nature of the expansion, an infinite stream of ragits can be obtained using fractRagitsfractRagitsRadixExpansion.
Of course, it's possible to recover the fraction representation:
More examples of expansions are available in DecimalExpansionXmpPage , BinaryExpansionXmpPage , and HexadecimalExpansionXmpPage .