[R] coefficient of polynomial expansion

Peter Yang peterwyang at gmail.com
Mon Aug 8 15:11:47 CEST 2005


Hi,

I would like to get the coefficient of polynomial expansion. For example,

(1+ x)^2 = 1 + 2x + x^2, and the coefficients are 1, 2 and 1.
(1 + x + x^2)^3 = 1 + 3*x + 6*x^2 + 7*x^3 + 6*x^4 + 3*x^5 + x^6, and
the coefficients are 1, 3, 6, 7, 6, 3, and 1.

I know that we can use polynom library. Is there any other way to do
it without loading a library.

Thanks a lot for your help.


Peter




More information about the R-help mailing list