-1

I've found cases where I would like to compute (x mod z) where x is a Real number (the result of a division) and z is an integer. I've found that rounding the result can throw off my algorithm - it is necessary to preserve any fractional component in what I'm doing.

As such, I wanted to try to find a proper definition for mod over the Reals. I've found floating point modulus definitions provided by programming languages/apis, but thus far I haven't been able to find a proper, standard mathematical definition. Where can I find it?

1 Answers1

2

I would describe what you want to do as working with the quotient group $\mathbf R/m\mathbf Z$, where $m$ is an integer (probably positive).

But watch out: unlike in ordinary modular arithmetic with just integers, $\mathbf R/m\mathbf Z$ is an additive group but is not a ring. To get a ring as a quotient object from $\mathbf R$ you want to work modulo an ideal in $\mathbf R$. An ideal is a special type of additive subgroup (one that “swallows” multiplication from the whole ring), and $m\mathbf Z$ is not an ideal in $\mathbf R$ when $m > 0$. The upshot us that you can’t expect to get any useful notion of multiplication in $\mathbf R/m\mathbf Z$.

KCd
  • 46,062
  • Thanks :) I will do more research into quotient groups and the semantics of R/mZ

    For my case, I'm not concerned with Rings or Ideals - I just need the wrapping property provided by modulus to work with fractions. Since I'd like to publish this algorithm eventually, I'd like to use the proper terminology.

    – Ryan Pierce Williams Jan 06 '23 at 19:50
  • So you only want to use $\mathbf Q/m\mathbf Z$? That too is an additive group, but it's not a ring in any reasonable way for the same reason as with $\mathbf R/m\mathbf Z$. The "wrapping property" just seems to mean "use a quotient group". You can't expect to have a set of representatives in $\mathbf Q$ for $\mathbf Q/m\mathbf Z$ that is closed under addition; you don't even have an additively closed set of integer representatives for $\mathbf Z/m\mathbf Z$ when $m > 0$. – KCd Jan 06 '23 at 19:55
  • I only require division and taking the modulus of a Real over an Integer (repeatedly). I require that the fractions be retained since if I rounded they could accidentally cancel other terms in my recursive formula. – Ryan Pierce Williams Jan 06 '23 at 20:02
  • Division of rationals by (nonzero) rationals in $\mathbf Q/m\mathbf Z$ is not well-defined when $m > 0$, e.g., if $r - s \in 5\mathbf Z$ then $r/2 - s/2$ is usually not in $5\mathbf Z$. Please give definitions of what "division" and "taking the modulus" is supposed to mean in $\mathbf Q/m\mathbf Z$. – KCd Jan 06 '23 at 22:11