Re: Selecting Element from List via Pattern Matching
- To: mathgroup at smc.vnet.net
- Subject: [mg89423] Re: Selecting Element from List via Pattern Matching
- From: Michael Weyrauch <michael.weyrauch at gmx.de>
- Date: Mon, 9 Jun 2008 02:28:32 -0400 (EDT)
- References: <g2fugh$2kq$1@smc.vnet.net>
- Reply-to: michael.weyrauch at gmx.de
Hello there are various possibilities to that, one is: Select[t, MemberQ[#, Subscript[a, 2]^2]&] Michael immanuel.bloch at googlemail.com schrieb: > Hello, > > I am trying to extract from a Power Series all elements with a > certain exponent, e.g. > let us say I have generated a list via > > t = Apply[List, Expand[(Sum[Subscript[a, i], {i, 1, 5}])^3]] > > How can I then extract all terms with e.g. a_2^2 in it or any other > exponent? > > I have tried something like > > Cases[t, Times[_, Power[Subscript[a,2],2]]] > > but this somehow only works with the exponent n=1 and no others... > > Does anybody know a solution to this pattern matching problem? > > Thanks! > Immanuel >