1
$\begingroup$

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?

  • 0
    possible duplicate of [Algorithm(s) for computing an elementary symmetric polynomial](http://math.stackexchange.com/questions/30807/algorithms-for-computing-an-elementary-symmetric-polynomial)2012-05-07

1 Answers 1

1

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).

  • 0
    Ok I think I do have Mupad, I'm going to see if I can get it to work for me, thanks.2012-05-06