MathGroup Archive 2006

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

Search the Archive

Re: Converting an expression to a list of terms?


You can try

Apply[List, expr ]

Look at TreeForm[expr] to see where to apply list to the head of the
expression.

Or

Level[expr , 1]

this works for me too.

Example:
In : expr = A*B + B*C - C*A

In : Level[expr, 1]

Out : {A B, -A C, B C}

In : Apply[List, expr]

Out : {A B, -A C, B C}

Greetings

Guido


On 20 Nov., 08:51, AES <sieg... at stanford.edu> 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?


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