9.33 HexadecimalExpansion

All rationals have repeating hexadecimal expansions. The operation hexhexHexadecimalExpansion returns these expansions of type HexadecimalExpansion. Operations to access the individual numerals of a hexadecimal expansion can be obtained by converting the value to RadixExpansion(16). More examples of expansions are available in the DecimalExpansionXmpPage , BinaryExpansionXmpPage , and RadixExpansionXmpPage .

This is a hexadecimal expansion of a rational number.

r := hex(22/7)
\[\]
3.249‾

Type: HexadecimalExpansion

Arithmetic is exact.

r + hex(6/7)
\[\]
4

Type: HexadecimalExpansion

The period of the expansion can be short or long ...

[hex(1/i) for i in 350..354]
\[\]
[0.00BB3EE721A54D88‾,0.00BAB6561‾,0.00BA2E8‾,0.00B9A7862A0FF465879D5F‾,0.00B92143FA36F5E02E4850FE8DBD78‾]

Type: List HexadecimalExpansion

or very long!

hex(1/1007)
\[\]
0.0041149783F0BF2C7D13933192AF6980619EE345E91EC2BB9D5CC‾A5C071E40926E54E8DDAE24196C0B2F8A0AAD60DBA57F5D4C8‾536262210C74F1‾

Type: HexadecimalExpansion

These numbers are bona fide algebraic objects.

p := hex(1/4)*x^2 + hex(2/3)*x + hex(4/9)
\[\]
0.4x2+0.A‾x+0.71C‾

Type: Polynomial HexadecimalExpansion

q := D(p, x)
\[\]
0.8x+0.A‾

Type: Polynomial HexadecimalExpansion

g := gcd(p, q)
\[\]
x+1.5‾

Type: Polynomial HexadecimalExpansion