MathGroup Archive 1999

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

Search the Archive

Re: Position of element in a list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg16344] Re: [mg16301] Position of element in a list
  • From: "Kevin J. McCann" <kevinmccann at Home.com>
  • Date: Thu, 11 Mar 1999 02:16:30 -0500
  • Sender: owner-wri-mathgroup at wolfram.com

This is kind of kludgey, but it works.  I am sure someone will find a more
elegant way.

Kevin

Position[(Negative[#])& /@ {-1, 3, -2, 1},True]

{{1},{3}}

-----Original Message-----
From: Roger Mason <rmason at sparky2.esd.mun.ca>
To: mathgroup at smc.vnet.net
Subject: [mg16344] [mg16301] Position of element in a list


>Hi,
>
>I want to find the Position[] of negative elements in a list. The obvious
>methods do not work:
>
>Position[{-1, 3, -2, 1}, -_]
>
>and
>
>Position[{-1, 3, -2, 1}, -x_]
>
>return
>
>{}
>
>So how do I perform this apparently simple task?
>
>Thanks,
>
>Roger Mason
>
>
>



  • Prev by Date: NSolve, NDSolve
  • Next by Date: Vector-valued DE's
  • Previous by thread: RE: Position of element in a list
  • Next by thread: Re: Position of element in a list