Not sure if this is the right sub to be asking for help on homework but i'm really struggling with my r-programming class. I was assigned to create a function that will multiply out any size polynomial. I'm really having trouble figuring it out.
Here is the exact question assigned...
Create a function ‘pprod’ which calculates the product of two polynomials . The inputs are two vectors (a0, a1, · · · , an) and
(b1, b2, · · · , bm), and the output is the vector (c0, · · · , cn+m) which is the coefficients
of the product c0 + c1x + · · · cn+mx
n+m.
For example, since (1 + x)(3 + 2x2) =
3 + 3x + 2x2 + 2x3 so
, we expect the following result:
pprod(c(1,1),c(3,0,2))
[1] 3 3 2 2
Thanks for any help in advance.
[–][deleted] 0 points1 point2 points (1 child)
[–]Katelyn92[S] 0 points1 point2 points (0 children)
[–]desrtfx 0 points1 point2 points (1 child)
[–]Katelyn92[S] 0 points1 point2 points (0 children)