Smatchcube's website 🌍


Exercise 2.91

Let’s use the sparse representation only with the code we used before the previous exercise, it will make everything much more simple.\ So here is the code completed to make the divisions of terms:

The result is a list with a list of the terms of the quotient as a first element and a list of terms of the remainder as the second element.\ Now we can define the div-poly and the division for polynomials:

The result is a list of polynomials, the first polynomial is the quotient, the second is the remainder. Here is a test on division from the book: