Re: How to determine Mod(a,b) with t_COMPLEX b?

[email protected]
Newsgroups gmane.comp.mathematics.pari.user
Message-ID <[email protected]>
On 2025-05-27 13:34, [email protected] wrote:
>> 
>> Cheers,
>> 
>>     K.B.
>> 
> Thank you for that approach of using t_COMPLEX (t_POL in Bill's 
> approach).
> 
> I cannot find a difference in set of minimal residues for both 
> normalizations:
> 
> $ gp -q
> ? a = 1+4*I; b = 3+2*I;
> ? myround(z) = ceil(real(z)-1/2) + I * ceil(imag(z)-1/2);
> ? S=Set([a - round(a/b)*b |
> r<-[-real(b)..real(b)];i<-[-imag(b)..imag(b)];a<-[r+i*I]]);
> ? myS=Set([a - myround(a/b)*b |
> r<-[-real(b)..real(b)];i<-[-imag(b)..imag(b)];a<-[r+i*I]]);
> ? #S==norml2(b)&&#myS==norml2(b)
> 1
> ? setminus(S,myS)
> []
> ? setminus(myS,S)
> []
> ?
> 
> Regards,
> 
> Hermann.
> 
I found the reason for no difference — real(b) and imag(b) were relative 
prime.
If not relative prime, there are differences:

? b*=2
6 + 4*I
? S=Set([a - round(a/b)*b | 
r<-[-real(b)..real(b)];i<-[-imag(b)..imag(b)];a<-[r+i*I]]);
? myS=Set([a - myround(a/b)*b | 
r<-[-real(b)..real(b)];i<-[-imag(b)..imag(b)];a<-[r+i*I]]);
? #S==norml2(b)&&#myS==norml2(b)
1
? setminus(S,myS)
[-3 - 2*I, -1 - 5*I, 2 - 3*I]
? setminus(myS,S)
[-2 + 3*I, 1 + 5*I, 3 + 2*I]
?

Regards,

Hermann.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.