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

Bill Allombert <[email protected]>
Newsgroups gmane.comp.mathematics.pari.user
Message-ID <aDWe55478TCCr2-L@seventeen>
On Tue, May 27, 2025 at 12:53:44PM +0200, [email protected] wrote:
> On 2025-05-27 00:40, Bill Allombert wrote:
> > > 
> > > The minimal residue of 1+4*I modulo 3+2*I is the yellow point -I in
> > > the
> > > example:
> > > https://en.wikipedia.org/wiki/Gaussian_integer#Describing_residue_classes
> > > 
> > > How can minimal residue of an input gaussian integer modulo a gaussian
> > > integer be computed in PARI/GP?
> > 
> > nf=nfinit(i^2+1)
> > a=1+4*i;b=3+2*i;
> > nfeltdivrem(nf,a,b)
> > %4 = [[1,1]~,[0,-1]~]
> > 
> > Cheers,
> > Bill.
> > 
> Thank you, so the rem part is what I asked for.
> Interesting, "i" is free variable and not sqrt(-1) which is "I" in GP.
> 
> Now that type(b) is t_POL, Mod(a,b) works as well.
> What is the meaning of "-5" in Mod(a,b) result?

This is the remainder of the Euclidean division of 1+4*x by 3+2*x.
Indeed:

? divrem( 1+4*x , 3+2*x)
%1 = [2,-5]~

Cheers,
Bill.
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.