MathGroup Archive 2009

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

Search the Archive

Re: patterns

  • To: mathgroup at
  • Subject: [mg101919] Re: patterns
  • From: ADL <alberto.dilullo at>
  • Date: Wed, 22 Jul 2009 06:25:15 -0400 (EDT)
  • References: <h41f5m$rin$>


Cases[ Last@testlist, _[(_a | _c), _] ]

is a possibility, where the presence of Rule is not explicitely
(x->y is a representation of Rule[x,y]).


On Jul 20, 11:59 am, Francisco Gutierrez <fgutiers2... at>
> Dear Group:
> Ther output of a code I made (which includes a minimization) is of the following guise:
> {11.2,{dUp[1]->0.,dUp[2]->0.,dUp[3]->0.,dUp[4]->2.1,dUp[5]->0.,dUm[1]->0.  ,d=ADUm[2]->2.6,dUm[3]->0.5,dUm[4]->0.,dUm[5]->0.,dLp[1]->0.,dLp[2]->0.,dLp[3]->=AD0.,dLp[4]->1.4,dLp[5]->0.,dLm[1]->0.,dLm[2]->3.1,dLm[3]->1.5,dLm[4]->0.,dLm=AD[5]->0.,a[1]->6.75,a[2]->1.25,c[1]->1.65,c[2]->0.15}}
> Of this output, I want to capture only the a's and the c's. There is an easy and sloppy manner, but general and I think not slow, to do this because they appear always at the end of the output. But I wonder if it were possible to use pattern matching to make the same thing, something of the sort of Cases[myoutput, a[__]]. Is it possible? How can it be done?
> Thanks
> Francisco      

  • Prev by Date: Re: Thoughts on a Wolfram|Alpha package for
  • Next by Date: Re: eigenvector centrality
  • Previous by thread: patterns
  • Next by thread: Re: patterns