MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: extracting powers and coefficients from a polynomial


expr=Sum[x^i,{i,6}]^3;

cl=CoefficientList[expr,x];

Select[Transpose[{Range[0,Length[cl]-1],cl}],#[[2]]!=0&] // TableForm


Bob Hanlon

> 
> From: "AngleWyrm" <no_spam_anglewyrm at hotmail.com>
To: mathgroup at smc.vnet.net
> Date: 2004/06/29 Tue AM 04:50:22 EDT
> To: mathgroup at smc.vnet.net
> Subject: [mg49063] [mg49040] extracting powers and coefficients from a polynomial
> 
> I have made a formula that produces a polynomial expansion, and I wish to
> extract the powers and coefficients into a list.
> 
> Expand[(Sum[x^i, {i, 6}])^3]
>   1x^3 + 3x^4 + 6x^5 + 10x^6 + 15x^7 + 21x^8 + 25x^9 + 27x^10 + 
27x^11 + 25x^12
> + 21x^13 + 15x^14 + 10x^15 + 6x^16 + 3x^17 + 1x^18
> 
> How do I make a table of the powers and coefficents?
> 3, 1
> 4, 3
> 5, 6
> 6, 10
> ....
> 
> -- 
> AngleWyrm
> The C++ hat random selection container:
> http://home.comcast.net/~anglewyrm/hat.html
> 
> 


  • Prev by Date: Re: extracting powers and coefficients from a polynomial
  • Next by Date: Accuracy problem in Mathematica
  • Previous by thread: Re: extracting powers and coefficients from a polynomial
  • Next by thread: Re: extracting powers and coefficients from a polynomial