Re: Keeping terms of certain order in expand command

*To*: mathgroup at smc.vnet.net*Subject*: [mg31605] Re: Keeping terms of certain order in expand command*From*: "Allan Hayes" <hay at haystack.demon.co.uk>*Date*: Fri, 16 Nov 2001 06:38:10 -0500 (EST)*References*: <9t0435$3o6$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Chris, KeepEvens[expr_] := Module[{p}, Replace[p + expr, a_ :> If[OddQ[Exponent[a /. Subscript[T, i_]^(j_.) :> T^(i*j), T]], 0, a], {1}] - p] -- Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565 "Chris" <cjque at umich.edu> wrote in message news:9t0435$3o6$1 at smc.vnet.net... > Hello All, > > I am tring to write a program that will do the following but I cant seem to > get it right. > > I would like to keep terms of the expansion below that have > even order where order is defined as follows: > > > The order of T_x is x*1 x where 1 is the exponent of the term, > _ (underscore) is for sub, and ^ is for raised to the power. > > > the order of T_x * T_y = x*1 + y*1 > the order of ((T_x)^i) * ((T_y)^j)) * ((T_z)^k) is > x*i + y*j + z*k > > Expand[(T_3 + T_4 + T_5+ T_6+ T_7+T_8)^5] > > Thanks A lot, > Chris >