Re: How to pick all terms which have are multiplied with a factor, e.g., 2
- To: mathgroup at smc.vnet.net
- Subject: [mg35466] Re: How to pick all terms which have are multiplied with a factor, e.g., 2
- From: Andrzej Kozlowski <andrzej at bekkoame.ne.jp>
- Date: Sun, 14 Jul 2002 06:19:38 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
I guess the simples way is something like In[8]:= 2*a*b^2*c^3 + 13*x*y*a*b + 2/d //. 2*x_ + 2*y_ -> 2*(x + y) Out[8]= 2*(a*b^2*c^3 + 1/d) + 13*a*b*x*y The reason for ReplaceRepeated (//.) is that this will work with more multiples of 2, e.g. In[9]:= 2*a*b^2*c^3 + 13*x*y*a*b + 2/d + 2*h + 2*x^2*y^3 //. 2*x_ + 2*y_ -> 2*(x + y) Out[9]= 13*a*b*x*y + 2*(a*b^2*c^3 + 1/d + h + x^2*y^3) Andrzej Kozlowski Toyama International University JAPAN http://platon.c.u-tokyo.ac.jp/andrzej/ On Saturday, July 13, 2002, at 04:49 PM, Matthias G. Imhof wrote: > I would like to simplify a large symbolic summation. I know that terms > which > are multiplied with a common integer factor can ultimately be combined > and > simplified. > > As an example: from the sum > > 2 a b^2 c^3 + 13 x y a b + 2 d^-1 > > I would like to pick 2 a b^2 c^3 + 2 d^-1 to combine them; and > similarly for > other common integer factors. I suspect that patterns would help, but I > did > not manage to devise a correct one. > > Matthias > > > > Andrzej Kozlowski Toyama International University JAPAN http://platon.c.u-tokyo.ac.jp/andrzej/