MathGroup Archive 2001

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

Search the Archive


  • To: mathgroup at
  • Subject: [mg31124] patterns
  • From: Yannis.Paraskevopoulos at
  • Date: Fri, 12 Oct 2001 03:36:41 -0400 (EDT)
  • Sender: owner-wri-mathgroup at


I have built the following function for selecting consecutive elements 
of a list that do satisfy a particular condition. Here it is:

f[x_, matrix_] := Module[{t, selector},
(* Flatten and group number in pairs *)
    t = Partition[Flatten[matrix], 2];
(* Selector : returns true if all in list  > x *)
    selector[xx_, list_] := Apply[And, Map[(# > xx) &, list]];
    (* select *)
    Select[t, selector[x, #] &]]

t = Table[Table[Random[], {4}], {12}];



seems to work. My question is how one could modify the function so : 
1) we pick the first set of consecutive numbers that satisfy the 
condition and 2) from any partition of 10 you check the first 5 who 
satisfy the condition (again continuous) and then go  to the next row 
of the initial matrix.

Do you know any good reference with lots of examples for conditions and 
patterns with lists and matrices?

Thank you very much in advance.


Visit our website at

This message contains confidential information and is intended only 
for the individual named.  If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail.  Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.  The sender therefore 
does not accept liability for any errors or omissions in the contents 
of this message which arise as a result of e-mail transmission.  If 
verification is required please request a hard-copy version.  This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities or 
related financial instruments.

  • Follow-Ups:
  • Prev by Date: Re: Can Fit give function coefficients?
  • Next by Date: RE: Newbie Plot-Fit Questions.
  • Previous by thread: Date and Time in Headers (odd quirk)
  • Next by thread: Re: patterns