Services & Resources / Wolfram Forums / MathGroup Archive

MathGroup Archive 2010

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

Search the Archive

Re: Sum of terms --> list

  • To: mathgroup at
  • Subject: [mg110593] Re: Sum of terms --> list
  • From: Bob Hanlon <hanlonr at>
  • Date: Sun, 27 Jun 2010 04:55:21 -0400 (EDT)

expr = a + b + c;

List @@ expr


expr /. Plus -> List


expr = a*b*c;

List @@ expr


expr /. Times -> List


expr = a*b + c + e*f*g;

List @@ expr

{a b,c,e f g}

List @@ (List @@@ expr) // Quiet


expr /. {Times -> List, Plus -> List}


Bob Hanlon

---- uno <dxcqp2000 at> wrote: 


I have an expression that is a sum of terms, like
and I want to convert it to a list, with as many elements as the
number of terms in the sum of terms, and with each element being each
of the terms, like

Also, the same to go from a product of terms like
to a list like

Is there any way, in Mathematica, to do this?
I've been looking for an answer in the Help, and in the web, with no

I ask this because "a*b+c+e*f*g" needs to be evaluated by an external
(.NET) program, which is not able to parse expressions. I have to
"break" everything inside Mathematica, before sending information to
that external program, which will evaluate that expression many times,
for different values of {a,b,c,d,e,f,g}.

Thank you.

  • Prev by Date: Absolute value
  • Next by Date: Re: Sum of terms --> list
  • Previous by thread: Re: Sum of terms --> list
  • Next by thread: Re: Sum of terms --> list