Closed oskarhenriksson closed 9 months ago
Yes, I think this should just error with a helpful error message.
Yes, I think this should just error with a helpful error message.
This could be implemented in terms of is_exact_type
, so basically sprinkle
@req is_exact_type(elem_type(<something>)) "<some_function> is only supported over exact fields"
to some functions. I don't really know which functions should get something like this, so I am leaving this to someone more into that part of the code.
I will try to take care of this.
Problem We're currently teaching a course on computational algebraic geometry with Oscar, and a couple of our students have had confusing experiences resulting from trying to compute Gröbner bases over inexact "field-like" number systems like
AcbField(64)
orArbField(64)
(which can lead to drastically incorrect results when rounding take place in the Buchberger algorithm). This is especially confusing for those with limited programming experience, who might not be familiar enough with floating point arithmetic to realize the potential danger.Potential solution In the interest of making Oscar more beginner-friendly, it could be useful if
groebner_basis(I)
threw an error (or at least gave a sharp warning) ifbase_ring(base_ring(I))
has floating point arithmetic.Example A typical problematic attempt to calculate a Gröbner basis of $\langle x^2+y^2+\frac{1}{3},x^2+xy+\frac{1}{3}x\rangle$ in $\mathbb{C}[x,y]$ could look something like this (instead of simply doing the calculation in $\mathbb{Q}[x,y]$):