MathGroup Archive 2008

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

Search the Archive

Re: How to separate a sum into terms

  • To: mathgroup at smc.vnet.net
  • Subject: [mg92054] Re: [mg92018] How to separate a sum into terms
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Thu, 18 Sep 2008 06:17:25 -0400 (EDT)
  • Reply-to: hanlonr at cox.net

expr = a + b - c + f[1] - g[a]/g[b];

soln = List @@ expr

{a, b, -c, f[1], -(g[a]/g[b])}

Plus @@ soln == expr

True

Total[soln] == expr

True


Bob Hanlon


---- Slava Rychkov <slava.rychkov at gmail.com> wrote: 

=============
Hi!

I want to separate a Mathematica expression written as a sum into 
separate terms
E.g. for

a+b-c+f[1]-g[a]/g[b]

I want to get a list

{a,b,-c,f[1],-g[a]/g[b]}

Is there a simple way to do this?

Thanks,
-- 
Vyacheslav Rychkov                https://mail.sns.it/~rychkov
Scuola Normale Superiore          Tel: +39-050-509068 (office)
Classe di Scienze                      +39-050-3820086  (home)
Piazza dei Cavalieri, 7                +39-3403925168 (mobile)
56100 Pisa                        Fax: +39-050-509045
Italy                             E-mail: Rychkov at sns.it


--

Bob Hanlon



  • Prev by Date: RE: Out[xx] included when saving figures?
  • Next by Date: Re: How to separate a sum into terms
  • Previous by thread: Re: How to separate a sum into terms
  • Next by thread: Re: How to separate a sum into terms