Homework No.4
Due May 11, 1999
- Reading Assignments
- Review Chapter 2.3-2.5
- Preview Chapter 3.1-3.2
- Lab Assignments:
- Exercise 2.73
- Exercise 2.76
- Consider the problem of symbolic manipulation of polynomials
as discussed in class.
- Implement the constructor and selectors for polynomials
using the list of degree-coefficient pairs as the internal
representation.
- Implement
p- that takes two polynomials as
input, and outputs their difference.
- Implement
p* that takes two polynomials as
input, and outputs their product.
- Implement
print-poly that takes a polynomial
(in its internal representation) as input, and outputs the
pretty printed form of the polynomial. For example,
- > (print-poly '((100 3) (50 -2) (1 5) (0 -1)))
- Polynomial: 3x^100-2x^50+5x-1
- DONE
- Implement
horner-eval that takes as input a
polynomial in x and a value for x and returns the
value of the polynomial at x using Horner's rule.
Note: the implementation should be independent
of the underlying representation for polynomials.
- Extra credit problems:
- Exercise 2.91
- Implement
read-poly that interacts with the
user in constructing a new polynomial. For example:
- > (read-poly)
- Please input the degree of the term: 100
- Please input the coefficient of the term: 3
- Continue? Yes
- Please input the degree of the term: 0
- Please input the coefficient of the term: -1
- Continue? No
- Polynomial: 3x^100-1
- Exercise 2.92
- Exercise 2.93
-
作業繳交方式