Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*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 2006

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

Search the Archive

Re: Converting an expression to a list of terms?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg71500] Re: [mg71463] Converting an expression to a list of terms?
  • From: János <janos.lobb at yale.edu>
  • Date: Mon, 20 Nov 2006 18:12:03 -0500 (EST)
  • References: <200611200743.CAA09240@smc.vnet.net>

On Nov 20, 2006, at 2:43 AM, AES wrote:

> How to convert an expression consisting of a sum of terms in an Output
> cell:
>
>    A + B - C + . . .
>
> (where A, B, C are themselves product expressions) to a list
>
>    {A, B, -C, . . . }
>
> in some easier fashion than doing it by hand using Find and Replace?

My newbie approach would be:

In[1]:=
expr = a + b - c + d - e;

In[2]:=
Table[expr[[i]],
   {i, 1, Length[expr]}]
Out[2]=
{a, b, -c, d, -e}

János


----------------------------------------------
Trying to argue with a politician is like lifting up the head of a  
corpse.
(S. Lem: His Master Voice)


  • Prev by Date: Re: Converting an expression to a list of terms?
  • Next by Date: documentation NestWhile
  • Previous by thread: Re: Converting an expression to a list of terms?
  • Next by thread: Re: Converting an expression to a list of terms?