MathGroup Archive 2010

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

Search the Archive

Re: Sum of terms --> list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg110615] Re: Sum of terms --> list
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Mon, 28 Jun 2010 02:29:42 -0400 (EDT)

Very easy -- and you'll doubtless get lots of replies to this.

   Apply[List, a + b + c]
{a, b, c}

   (* same thing using special input form: *)
   List @@ (a + b + c)
{a, b, c}

   List @@ (a*b*c)
{a, b, c}

If, however, your expression involves several different operations, 
things get more complicated. You could then, e.g., use Apply at various 
levels.

On 6/26/2010 3:09 AM, uno wrote:
> Hi,
>
> I have an expression that is a sum of terms, like
>      a+b+c
> 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
>      {a,b,c}
>
> Also, the same to go from a product of terms like
>      a*b*c
> to a list like
>      {a,b,c}
>
> 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
> help.
>
> 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.
>

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305


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