Re: ChineseRemainder
- To: mathgroup at smc.vnet.net
- Subject: [mg56995] Re: ChineseRemainder
- From: dh <dh at metrohm.ch>
- Date: Thu, 12 May 2005 02:32:35 -0400 (EDT)
- References: <d5ski6$nvj$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
HiDana,
see below
Sincerely, Daniel
Dana DeLouis wrote:
> Hello. I have a question on the function "ChineseRemainder." Could anyone
> offer an explanation on the following behavior? Thanks.
>
> Here's the package...
>
> Needs["NumberTheory`NumberTheoryFunctions`"]
>
> The following small example has no solution, and returns the null set, which
> is ok...
>
> list1={2,3,4};list2={9,4,8};
>
> r=ChineseRemainder[list1,list2]
>
> {}
>
>
> The following returns a solution of 94.
>
> list1={2,3,4};list2={4,7,9};
>
> r=ChineseRemainder[list1,list2]
>
> 94
>
> According to Help on this function, we can test the solution with the
> following, and it correctly returns list1.
>
> Mod[r,list2]
>
> {2,3,4}
>
>
> These similar numbers return a different solution.
>
> list1={2,3,4};list2={9,7,4};
>
> r=ChineseRemainder[list1,list2]
>
> 164
>
>
> However, it does not correctly return list1. (According to help)
>
> Mod[r,list2]
>
> {2,3,0}
This is correct. By definition of ChineseRemainder:
r == list2 mod list1.
Therefore Mathematica says 164 == 0 mod 4 and because 0 == 4 mod 4 this also
means that 164 == 4 mod 4
>
> This happens often in my program, and I'm having a tough time trusting the
> solution. Does anyone familiar with this have any insight? Thanks.
>
> I note that Mathematica's built-in ChineseRemainder function returns the
> same answer, so I'm sure Mathematica is doing it correctly. I guess I don't
> understand why Mod[r,list2] will often not return list1 (According to help).
>
> Reduce`RChineseRemainder[list1, list2]
>
> 164
>
> Thank you for any insight.
> Dana
>
> $Version
> "5.1 for Microsoft Windows (January 27, 2005)"
>