Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

RE: extracting powers and coefficients from a polynomial

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49066] RE: [mg49040] extracting powers and coefficients from a polynomial
  • From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>
  • Date: Wed, 30 Jun 2004 05:34:13 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

>-----Original Message-----
>From: AngleWyrm [mailto:no_spam_anglewyrm at hotmail.com]
To: mathgroup at smc.vnet.net
>Sent: Tuesday, June 29, 2004 10:50 AM
>To: mathgroup at smc.vnet.net
>Subject: [mg49066] [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
>
>

In[9]:= s = Sum[x^i, {i, 6}]^3

In[10]:=
{Coefficient[s, x, #], #} & /@ Range[0, Exponent[s, x]]
Out[10]=
{{0, 0}, {0, 1}, {0, 2}, {1, 3}, {3, 4}, {6, 5}, {10, 6}, {15, 7}, {21, 
    8}, {25, 9}, {27, 10}, {27, 11}, {25, 12}, {21, 13}, {15, 14}, {10, 
    15}, {6, 16}, {3, 17}, {1, 18}}

Perhaps delete the elements with 0 coefficient and apply TableForm.

--
Hartmut Wolf


  • Prev by Date: converting table output and plotting
  • Next by Date: Re: Appropriate codec for playing Mathematica generated .wav files
  • Previous by thread: Re: extracting powers and coefficients from a polynomial
  • Next by thread: using updated Intel Math Kernel Library