Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: Polynomial to List

  • To: mathgroup at smc.vnet.net
  • Subject: [mg76900] Re: Polynomial to List
  • From: dimitris <dimmechan at yahoo.com>
  • Date: Wed, 30 May 2007 05:05:35 -0400 (EDT)
  • References: <f3grip$49r$1@smc.vnet.net>

It is very easy.
See below

In[26]:=
o = 1 + x + x^2 + x^3 + x^4
Out[26]=
1 + x + x^2 + x^3 + x^4

1)

In[28]:=
Reverse[List @@ o]
Out[28]=
{x^4, x^3, x^2, x, 1}

2)

In[36]:=
Cases[o, x^(n_.) | (x_Integer)]//Reverse
Out[36]=
{x^4, x^3, x^2, x, 1}

3)

In[39]:=
Reverse[o /. (x_) + (y___) -> {x, y}]
Out[39]=
{x^4, x^3, x^2, x, 1}

Dimitris

 /  Nick Hoffman       :
> I have a polynomial,
> Lets say:
>
> 1 + x + x^2 + x^3 + x^4
>
>
> and all I need to do is get that into a list of this form
>
> {x^4, x^3, x^2, x, 1}
>
> Any help would be greatly appreciated!  Thanks!



  • Prev by Date: Re: Iterate through a list
  • Next by Date: Re: Polynomial to List
  • Previous by thread: Re: Polynomial to List
  • Next by thread: Re: Polynomial to List