Hexadecimal ExpansionΒΆ

All rationals have repeating hexadecimal expansions. The operation hex 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 DecimalExpansion, BinaryExpansion, and RadixExpansion.

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.0041149783F0BF2C7D13933192AF6980619EE345E91EC2BB9D5CCA5C071E40926E54E8D
   ______________________________________________
   DAE24196C0B2F8A0AAD60DBA57F5D4C8536262210C74F1
                    Type: HexadecimalExpansion

These numbers are bona fide algebraic objects.

p := hex(1/4)*x**2 + hex(2/3)*x + hex(4/9)
      2     _      ___
  0.4x  + 0.Ax + 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

See Also:

  • )help RadixExpansion
  • )help BinaryExpansion
  • )help DecimalExpansion
  • )show HexadecimalExpansion

Table Of Contents

This Page