-
-
Notifications
You must be signed in to change notification settings - Fork 673
Description
In generic implementations of f.quo_rem(g)
, an exception
ArithmeticError: Nonunit leading coefficient
is raised as soon as the leading coefficient of g
is not invertible. This was introduced by ticket #11593, and I mimicked the behavior in #16544.
The change I propose is to try to compute the Euclidean division, and raise an exception
ArithmeticError: division not exact (consider coercing to polynomials over the fraction field first)
when the computation is not possible. Then, quo_rem
would produce less exceptions, and in particular give an answer each time the answer is not controversial (see below).
Note on the controverse. There is a debate to know whether one should raise an exception when the division is not exact (as it is done for dense integer polynomials with the NTL
implementation), or if one should silently return a result that has a mathematical meaning though it is not a Euclidean division (as it is done with the flint
implementation). See #16276 as well as https://groups.google.com/d/msg/sage-devel/UVrx5CG4qA0/WUz2RItJtF8J for this debate. My proposition is to already implement a more capable algorithm, and not to wait for the debate to be closed.
Component: basic arithmetic
Keywords: quo_rem
Author: Bruno Grenet
Branch/Commit: dbfb518
Reviewer: Frédéric Chapoton, Ralf Stephan
Issue created by migration from https://trac.sagemath.org/ticket/16649