Karim Belabas on Sat, 25 Mar 2023 22:29:05 +0100
|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: polrootsmod(f,p) with f%p==0
|
- To: Max Alekseyev <maxale@gmail.com>
- Subject: Re: polrootsmod(f,p) with f%p==0
- From: Karim Belabas <Karim.Belabas@math.u-bordeaux.fr>
- Date: Sat, 25 Mar 2023 22:27:50 +0100
- Arc-authentication-results: i=1; smail; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1679779664; c=relaxed/relaxed; bh=59pLUOYvtI6Y9cSacjOpixHBTS4h8flkTBDHk278M9Y=; h=DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: Mail-Followup-To:References:MIME-Version:Content-Type: Content-Disposition:Content-Transfer-Encoding:In-Reply-To; b=MfYDkBI+7DeG4W+u+lb8hG7r2oyPuvNvqBVKrOMuk7uqs7qo5ZIYT1hdf0BBllk9rCIQw9w7wBdENkC5QsvxhbtcEAoLyd/qWV1DxhGHAANw7CVmhxO4sujKWlPLMsb3EfuQAFwCbbTr2m6q/u5X4dtirkgLRaUqsJ6vXn2N+HTujFkhCJi1r5KalbPgi2LaCpX62HAXFkDsyw1R76Hpk8OYjziNwv4Uy3a2IdHc79fLXLuvZ1c/lXwph39p/CcM4tRI4djN5Q8HnvAOBa7D1FjyQwqH4PH7kXdFQJronffHT2ol9pH1mdkBv9S/F6edKMbQbCTVAIBK2DqXnZFQURqjniRnnkJ3EwbwcNa2FEQx9t/xZQ6UVKj4hRcA7r8rqd9EXYWsYm4zGaH7EN9HGgOKQq9TEEBoKwyL+x83U5bIPMeQ8MEXZW9RKGkb+h3fnSf1ltAimG4gWuJJEoNt59yKBXpu5kiY0CdpZjFBkoPqDwPAKeSaX/+iW/ubGPDxIB57HW8+ijDYIxui3KNQEo8XJ+eeX1J3GnHIALdKLWHrIWi99NUhlRoXnxjUTJMfpHOFkMKJ5auuIg55fuwnhOmMbHcb5JNbl7xH231RnHBb/J/dLyvJu6m7Rdepjg2+QNqKhajyza8gfrlVerOtyXlkolUYHbA4UzlQ915ncSk=
- Arc-seal: i=1; a=rsa-sha256; d=math.u-bordeaux.fr; s=openarc; t=1679779664; cv=none; b=W91qAXqN9yzkqA38qLrxXcSvtDYhpDXeqRNdb96Wm56S06eZanDAv97whc9um9NG3gAYOMfb0eT6tJFkJCZ2t32Esmnpno/+zIY5qKSPjpydwEiI+u9pAiPFwh4X8suCurgVuh93RS/9YqWo+X+Q+uAUvfR4EiaUi2NwSIDh8I5TUI4ydslrVE5zD/DmwvUmXqJ60Y6SToh7gWVG9lObVbvD21SUITQoOOcxk6xq/JpQiuMljB3V/nsSRcZ6mlQ8DDj4lcEGw/a72UmrsNlkO3hylCRRHvaG2MCqPXHJls0inMAQyruIlQcgU3HOvugbnyDufoP2Y1bkfYl7+dMz1WXUjdSUEu5QrHIlP3IvS7PuhX5o18T26D6w70tnQTFeWX6Sh+rAJ23NuWFTw8Hu0njtwtJ3jYs/Q8kOJWl5Se6NjEfRbxzOzgNef/nf9rgsHFUKgyrGawGGakJSL4K4w94cajJcqAhsbkODbw1xmIrYm3xIR3v+T+JK/HgWyYql1itVAJpShsb5OBF1UFFiZHaWF7FMT0nYU88ZEl6KVBSHBem2y4u7Ca7K6XbQuK0yEF2b1xyRei/nNSGoIUCZqIvzPvgvXyi6EWLxXG8r9fyZcfGXwaqI4F3lXxNfm7gyBgCaFxkES61ofFTtwJRSPClqtrezylMNMlL/IELtbno=
- Authentication-results: smail; arc=none
- Cc: pari-users@pari.math.u-bordeaux.fr
- Delivery-date: Sat, 25 Mar 2023 22:29:05 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=math.u-bordeaux.fr; s=2022; t=1679779664; bh=59pLUOYvtI6Y9cSacjOpixHBTS4h8flkTBDHk278M9Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JLy2Lnv8IxD3sKInD3zcXPPYnXo4zs4hJbUuGxTe+5wFhfkpJbmU94KN+jGrGEnKT y6O5gHG6wx71UvJefOPReRsDAJSEuZdxPhEjjfkohNwhaVtu8hX5PxMwYDAUG4p0Ml iNWMMprpjNd9wzVFon1txaE/lpg0QMUggkcqXiHonMMAUeVNmO6dFe8CeUUQ0zX2ht cXTmzJnKQokD7GuO1d9GMynJYLrX+6XweEEjQ83QDwVoakeXca2bt1mva86W76qKh7 luuFjRG5rDFX36uIiu4lX5NfWDjVkQmaYBJR1eSaIM9PhSYo9tQvPAXQTnlutbAOku 5fOX9KMraluzBhZdTXrj/UfqVXbp9pS44YFG7QwxzXghGorJRq2Fm4FYn0GeNAy5Id UuVIPjW2sIdxFtFmsjtkCq4zedOpjAs2dRnnX9USMRJCxisOlGGXld/AkbcxUiZnL9 BRJBGjiadyXFy2hXcWUDQLSiH2obwLRaA0arFGFduNZDKeVEQYE2oMpPFXt/YN+Z5u 08ein4i2i+R2Y66MNi9fUgiRwA2NB1wACnuNn39w2VVHGMTB11o1myDhEwWoxFbR84 RZqxU+SVGQo0nncY7zf92it2912gB3WGuHOuyZ4nwF2+UFtMWRJdxHVWdS3zFpWiga /k1mq07/eSnJRIpjzigSaqp4=
- In-reply-to: <CAJkPp5MgOS=c6moEHhbM5oV3YcEsHNyEJ-tQQMoEjO9aTcCcoA@mail.gmail.com>
- Mail-followup-to: Max Alekseyev <maxale@gmail.com>, pari-users@pari.math.u-bordeaux.fr
- References: <CAJkPp5M-zMehJcbLntdUrgcBNQV8kcW6=Ej=gCo6xxWBxpktAw@mail.gmail.com> <ZB8/PsllNvhF2aWJ@seventeen> <CAJkPp5MgOS=c6moEHhbM5oV3YcEsHNyEJ-tQQMoEjO9aTcCcoA@mail.gmail.com>
Hi Max,
first, please show your code: there must be a better solution.
Second, there are a number of drawbacks to what you propose:
- to avoid the error, you can easily trap this exception or test for the
0 polynomial yourself in a user function, say POLROOTSMOD with the
semantic you expect. So we have easy and efficient workarounds.
- all polroots* function currently raise an exception on the 0 polynomial;
polrootsmod handling a finite ring is the only one for which we
*could* make an exception [together with the obsolete polrootsff]).
Consistency is nice.
- by "chance" we don't provide root multiplicities in polrootsmod
[in which case the proposed change wouldn't make sense].
But polrootsmod and polrootspadic are actually inconsistent with polroots
and polrootsreal ! (the former don't take multiplicities into account,
the latter do) It has been requested in the past to fix that
inconsistency and provide a way to obtain multiplicities [rejected on
grounds of backward compatibility but it was a close decision].
This becomes impossible if we make the proposed change.
- the delicate situation is not when you get a memory error but have
p about parisizemax, the latter being large. Then your machine is going to
start swapping. For unlucky values of p, this may essentially kill
your session (huge result gets stored in a variable or history entry and
then, you get memory errors whenever you try anything new)
All in all, the balance is not is favour of changing this.
Cheers,
K.B.
* Max Alekseyev [2023-03-25 19:57]:
> Well, there will be a memory allocation error in this case, but it'll work
> fine in many other cases with small p.
> I'd prefer to see a memory error in the case of large p rather than the
> "zero polynomial in FpX_roots" error unconditionally.
> Regards,
> Max
>
> On Sat, Mar 25, 2023 at 2:36 PM Bill Allombert <
> Bill.Allombert@math.u-bordeaux.fr> wrote:
>
> > On Sat, Mar 25, 2023 at 12:46:49PM -0400, Max Alekseyev wrote:
> > > Shouldn't polrootsmod(f,p) for a prime p and f%p==0 simply return
> > > vector(p,i,Mod(i-1,p)) instead of the error?
> >
> > Given that p can be arbitrarily large, this is not practical...
> > Just consider polrootsmod(0*x,2^127-1)
> >
> > Cheers,
> > Bill
> >
> >
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/