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

**URL:** <https://discourse.julialang.org/t/how-to-work-around-unsupported-rational-coefficients-in-abstractalgebra-for-polynomial-rings-in-julia/124495>\
**Category:** General Usage\
**Created:** [January 7, 2025, 9:56am UTC](https://discourse.julialang.org/t/how-to-work-around-unsupported-rational-coefficients-in-abstractalgebra-for-polynomial-rings-in-julia/124495 "2025-01-07T09:56:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rowing0914](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rowing0914/32/211810_2.png) [@Rowing0914](https://discourse.julialang.org/u/Rowing0914)\
**Post date:** [January 7, 2025, 9:56am UTC](https://discourse.julialang.org/t/how-to-work-around-unsupported-rational-coefficients-in-abstractalgebra-for-polynomial-rings-in-julia/124495/1 "2025-01-07T09:56:07Z")

</div>

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:

```julia-auto
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!

---

<div class="post-metadata">

**Author:** ![thofma](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/thofma/32/1691_2.png) [@thofma](https://discourse.julialang.org/u/thofma)\
**Post date:** [January 7, 2025, 2:20pm UTC](https://discourse.julialang.org/t/how-to-work-around-unsupported-rational-coefficients-in-abstractalgebra-for-polynomial-rings-in-julia/124495/2 "2025-01-07T14:20:00Z")

</div>

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

Edit: Use `1//10` instead of `0.1`.

---

<div class="post-metadata">

**Author:** ![Rowing0914](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rowing0914/32/211810_2.png) [@Rowing0914](https://discourse.julialang.org/u/Rowing0914)\
**Post date:** [January 8, 2025, 7:37am UTC](https://discourse.julialang.org/t/how-to-work-around-unsupported-rational-coefficients-in-abstractalgebra-for-polynomial-rings-in-julia/124495/3 "2025-01-08T07:37:38Z")

</div>

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.
