Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #2708

Re: Position

From DrMajorBob <btreat1@austin.rr.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Position
Date 2011-05-25 23:31 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <irk3h8$77p$1@smc.vnet.net> (permalink)

Show all headers | View raw


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@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@yahoo.com

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Position DrMajorBob <btreat1@austin.rr.com> - 2011-05-25 23:31 +0000

csiph-web