MathGroup Archive 2001

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

Search the Archive

Re: Keeping terms of certain order in expand command [2]

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

Chris,

A slightly quicker way than in my previous posting - it makes more use of
pattern matching:

KeepEvens2[expr_] :=
 expr/.(a:(m_. * __Subscript)):>
        If[OddQ[Exponent[a /.Subscript[T, i_]^(j_.) :> T^(i*j), T]], 0, a]

--
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
>




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