a=b (mod c) means that a-b is a multiple of c. Therefore, there is no "order requirement". If a=b (mod c) then it must be that b=a (mod c).
For the example 38=14 (mod c), 38-14 is a multiple of c, that is, 24 is a multiple of c, and so c can be any of the divisors of 24 (1 2 3 4 6 8 12 24). The Wikipedia article makes a distinction between a=b (mod c) and a≡b (mod c) . I have not run across any situations where this distinction is necessary, because to me both are readily understandable and correct (and equivalent). (Mind you, I am not a professional mathematician.) ----- Original Message ----- From: Tracy Harms <[EMAIL PROTECTED]> Date: Saturday, May 24, 2008 18:31 Subject: [Jprogramming] modular equality To: [email protected] > I'm using J notation as notation for basic modular > arithmetic. The standard mathematical notation for > congruence is three horizontal bars. (In the example here that > character is between the first two integers.) An example > assertion of congruence: > > 38 ≡ 14 (mod 12) > > The same example in J: > > 38 14 cgt 12 > 1 > > given: > > cgt =: [: =/ |~ NB. Items of x are congruent, modulo y > > if all values are integers, the left parameter is a pair of > values, and the right parameter is scalar. > > My problem at the moment is actually a domain difficulty, not a > coding problem. I want to also write a verb for modular > equality. Doing so will allow the following contrast: > > 38 14 cgt 12 NB. items of x are congruent > modulo y > 1 > 38 14 meq 12 NB. items of x are non-equal > modulo y > 0 > > The falsity of the second statement can be understood from this: > > [begin quotation] > Equality implies specifically the "common residue", the least > non-negative member of an equivalence class. > [end quotation] > > For the example at hand, that common residue is 2: > > 12 | 38 14 > 2 2 > > The quotation is from the Wikipedia article on modular > arithmetic, in the section Remainders. > http://en.wikipedia.org/wiki/Modular_arithmetic#Remainders > > If I may be allowed a non-J question, I'm looking for help > determining what the left parameter must satisfy in order for > verb meq to return true. I'm sure one of the pair must be the > common residue, but I don't know whether order matters. > The last sentence of the first paragraph in the section I quoted > from may be flawed, but I'm not qualified to fix it. > > If there is no ordering requirement and I've not otherwise > misappraised modular equality, it can be coded so: > > meq =: [ ((e.~ <./) * [:=/]) |~ ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
