Homework 7
Please do the following exercise from the textbook.
Exercise 5.11
For a scheme file of the polynomial procedures we defined in class,
click here.
The algorithm for division of polynomials is as follows:
(the dividend is the first polynomial in the procedure call, and the
divisor is the second polynomial in the procedure call)
- Divide the leading term of the dividend by the leading term of
the divisor (this is the first term of the quotient)
- Multiply above result by the divisor
- Subtract above result from the dividend
- Divide above result by divisor and continue recursively
- If the degree of the divisor is greater than the degree of the
dividend, stop and return dividend as the remainder
- If the dividend becomes zero, the quotient and remainder are both
zero
Example:
(x^2 - 4) / (x - 2)
- x^2 / x = x
- x * (x - 2) = x^2 - 2x
- x^2 - 4 - (x^2 - 2x) = 2x - 4
- (2x - 4) / (x - 2) = 2
done: answer is (x + 2) and there is no remainder
Homework is due in class on March 10, 2004.