MathGroup Archive 1999

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

Search the Archive

Re: List Position


Harry,

The most straightforward solution is to use Position[], as in

Position[{{1},{1},{2},{8},{-3}}, a_ /; a<=0, 2, 1]

The syntax for Position is

Position[expr, pattern, levelspec, n]

where n tells mathematica to retrieve the first n positions which match
the pattern.

Carl Woll
Dept of Physics
U of Washington

On Fri, 5 Feb 1999, Harry flynn wrote:

> 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.
> 
> 



  • Prev by Date: Re: Function definition
  • Next by Date: RE: List Position
  • Previous by thread: Re: List Position
  • Next by thread: RE: List Position