Loïc Grenié on Sun, 03 Nov 2024 17:16:10 +0100


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

Re: Is there a simpler way to get all 8 gaussian integers with same norml2() ?


On Sun 3 Nov, 2024, at 16:00, Hermann wrote:

? id(c)=c;
? neg(x)=-x;
? flip(c)=I*conj(c);
? c=7+4*I;vecsort([f(g(h(c)))|f<-[id,conj];g<-[id,neg];h<-[id,flip]])
[-7 - 4*I, -7 + 4*I, -4 - 7*I, -4 + 7*I, 4 - 7*I, 4 + 7*I, 7 - 4*I, 7 +
4*I]

    It depends what you want and what "simpler" means. If you need
  the integers such that {|Re z|,|Im z|} are {a,b}, then what you
  wrote is probably one of the possibilities. I offer

assoc(c)=concat(apply(c->[c,-c],[c,I*c,conj(c),I*conj(c)]));
assoc(7+4*I)
[4 + 7*I,-4 - 7*I,-7 + 4*I,7 - 4*I,4 - 7*I,-4 + 7*I,7 + 4*I,-7 - 4*I]

   which is not any simpler. If you need all the integers with a given
  norm, then, as stated by John Cremona, qfminin is your friend.

         Loïc