"Luke " <l.jpeterson@yahoo.com> wrote in message <jgg3fr$m6f$1@newscl01ah.mathworks.com>...
> given the roots and multiplicities of the polynomial, the function I create needs to be able to produce a polynomial, the catch is my teacher is not letting me use built in matlab functions.
> .......
> test case... if p=[1 2 3] and m=[3 2 1] from (x1)^3(x+2)^2(x+3)
> it should produce the polynomial X^6+4X^52X^416X^3+5X^2+20X12
       
I think none of us will do your homework for you, Luke. However, I will leave you with the following hint. Represent your polynomial as simply the set of coefficients appearing in the polynomial. That is, the final result in your test case should be: [1,4,2,16,5,20,12]. Start with a coefficient vector of [1]. When a student in algebra would multiply it by X minus the first root, this should give you two elements in your coefficient vector representation, namely [1,root]. Then work out the rules for how each successive student multiplication would affect this set of coefficients, until you have brought in all roots, each with its required multiplicity. (Piece of cake!)
Roger Stafford
