Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

So I have a factored polynomial of the form $(z-a)(z-b)(z-c)\ldots(z-n)$ for $n$ an even positive integer. Thus the coefficient of $z^k$ for $0 \le k < n$ will be the sum of all distinct $n-k$ element products taken from the set $\{a,b,\ldots,n\}$ multiplied by $(-1)^k$, I hope that makes sense, please ask if you need more clarification.

I'm trying to put these coefficients into a row vector with the first column containing the constant coefficient (which would be $abc\ldots n$) and the last column containing the coefficient for $z^n$ (which would be 1).

I imagine there is a way to brute force this with a ton of nested loops, but I'm hoping there is a more efficient way. This is being done in Matlab (which I'm not that familiar with) and I know Matlab has a ton of algorithms and functions, so maybe its got something I can use. Can anyone think of a way to do this?

share|improve this question
    
You could use the DocPolynom class: mathworks.co.uk/help/techdoc/matlab_oop/f3-28024.html –  Jonathan May 6 '12 at 23:30
    
This comment needs revision. Let the coefficient vector be $[c_1, c_2, \ldots, c_n],$ with $c_1 = 1$ and $c_n = ab\cdots n.$ Then $ c_k = (-1)^k p_k,$ where $p_k$ is a sum of $\binom{n}{k}$ terms; each term is a product of $k$ different elements from $\{a,b, \dots, n \}.$ –  user2468 May 6 '12 at 23:37
    
Ok thanks J.D. you're right, I edited it so now I mention the alternating sign. –  cactuar May 6 '12 at 23:42
    
possible duplicate of Algorithm(s) for computing an elementary symmetric polynomial –  J. M. May 7 '12 at 1:39

1 Answer 1

up vote 1 down vote accepted

There is a formula involving the 'elementary symmetric polynomials' for the coefficients of the polynomial. See here. If you have the mupad extension for matlab, use polylib::elemSym.
Mupad used to be free until Matlab bought it, so you have a decent chance to have it installed with your Matlab (what's the point of buying a package like Mupad if you don't give it to people afterwards). So it's different from say the Maple integration in Matlab (that probably requires an additional Maple license).

share|improve this answer
    
Ok I think I do have Mupad, I'm going to see if I can get it to work for me, thanks. –  cactuar May 6 '12 at 23:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.