6

That is, real numbers modulo an integer. I'm just interested in shuffling around the $+$, $-$, $*$, and $/$ operations.

In case a concrete example helps, here's my current problem. (I'm from a programming background so there's probably a notation disconnect, sorry about that.)

$$ LI(x) = (LI_0 + x / PI) \bmod 1 $$

$$ LF(x) = (LF_0 + x / PF) \bmod 1 $$

$$ LI(s) + 0.5 = LF(f) $$

$$ f = s + PT / 2 $$

I need to find a solution for $s$, given $LI_0$, $LF_0$, $PI$, $PF$ and $PT$.

Also I think I might have a solution by dropping the "$\bmod 1$"s, solving for $s$ and then modding that by:

$$\frac{1}{ \left| \frac{1}{PI} - \frac{1}{PF} \right| }$$

But I can't tell if that actually works because it introduces an enormous rounding error.

Also, while this is the problem at hand and solving it is my immediate goal, I really want to understand how to generate that solution, for next time.

  • You can't do modular arithmetic with real numbers. (Actually, you can't even do modular arithmetic with rational numbers.) All you're doing is taking the remainder after some division operation. – Zhen Lin Aug 03 '11 at 10:22
  • 5
    well, the reals is an abelian group and contains the integers, so we can certainly mod out by any multiple of the integers. – Tobias Kildetoft Aug 03 '11 at 10:43
  • 8
    @Tobias: But that only works if you restrict yourself to addition. As soon as you start multiplying, you run into problems because the integers don't form an ideal of the real numbers. – Arturo Magidin Aug 03 '11 at 10:59
  • 3
    Working "modulo 1" is equivalent to working with the fractional part function, which is defined as ${x}=x-\lfloor x\rfloor$. Perhaps those magic words will give you the push you need. – Arturo Magidin Aug 03 '11 at 11:46

2 Answers2

9

Addition and subtraction are well-behaved, since the "circle group" is an abelian group.

Multiplication doesn't work: $2/3$ is the same as $-1/3$ and $3/5$ is the same as $-2/5$, but $(2/3)\cdot(3/5)$ doesn't end up being the same as $(-1/3)\cdot(-2/5)$.

3

So, what you need first of all is $LIo + \frac{s}{PI} + \frac{1}{2} = LFo + \frac{s + PT/2}{PF} + n$ for some integer $n$. That can be solved in the usual way (in terms of $n$):

$$ s = \frac{(2 LFo PF+PT-PF+2 n PF-2 LIo PF) PI}{2 (PF - PI)} $$

The only other requirement is that you need $\{ LIo + \frac{s}{PI} \} < \frac{1}{2}$. You'll have to see which $n$ will make that work. Given particular values of the parameters, that should be either easy or impossible.

For example, I tried $LFo=1,LIo=2,PF=3,PI=4,PT=5$, obtaining $s = 8 - 12 n$. Then $\{LIo + \frac{s}{PI}\} = \{4 - 3 n\} = 0$, so this works for any $n$.

On the other hand, with $LFo=1,LIo=2,PF=3,PI=5,PT=6$ I get $s = \frac{15 - 30 n}{4}$ and $\{LIo + \frac{s}{PI}\} = \{ \frac{11 - 6 n}{4} \}$. Now you need $11 - 6 n \equiv 0 \text{ or } 1 \mod 4$: 0 is impossible, but any odd $n$ will give you 1.

Robert Israel
  • 448,999