Re: How to select terms wanted in a series

*To*: mathgroup at smc.vnet.net*Subject*: [mg85933] Re: [mg85916] How to select terms wanted in a series*From*: "Thomas Dowling" <thomasgdowling at gmail.com>*Date*: Thu, 28 Feb 2008 02:46:58 -0500 (EST)*References*: <200802270933.EAA16377@smc.vnet.net>

Hello, Personally, I would not convert to a list but use a combination of Select, MemberQ and FreeQ. Something like as follows (where the hash, #, is the pure function symbol) : Select[expression,MemberQ[#1,y]&&MemberQ[#1,x]&&FreeQ[#1,z]&&FreeQ[#1,u]&] Out[95]= 2 x y Select [expression, MemberQ[#1,u^2 ] &] Out[97]= 3 u^2 Select [expression, MemberQ[#,x]&] Out[99]= 2 x y+u x y-x y z Or the following, perhaps: Apply[List, Select [expression, MemberQ[#,x]&]] Out[107]= {2 x y,u x y,-x y z} Select[expression,MemberQ[#1,x]&&MemberQ[#1,y]&&MemberQ[#1,z]&&FreeQ[#1,u]&] Out[100]= -x y z Please let me know if this is not exactly what you want. Perhaps it is not what you want at all! Tom Dowling (thomasgdowling at gmail.com) On Wed, Feb 27, 2008 at 9:33 AM, Barrow <GRseminar at gmail.com> wrote: > Dear all, > > I have an expression, which is a sum of large number of terms, e.g. > > expression = x + 2x*y - x*y*z + u*x*y + 3u^2 > > And I want to select out terms with the factor (x*y). e.g. > > The terms in "expression" that I want are 2x*y, -x*y*z, u*x*y > > My first step is, > > allterms = Apply[List, expression] > > Then, I don't know how to extract the terms I want, I use > > Select[allterms, (# == x*y*_)&] > > But It doesn't work. > > Anyone has some good ideas? any help will be appreciated much! > Sincerely Barrow > >

**References**:**How to select terms wanted in a series***From:*Barrow <GRseminar@gmail.com>