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 126 forks source link

Warning about Gröbner bases with floating point arithmetic #3207

Closed oskarhenriksson closed 9 months ago

oskarhenriksson commented 9 months ago

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) or ArbField(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) if base_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]$):

R, (x,y) = polynomial_ring(AcbField(64),["x","y"])
I = ideal([x^2+y^2+1//3,x^2+x*y+1//3*x])
G = groebner_basis(I)
thofma commented 9 months ago

Yes, I think this should just error with a helpful error message.

lgoettgens commented 9 months ago

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.

ederc commented 9 months ago

I will try to take care of this.