A Univariate Polynomial Can Be Divided By Another One To Produce A Polynomialquotien 661494

A univariate polynomial can be divided by another one to produce a polynomialquotient and a polynomial remainder. For example,

 width=

Division can be performed via long division. That is, divide the highest-order term of the dividend bythe highest-order term of the divisor. The result is the first term of the quotient. Next, multiply theresult by the divisor, subtract that from the dividend, and produce the rest of the answer by recursivelydividing the difference by the divisor. Stop when the order of the divisor exceeds the order of thedividend and declare the dividend to be the remainder. Also, if the dividend ever becomes zero, returnzero as both quotient and remainder.

We can design a div-poly procedure on the model of add-poly and mul-poly. The procedurechecks to see if the two polys have the same variable. If so, div-poly strips off the variable andpasses the problem to div-terms, which performs the division operation on term lists. Div-polyfinally reattaches the variable to the result supplied by div-terms. It is convenient to designdiv-terms to compute both the quotient and the remainder of a division. Div-terms can take twoterm lists as arguments and return a list of the quotient term list and the remainder term list.

Complete the following definition of div-terms by filling in the missing expressions. Use this toimplement div-poly, which takes two polys as arguments and returns a list of the quotient andremainder polys.

(define (div-terms L1 L2)

(if (empty-termlist? L1)

(list (the-empty-termlist) (the-empty-termlist))

(let ((t1 (first-term L1))

(t2 (first-term L2)))

(if (> (order t2) (order t1))

(list (the-empty-termlist) L1)

(let ((new-c (div (coeff t1) (coeff t2)))

(new-o (- (order t1) (order t2))))

(let ((rest-of-result

<compute rest of result recursively>

))

<form complete result>

))))))