The below steps assume that there's some polynomial type (could just be a length-N list) and support functions that are aware of that type.
order(p1)- returns the order of polynomialp1highest(p1)- highest order coefficient ofp1add(p1, p2)- adds two polynomialssub(p1, p2)- subtracts two polynomialsmult(p1, p2)- multiplies two polynomialsscale(p2, C)- multiplies a polynomial by a real constant,C
- Establish variables
- numerator,
n - denominator,
d - quotient,
q- i.e. the answer - remainder,
r
- numerator,
- Get remainder:
r = highest(n)