Re: Position
- To: mathgroup at smc.vnet.net
- Subject: [mg119228] Re: Position
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Wed, 25 May 2011 19:32:01 -0400 (EDT)
Position's second argument should be a pattern, not a test.
A test can be turned into a pattern, on the other hand:
Position[data, x_/;x >= .95]
or
Position[data, x_?(x >= .95&)]
Bobby
On Wed, 25 May 2011 04:54:45 -0500, Joerg Schroeder
<sd-gymwalsrode at gmx.de> wrote:
> Dear Group,
>
> I don't understand the following:
>
> I have a list of data and want to find the position of special elements:
>
> data=Table[CDF[BinomialDistribution[150,0.3],k],{k,0,150}]
>
> Position[data,#>=0.95&]
>
> With this I get {} (null set) as an answer, whereas for example Select
> gives the answer I expect.
>
> Select[data,#>=0.95&]
>
> Do I do something wrong with Position?
>
> Thanks
>
> Jorg Schroder
--
DrMajorBob at yahoo.com