AbstractAlgebra.jl icon indicating copy to clipboard operation
AbstractAlgebra.jl copied to clipboard

Modulo with polynomials is sometimes broken

Open SoongNoonien opened this issue 11 months ago • 0 comments

Hi! As mentioned in https://github.com/Nemocas/Nemo.jl/issues/1509, modulo with polynomials in Nemo is a bit inconsistent. But in AbstractAlgebra there is another problem with modulo:

julia> using AbstractAlgebra

julia> R,x=ZZ[:x]
(Univariate polynomial ring in x over integers, x)

julia> mod(R(-1),R(2))
ERROR: ArgumentError: not a unit
Stacktrace:
 [1] inv(a::BigInt)
   @ AbstractAlgebra ~/.julia/packages/AbstractAlgebra/YkCOC/src/julia/Integer.jl:224
 [2] mod(f::AbstractAlgebra.Generic.Poly{BigInt}, g::AbstractAlgebra.Generic.Poly{BigInt})
   @ AbstractAlgebra ~/.julia/packages/AbstractAlgebra/YkCOC/src/Poly.jl:1449
 [3] top-level scope
   @ REPL[6]:1

This is very weird since it works if R is multivariate, which can be seen in https://github.com/Nemocas/Nemo.jl/issues/1509.

SoongNoonien avatar Jul 14 '23 19:07 SoongNoonien