How to work around unsupported rational coefficients in AbstractAlgebra for polynomial rings in Julia?

I’m working with the AbstractAlgebra.jl library in Julia and encountered an issue when defining an ideal in a polynomial ring with rational coefficients. Here’s the minimal example:

using AbstractAlgebra

# Integer coefficients (works fine)
R, (x, y) = polynomial_ring(ZZ, [:x, :y]; internal_ordering=:degrevlex)
V = [2x*y, 3x + y]
I = Generic.Ideal(R, V)  # This works

# Rational coefficients (throws an error)
R, (x, y) = polynomial_ring(QQ, [:x, :y]; internal_ordering=:degrevlex)
V = [0.1x*y, 0.1x + y]
# I = Generic.Ideal(R, V)  # Error: rational coefficients are not supported

The issue arises when I use rational coefficients (QQ or 0.1). It seems like Generic.Ideal doesn’t support this type of coefficient.

Question:

  • Is there a known workaround to handle ideals with rational coefficients in AbstractAlgebra.jl?
  • Alternatively, is there another Julia package that supports this functionality for polynomial rings?

Any suggestions or insights would be appreciated. Thanks!

0.1 is not a rational coefficient, but a floating point number.

Edit: Use 1//10 instead of 0.1.

1 Like

yeah, sorry that example wasn’t qiute right. but the actual code that I need to work w/h has rational coeffs coming from QQ.