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

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

Step by Step Solution

3.38 Rating (164 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Userdefined function function p polyadd p1p2operation ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Document Format (1 attachment)

Word file Icon

652-B-F-F-M (772).docx

120 KBs Word File

Students Have Also Explored These Related Finance Questions!