MathGroup Archive 2006

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

Search the Archive

Re: Grouping similar indices together in an expression

  • To: mathgroup at smc.vnet.net
  • Subject: [mg65249] Re: Grouping similar indices together in an expression
  • From: Peter Pein <petsie at dordos.net>
  • Date: Wed, 22 Mar 2006 06:13:38 -0500 (EST)
  • References: <dvosko$j5k$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

David Sanders schrieb:
> Hi,
> 
> I am a newbie in Mathematica, and am trying to do the following.
> 
> I have terms which look like
> a[i] a[j] b[i] b[j]
> 
> I need to apply a function F, for which I need to group the different
> indices (by which I mean i, j) together as follows:
> 
> F(a[i] a[j] b[i] b[j]) = F(a[i] b[i]) F(a[j] b[j])
> 
> I do not in general know how many different indices there might be in a
> term.  E.g. I might have
> a[i] a[j] a[k] b[j]
> 
> Could somebody please give me a hint as to how to do this?
> 
> Thanks,
> David.
> 

Hi David,

maybe you don't want the "intersection of indices"?

Then try this one:

example3=a[i] a[j] a[k] b[g] b[h] b[i] b[j];

Times@@F@@@Split[Sort[List@@example3,OrderedQ[First/@{##}]&],
       SameQ@@(First/@{##})&]

--> F[a[k]] F[b[g]] F[b[h]] F[a[i],b[i]] F[a[j],b[j]]

Peter


  • Prev by Date: Re: Integration Bug
  • Next by Date: Re: Grouping similar indices together in an expression
  • Previous by thread: Re: Grouping similar indices together in an expression
  • Next by thread: Re: Grouping similar indices together in an expression