hermann on Tue, 27 May 2025 18:27:45 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

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


On 2025-05-27 13:34, hermann@stamm-wilbrandt.de 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.