Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1998

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

Search the Archive

Re: Select x s.t. y>10

  • To: mathgroup at smc.vnet.net
  • Subject: [mg14001] Re: Select x s.t. y>10
  • From: Leszek Sczaniecki <lsczan at concentric.net>
  • Date: Sat, 12 Sep 1998 16:59:23 -0400
  • Organization: Concentric Internet Services
  • References: <6tbtv8$mq0@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Is there any reson that you can't use directly a build-in function
Select as in the following example?

In[1]:=
  lst = Table[{Random[], Random[]}, {10}] Out[1]=
  {{0.87642,0.859277},{0.990313,0.434662},{0.631448,0.153609},{0.515145,

0.424282},{0.00339491,0.575325},{0.562473,0.690501},{0.817277,0.713543},{
    0.709017,0.351955},{0.937637,0.0728005},{0.553451,0.791334}}

In[1]:=
  Select[lst, #[[2]] < .5 &]
Out[1]=
 
{{0.990313,0.434662},{0.631448,0.153609},{0.515145,0.424282},{0.709017,
    0.351955},{0.937637,0.0728005}}

-- Leszek


Jason Gill wrote:

> I came across what seems like it should be a simple little function, but
> could not come up with a clever way to implement it.  Generally, what I
> am trying to do is take a list of lists of length 2 ie a list of x,y
> coordinates, and Select x values based on some criterion for y.  For
> example I want to select the first x value for which the corresponding
> y is greater than 5.
> I can write a function using Position and Take etc. , but there must be
> a clever,and more efficient way to do this.  Any thoughts... Jason
>
> --
> Jason Gill
> IBM Microelectronics
> Essex Junction, VT 05452
> Phone   (802)769-3350
> Fax     (802)769-1220
> email:  jgill at vbimail.champlain.edu
>            jasongil at us.ibm.com


  • Prev by Date: Re: Q: efficient list operation wanted
  • Next by Date: Re: Q: efficient list operation wanted
  • Previous by thread: Re: Select x s.t. y>10
  • Next by thread: Re: Select x s.t. y>10