Smatchcube's website 🌍


Exercise 2.94

I really liked this exercise, it makes me discover what an Euclidean ring is.\ Here is the code:

A change to the div-poly was needed to return only the quotient when the remainder was null (to have a more simple result for make-rat with polynomials). Now we can find the GCD of two polynomials and simplify a rational function.\ Test:

Checking the result by hands give the same answer, it works perfectly.\ Of course it still works for rational numbers: