[R] coefficient of polynomial expansion

From: Peter Yang <peterwyang_at_gmail.com>
Date: Mon 08 Aug 2005 - 23:11:47 EST


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



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Aug 08 23:19:39 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:39:45 EST