MathGroup Archive 2004

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

Search the Archive

Re: extracting powers and coefficients from a polynomial


Hi,


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

MapIndexed[{#2[[1]] - 1, #1} &, CoefficientList[expr, x]] /. {_, 0} :> 
    Sequence[]//TableForm


Regards
  Jens

AngleWyrm wrote:
> 
> 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: MATHEMATICA AND FINANCIAL CALCULATIONS?
  • Next by Date: Re: extracting powers and coefficients from a polynomial
  • Previous by thread: Re: extracting powers and coefficients from a polynomial
  • Next by thread: Re: extracting powers and coefficients from a polynomial