Mod
The remainder of a on division by b.
✓ checked against that system · ! checked, with disagreements (hover a chip)Wikipedia
ModuloMathWorldModWikidataQ1799665DLMFfront/introduction.common.t2.r10FungrimMod✓Fungrim entry54093175231e959a25✓Wolfram LanguageMod!Mod(a, b)remainder of on division by , with the sign of .SageMath
enumeratio_mod(a, b)Oscarmod(a, b)Juliamod(a, b)Rustmod_floor(a, b)Mod(a, b, d)the with .Mod(z, m)for Gaussian integers, : the remainder in the box around 0SageMath
enumeratio_mod(z, m)Oscarmod(z, m)Juliamod(z, m)Rustmod_floor(z, m)Mod(a, b, d?)The remainder of a on division by b.Typed signatures
| Type | Package | Applies |
|---|---|---|
(real, real) -> real | analyticreplaces compute-engine | always |
(real, real) -> real | compute-engine | always |
(real, real) -> real | residuesreplaces analytic | always |
(number, number, number?) -> number | number-theoryreplaces residues | always |
Details
- Equivalent to , i.e. .
- When the result lies in ; the sign of the result always matches the sign of .
- Periodic: for any integer .
- compute-engine returns NaN for a zero modulus rather than leaving the call unevaluated.
- A third argument offsets the range to , as Wolfram's Mod[a, b, d] does.
- Sage's
Mod(a, m)builds a residue class, which is IntegerMod here (IntegerMod(a, m)keeps its modulus);Mod(a, m)is the remainder, a plain number, as in Wolfram. Sage'sa % mis this head.
Examples
30 more kept as data, checked against the oraclesBasic #
live ↗
InOut
live ↗
InOut
Sage's Mod(17, 5) is a residue class, IntegerMod; Mod(17, 5) here is the remainder 2, a plain integer
InOut
Applications #
Properties #
Odd numbers leave remainder 1 modulo 2
live ↗InOut
Known value · Wolfram MathematicalFunctionData, Mod
The remainders modulo 3 cycle through 0, 1, 2
live ↗InOut
Known value · Wolfram MathematicalFunctionData, Mod
The remainder is smaller than the modulus 8
live ↗InOut
Known value · Wolfram MathematicalFunctionData, Mod
Negative operands take the sign of the divisor
live ↗InOut
Known value · Wolfram MathematicalFunctionData, Mod
Possible issues #
About
| Examples | 87 |
|---|---|
| Checked against | Wolfram Language 83 agree3 differSageMath 21 agree3 errorSymPy 48 agree17 differ12 unevaluated5 errormathlib4 4 agree1 unevaluated1 errorOscar 9 agree10 errorJulia 10 agree8 errorRust 7 agree9 error |
| Crosswalk | WikipediaMathWorldWikidataDLMFFungrimFungrim entry ×3Wolfram LanguageSageMathOscarJuliaRust |
Implementation
mapped
wolframpackages/oracle/src/mappings.tsmapped
sympypackages/oracle/src/mappings.tsmapped
sagepackages/oracle/src/mappings.tsmapped
oscarpackages/oracle/src/mappings.tsmapped
juliapackages/oracle/src/mappings.tsmapped
mathlib4packages/oracle/src/mappings.tsmapped
rustpackages/oracle/src/mappings.ts See also: PowerMod, IntegerMod