MathGroup Archive 1999

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

Search the Archive

Re: List Position

  • To: mathgroup at smc.vnet.net
  • Subject: [mg15784] Re: List Position
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Sun, 7 Feb 1999 02:04:00 -0500 (EST)
  • References: <79eagc$9ig@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Harry flynn wrote in message <79eagc$9ig at smc.vnet.net>...
>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.


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

    {{5}}

The HelpBrowser gives

Position[expr, pattern, levspec, n] gives the positions of the first n
parts of expr which match the pattern. 


Allan

---------------------
Allan Hayes
Mathematica Training and Consulting
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565




  • Prev by Date: Re: Finding real part (newbie question)
  • Next by Date: Re: Finding real part (newbie question)
  • Previous by thread: Re: List Position
  • Next by thread: Re: List Position