ResidueClass
as a VALUE — an element of that arithmetic stays inside, after Sage's Mod(a, m). compute-engine's head, strict about moduli: IntegerMod is its Sage-flavoured sibling.
ResidueClass(k, n)the residue class of , normalised into Mod(k, n)ResidueClass(u/v, n)a rational reads as , when is a unit mod Mod(u/v, n)ResidueClass(ResidueClass(k, m), n)the same class read in , for Mod(k, m)Typed signatures
| Type | Package | Applies |
|---|---|---|
(any, any) -> value | compute-engine | always |
(any, any) -> value | residuesreplaces compute-engine | always |
Details
- Mod answers an integer;
ResidueClassIS the class, so+,·,/and powers of it are computed in — a negative power inverts, and dividing by a non-unit leaves the call standing - A bare integer or rational next to a class is read in the same ring
- Classes of different moduli never combine: the sum stays as written, so holds. Sage's coercion to is not followed; IntegerMod follows it
- ChineseRemainder of classes is the class mod that reduces to each, and MultiplicativeOrder of a unit is its order
- The elements of QuotientRing(Integers, n),
- Written ;
a \pmod{n}is read as a class too,a \bmod nis still Mod, anda \equiv b \pmod{n}is still a congruence - A call that declines — dividing by a non-unit — stays unevaluated with a
ResidueClass::ninvmessage, after Wolfram'sPowerMod::ninv - IntegerMod, the head's old name, is now the Sage-flavoured sibling: the same arithmetic, with classes of different moduli combined in
Examples
10 more kept as data, checked against the oraclesPossible issues #
About
| Examples | 19 |
|---|---|
| Crosswalk | SageMath |
Implementation
wolframpackages/oracle/src/mappings.tsWolfram's Mod/PowerMod answer a plain Integer, not a persistent ring element -- the same distinction this head's own details draw against our own Mod. FiniteField/FiniteFieldElement DOES keep a residue as a persistent value with +, ·, ^-1 (kernel-verified: FiniteField[7][3]+FiniteField[7][5] = FiniteFieldElement[.., {1}], FiniteField[7][3]^-1 = {5}, matching this head's own examples) -- but only for prime modulus; FiniteField[4] silently reinterprets 4 as GF(2^2), a different structure with no zero divisors, not the ring Z/4Z this head also supports (kernel-verified wrong for our composite-modulus examples), and FiniteField[6] errors outright. No single template is safe across this head's mixed prime/composite examples, so it stays unmapped for wolfram.
sagepackages/oracle/src/mappings.ts See also: IntegerMod, QuotientRing, Mod, ChineseRemainder, AdicNumeral