oscar-system / Oscar.jl

A comprehensive open source computer algebra system for computations in algebra, geometry, and number theory.
https://www.oscar-system.org
Other
344 stars 125 forks source link

allow ishomogeneous for more types of polynomials #909

Closed YueRen closed 2 years ago

YueRen commented 2 years ago

This works:

julia> K = PadicField(2,2)
Field of 2-adic numbers

julia> R, (x1,x2) = PolynomialRing(K, "x".*string.(1:2))
(Multivariate Polynomial Ring in x1, x2 over Field of 2-adic numbers, AbstractAlgebra.Generic.MPoly{padic}[x1, x2])

julia> I = ideal([x1+x2])
ideal(x1 + x2)

julia> ishomogeneous(I[1])
true

This doesn't:

julia> R, (x1,x2) = PolynomialRing(QQ, "x".*string.(1:2))
(Multivariate Polynomial Ring in x1, x2 over Rational Field, fmpq_mpoly[x1, x2])

julia> I = ideal([x1+x2])
ideal(x1 + x2)

julia> ishomogeneous(I[1])
ERROR: MethodError: no method matching ishomogeneous(::fmpq_mpoly)
Closest candidates are:
  ishomogeneous(::AbstractAlgebra.Generic.MPoly{T}) where T<:RingElement at /home/ren/oscar/AbstractAlgebra.jl/src/generic/MPoly.jl:653
  ishomogeneous(::AbstractAlgebra.Generic.UnivPoly) at /home/ren/oscar/AbstractAlgebra.jl/src/generic/UnivPoly.jl:141
  ishomogeneous(::Oscar.SubQuoElem_dec) at /home/ren/oscar/Oscar.jl/src/Modules/FreeModules-graded.jl:931
  ...
Stacktrace:
 [1] top-level scope
   @ REPL[103]:1
wdecker commented 2 years ago

@YueRen This is not a bug, this is a design decision which could be changed. Let us talk about this and #908 via skype, phone, gathertown ...

wdecker commented 2 years ago

julia> R, (x1,x2) = PolynomialRing(QQ, "x".*string.(1:2)) (Multivariate Polynomial Ring in x1, x2 over Rational Field, fmpq_mpoly[x1, x2])

julia> R, (x1,x2) = grade(R) (Multivariate Polynomial Ring in x1, x2 over Rational Field graded by x1 -> [1] x2 -> [1], MPolyElem_dec{fmpq, fmpq_mpoly}[x1, x2])

julia> I = ideal([x1+x2]) ideal(x1 + x2)

julia> ishomogeneous(I[1]) true

YueRen commented 2 years ago

I am closing the issue for now, because it is not as clear-cut as I imagined when I opened it. I don't think now is the time to discuss is (as in: there are other much more important tasks and this is just a minor issue with an easy workaround whose proper solution requires a lot of discussion)