Max Alekseyev on Sun, 15 Nov 2015 16:36:18 +0100


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

Re: chinese([])


Hi Karim,

Thank you for the fix.

Kurt Foster and I have had some off-list discussion about this issue, which can be summarized in the following two main points.
I argued that Mod(0,1) is a proper way to define chinese([]), since Mod(0,1) is basically the identity with respect to the binary 'chinese' operation. That is, chinese(q,Mod(0,1))=q for any intmod q. It also allows the equality chinese(concat(v1,v2)) == chinese(chinese(v1),chinese(v2)) to hold even if one of vectors v1,v2 is empty.
However, Kurt argued that this all good only for intmods but not polmods due to the following error:

?  chinese(Mod(1+x,x^2),Mod(0,1))
  ***   at top-level: chinese(Mod(1+x,x^2)
  ***                 ^--------------------
  *** chinese: inconsistent chinese t_POLMOD , t_INTMOD.

Personally I see nothing wrong with mixing polmods with intmods, since the latter can be cast to polmods, at least specifically for Mod(0,1).
(I'm not sure how good PARI at support computations modulo non-monic polynomials).

Regards,
Max





On Sun, Nov 15, 2015 at 10:01 AM, Karim Belabas <Karim.Belabas@math.u-bordeaux.fr> wrote:
* Max Alekseyev [2015-11-11 23:28]:
> Is there any reason why chinese([]) returns 1?

History... The underlying routine started out as a generic product
before being adapted to associative operators which could benefit from
divide&conquer approach.

Since empty product := 1, it remained that way for the general case as
well.

> I would rather argue that it should return Mod(0,1).
> First, it's t_INTMOD as any other chinese(...) outputl; and second, it
> includes all integers as they all reside in every residue class from the
> empty vector [].

Fixed in master. Thanks for pointing that out !

    K.B.
--
Karim Belabas, IMB (UMR 5251)  Tel: (+33) (0)5 40 00 26 17
Universite de Bordeaux         Fax: (+33) (0)5 40 00 69 50
351, cours de la Liberation    http://www.math.u-bordeaux.fr/~kbelabas/
F-33405
Talence (France)       http://pari.math.u-bordeaux.fr/  [PARI/GP]
`