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

Question:

15. Write a user-defined function that adds or subtracts two polynomials of any order. Name the function p=polyadd(p1,p2,operation). The first two input arguments p1 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’ or ‘sub’, 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:

and

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

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