Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: creating a polynomial from given roots and multiplicies
Date: Fri, 3 Feb 2012 09:04:30 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 9
Message-ID: <jgg7uu$556$1@newscl01ah.mathworks.com>
References: <jgg3fr$m6f$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-01-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1328259870 5286 172.30.248.46 (3 Feb 2012 09:04:30 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 3 Feb 2012 09:04:30 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:756613

"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 (x-1)^3(x+2)^2(x+3) 
> it should produce the polynomial X^6+4X^5-2X^4-16X^3+5X^2+20X-12
- - - - - - - -
  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