Karim Belabas on Sat, 15 Apr 2023 23:12:51 +0200


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

Re: How to compute modulo a complex ?


* tony.reix@laposte.net [2023-04-15 22:50]:
> Hi,I want to do:
> s=5
> s=Mod( (s^2-1)/(2*I*s) , 4 I )
> where I is the imaginary number. When trying, I get a forbiden
> division between polmod and complex.

No direct way. You can use the following function:

  cxmod(a, b) = my(q = a/b); a - (floor(real(q)) + I * floor(imag(q))) * b;

Cheers,

    K.B.
-- 
Pr Karim Belabas, U. Bordeaux, Vice-président en charge du Numérique
Institut de Mathématiques de Bordeaux UMR 5251 - (+33) 05 40 00 29 77
http://www.math.u-bordeaux.fr/~kbelabas/