MathGroup Archive 2001

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

Search the Archive

Re: Keeping terms of certain order in expand command

  • To: mathgroup at smc.vnet.net
  • Subject: [mg31609] Re: Keeping terms of certain order in expand command
  • From: Tom Burton <tburton at cts.com>
  • Date: Fri, 16 Nov 2001 06:38:16 -0500 (EST)
  • Organization: Brahea Consulting
  • References: <9t0435$3o6$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hello,

Here is a straightforward implementation of your words. First, form the expression to be expanded:

expr1 = Plus @@ Table[Subscript[T, i], {i, 3, 8}]

Then expand:

expr2 = Expand[expr1^5]

Now it's just a matter of slightly rewriting your words. Splitting off the coefficient c, each term is converted from a product to a sum (inner Plus@@), then the order expression is formed, divided by 2, and then checked whether it is an integer or not; i.e., whether the order expression itself is even or not. Even terms are retained. Finally, the result of Cases, a list, is converted to a sum (outer Plus@@).

expr3 = Plus @@ Cases[expr2, 
    c_Integer*term_ /; IntegerQ[
      (Plus @@ term /. 
        {Subscript[T, i_] :> i, 
         Subscript[T, i_]^j_ :> i*j})/2]]

There may be a clever, much briefer solution, but this is straightforward.

Tom Burton

On Thu, 15 Nov 2001 10:06:29 +0000 (UTC), in comp.soft-sys.math.mathematica you wrote:

>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



  • Prev by Date: Re: Keeping terms of certain order in expand command [2]
  • Next by Date: No joy using gcc 2.95.3 + MathLink v3r9 + Windows 2000 SP2
  • Previous by thread: Re: Keeping terms of certain order in expand command
  • Next by thread: Re: Keeping terms of certain order in expand command [2]