Introduction to Programming Assignment 2, 2 Sep, 2008 Due Tue 9 Sep, 2008 Note: Remember to always supply a type definition for every function you write, including any auxiliary functions that you may define to solve the given problem. Polynomials ----------- Let us consider polynomials in a single variable x with integer coefficients: for instance, 3x^4 - 17x^2 - 3x + 5. Each term of the polynomial can be represented as a pair of integers (coefficient,exponent). The polynomial itself is then a list of such pairs. Thus, we have: type Coefficient = Int type Exponent = Int type Polynomial = [(Coefficient,Exponent)] We have the following constraints to guarantee that each polynomial has a unique representation: -- Terms are sorted in descending order of exponent -- No term has a zero cofficient -- No two terms have the same exponent -- Exponents are always nonnegative For example, the polynomial introduced earlier is represented as [(3,4),(-17,2),(-3,1),(5,0)] The zero polynomial, 0, is represented as the empty list [], since it has no terms with nonzero coefficients. Write Haskell functions for the following operations: addpoly :: Polynomial -> Polynomial -> Polynomial multpoly :: Polynomial -> Polynomial -> Polynomial These functions add and multiply two polynomials, respectively. You may assume that the inputs to these functions follow the representation given above. Correspondingly, the outputs from these functions should also obey the same constraints. ======================================================================