MathGroup Archive 1999

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

Search the Archive

Re: List Position

  • To: mathgroup at smc.vnet.net
  • Subject: [mg15766] Re: List Position
  • From: Joerg Schlichtmann <joerg.schlichtmann at ruhr-uni-bochum.de>
  • Date: Sun, 7 Feb 1999 02:03:48 -0500 (EST)
  • Organization: Ruhr-Universitaet Bochum, Rechenzentrum
  • References: <79eagc$9ig@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Harry flynn schrieb:
> 
> Can anyone tell me how I find the position in a list of the first value
> less than or equal to zero.
> For example, how can I get Mathematica to tell me that in the list
> {{1},{1},{2},{8},{-3}}
> that the first value of interest to me is position 5. Thanks in advance.
> Harry.

What about this:

e.g. the list l:

l={{1},{1},{2},{8},{-3},{4},{-1},{0}};


finding the element {-3} functions as follows:

i=1;While[i<Length[l],
  If[l[[i,1]]<=0,{Print[l[[i]]," at Position ", i],i=Length[l]+1},i++]]

wr

Joerg


  • Prev by Date: Graphics output limited to 120 pictures.
  • Next by Date: Re: Function definition
  • Previous by thread: List Position
  • Next by thread: Re: List Position