MathGroup Archive 2010

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

Search the Archive

Re: Selecting subscripted variables from an expression

  • To: mathgroup at smc.vnet.net
  • Subject: [mg109152] Re: Selecting subscripted variables from an expression
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Wed, 14 Apr 2010 05:15:19 -0400 (EDT)

On 4/12/10 at 10:59 PM, miliotodc at rtconline.com (Dominic) wrote:

>Hi guys.  I have an expression containing terms with subscripted "a"
>and "b" variables.  Can someone help me devise an algorithm to
>select from this sum, all the terms that have a particular
>subscripted variable as the first term, such as all the terms that
>begin with an a_1 in them.  For example, if I have the expression:

>myNumerator=2a_1a_2b_2  +  a_2  +  a_1b_2b_3  +  a_3b_2_b_3

>then the routine would pick out the 2a_1a_2b_2 term and the
>a_1b_2b_3 terms.

>The expression below is a particular example.  So I suppose the
>routine might look like some version of:

>Select[myNumerator, (all terms that begin with a_1 for example)]

>myNumerator = Subscript[a, 1]*Subscript[b, 0]^5 - Subscript[a,
>2]*Subscript[b, 0]^4*Subscript[b, 1] + Subscript[a, 3]*Subscript[b,
>0]^3*Subscript[b, 1]^2 - Subscript[a, 4]*Subscript[b,
>0]^2*Subscript[b, 1]^3 + Subscript[a, 5]*Subscript[b,
>0]*Subscript[b, 1]^4 - Subscript[a, 6]*Subscript[b, 1]^5 -
>Subscript[a, 3]*Subscript[b, 0]^4* Subscript[b, 2] + 2*Subscript[a,
>4]*Subscript[b, 0]^3*Subscript[b, 1]* Subscript[b, 2] -
>3*Subscript[a, 5]*Subscript[b, 0]^2*Subscript[b, 1]^2* Subscript[b,
>2] + 4*Subscript[a, 6]*Subscript[b, 0]*Subscript[b, 1]^3*
>Subscript[b, 2] + Subscript[a, 5]*Subscript[b, 0]^3*Subscript[b,
>2]^2 - 3*Subscript[a, 6]*Subscript[b, 0]^2*Subscript[b,
>1]*Subscript[b, 2]^2 - Subscript[a, 4]*Subscript[b,
>0]^4*Subscript[b, 3] + 2*Subscript[a, 5]*Subscript[b,
>0]^3*Subscript[b, 1]*Subscript[b, 3] - 3*Subscript[a,
>6]*Subscript[b, 0]^2*Subscript[b, 1]^2*Subscript[b, 3] +
>2*Subscript[a, 6]*Subscript[b, 0]^3*Subscript[b, 2]*Subscript[b, 3]
>- Subscript[a, 5]*Subscript[b, 0]^4*Subscript[b, 4] + 2*Subscript[a,
>6]*Subscript[b, 0]^3*Subscript[b, 1]*Subscript[b, 4] - Subscript[a,
>6]*Subscript[b, 0]^4*Subscript[b, 5];

In[10]:= DeleteCases[ myNumerator, _?(FreeQ[#, Subscript[a, 1]]
& )]

Out[10]= Subscript[a, 1]*Subscript[b, 0]^5



  • Prev by Date: Re: How to make style sheet with header
  • Next by Date: piecewise function
  • Previous by thread: Selecting subscripted variables from an expression
  • Next by thread: Re: Selecting subscripted variables from an expression