Skip to content

AdicNumeral ​

A bb-adic number: the rational xx read in Zb\mathbb{Z}_b (or Qp\mathbb{Q}_p for prime bb), exact when built from a rational, +O(bprec)+ O(b^{prec}) when capped. The ring operations work on it.

AdicNumeral(b, x)exact: xx any rational whose denominator bb can invert
SageMathQp(b, 60)(QQ(x))Rustadic(b, x)
AdicNumeral(b, x, prec)xx known modulo bprecb^{prec}, normalised to its representative
AdicNumeral(b, x, prec?)A bb-adic number: the rational xx read in Zb\mathbb{Z}_b (or Qp\mathbb{Q}_p for prime bb), exact when built from a rational, +O(bprec)+ O(b^{prec}) when capped. The ring operations work on it.
Typed signatures
TypePackageApplies
(integer, rational | value, integer?) -> valueadelesreplaces numeralson ProfiniteNumber
(integer, rational | value, integer?) -> valuenumeralsalways

Domain: Numeral systems

Details
  • Two values share the head. An EXACT adic is a rational, and its expansion can be produced to any depth (it is eventually periodic). A CAPPED adic is known only modulo bprecb^{prec} — what a Hensel lift produces, and what any arithmetic with a capped operand yields; the precision of a sum is the weaker operand's, of a product min⁡(v1+p2,v2+p1)\min(v_1 + p_2, v_2 + p_1)
  • Prime bb gives the field Qp\mathbb{Q}_p: any non-zero divisor works and the result may have negative valuation (digits past the point). Composite bb gives the ring Zb\mathbb{Z}_b — no field, zero divisors, and division only by units (coprime to bb)
  • A rational the base cannot expand — 1/21/2 in Z10\mathbb{Z}_{10} — leaves the call standing
  • A rational operand beside an adic one is read in the same base, so AdicNumeral(10, 1/3) * 3 is AdicNumeral(10, 1). Adics of different bases never combine
  • Not a compute-engine number type: the value is a function expression, and Add, Multiply, Negate, Divide, Power are wrapped to recognise it (Subtract reaches them by canonicalisation)
  • Default precision for anything unbounded — Hensel lifting, AdicSqrt — is 20 digits

Examples

1 more kept as data, checked against the oracles
Basic #

…6667×3=1…6667 × 3 = 1: 1/31/3 is a 10-adic integer

live ↗
In3AdicNumeral(10,13)3\mathrm{AdicNumeral}(10, \frac{1}{3})OutAdicNumeral(10,1)\mathrm{AdicNumeral}(10, 1)

…999+1=0…999 + 1 = 0, carrying forever

live ↗
InAdicNumeral(10,−1)+1\mathrm{AdicNumeral}(10, -1)+1OutAdicNumeral(10,0)\mathrm{AdicNumeral}(10, 0)
Scope #

capped: the representative modulo 10810^8

live ↗
InAdicNumeral(10,13,8)\mathrm{AdicNumeral}(10, \frac{1}{3}, 8)OutAdicNumeral(10,66 666 667,8)\mathrm{AdicNumeral}(10, 66\,666\,667, 8)

prime base: Q5\mathbb{Q}_5 is a field, so the point moves

live ↗
InAdicNumeral(5,3)5\frac{\mathrm{AdicNumeral}(5, 3)}{5}OutAdicNumeral(5,35)\mathrm{AdicNumeral}(5, \frac{3}{5})

A negative power inverts exactly: 3−1=1/33^{-1}=1/3 in Z10\mathbf{Z}_{10}

live ↗
In1AdicNumeral(10,3)\frac{1}{\mathrm{AdicNumeral}(10, 3)}OutAdicNumeral(10,13)\mathrm{AdicNumeral}(10, \frac{1}{3})
Properties #

Adding two capped numerals keeps only the weaker operand's precision

live ↗
InAdicNumeral(10,13,8)+AdicNumeral(10,13,5)\mathrm{AdicNumeral}(10, \frac{1}{3}, 8)+\mathrm{AdicNumeral}(10, \frac{1}{3}, 5)OutAdicNumeral(10,33 334,5)\mathrm{AdicNumeral}(10, 33\,334, 5)

Multiplying by p2p^2 raises the absolute precision by 2 along with the value

live ↗
In25AdicNumeral(5,3,6)25\mathrm{AdicNumeral}(5, 3, 6)OutAdicNumeral(5,75,8)\mathrm{AdicNumeral}(5, 75, 8)
Possible issues #

composite base: 2 is not a unit of Z10\mathbb{Z}_{10}, so this declines

live ↗
InAdicNumeral(10,3)2\frac{\mathrm{AdicNumeral}(10, 3)}{2}OutAdicNumeral(10,3)2\frac{\mathrm{AdicNumeral}(10, 3)}{2}

Numerals over different bases never combine and stay unevaluated

live ↗
InAdicNumeral(7,2)+AdicNumeral(5,2)\mathrm{AdicNumeral}(7, 2)+\mathrm{AdicNumeral}(5, 2)OutAdicNumeral(7,2)+AdicNumeral(5,2)\mathrm{AdicNumeral}(7, 2)+\mathrm{AdicNumeral}(5, 2)
1 / 2

The exact zero has infinite valuation

live ↗
InAdicValuation(AdicNumeral(10,0))\mathrm{AdicValuation}(\mathrm{AdicNumeral}(10, 0))Out∞∞
About
Examples12
Checked againstSageMath 1 differ7 errorRust 1 agree7 error
CrosswalkSageMathRust

Implementation

mappedwolframpackages/oracle/src/mappings.ts

No p-adic or b-adic numeral type in Wolfram -- no prior art to map against. Wolfram Function Repository searched too; only ExponentLift turned up (a p-adic valuation helper via the lifting-the-exponent lemma), not a numeral value type.

mappedrustpackages/oracle/src/mappings.ts

The adic crate is p-adic only: our composite bases (10-adic) have no counterpart there.

mappedsagepackages/oracle/src/mappings.ts

Sage's Qp is prime-p only too: composite bases have no counterpart there.

See also: AdicExpansion, AdicValuation, AdicSqrt, HenselLift, IntegerDigits