Write a user-defined function that adds or subtracts two polynomials of any order. Name the function p=polyadd

Question:

Write a user-defined function that adds or subtracts two polynomials of any order. Name the function p=polyadd (pl, p2, operation). The first two input arguments pl and p2 are the vectors of the coefficients of the two polynomials. (If the two polynomials are not of the same order, the function adds the necessary zero elements to the shorter vector.) The third input argument operation is a string that can be either 'add 1 or 'sub 1, for adding or subtracting the polynomials, respectively, and the output argument is the resulting polynomial.
Use the function to add and subtract the following polynomials:
f(x) = 2x6 - 3x4 - 9x3 + llx2 - 8x + 4 and f2(x) = 5x3 + 7x -10
Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: