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


Groups > comp.soft-sys.math.mathematica > #2704 > unrolled thread

Re: Position

Started byOliver Ruebenkoenig <ruebenko@wolfram.com>
First post2011-05-25 10:59 +0000
Last post2011-05-25 23:33 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: Position Oliver Ruebenkoenig <ruebenko@wolfram.com> - 2011-05-25 10:59 +0000
    Re: Position Armand Tamzarian <mike.honeychurch@gmail.com> - 2011-05-25 23:33 +0000

#2704 — Re: Position

FromOliver Ruebenkoenig <ruebenko@wolfram.com>
Date2011-05-25 10:59 +0000
SubjectRe: Position
Message-ID<irine1$rg9$1@smc.vnet.net>
On Wed, 25 May 2011, Joerg Schroeder 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
>

Joerg,

Position works like Cases:

Position[data, _?(# >= 0.95 &)]
Select[data, # >= 0.95 &]
Cases[data, _?(# >= 0.95 &)]

Oliver

[toc] | [next] | [standalone]


#2715

FromArmand Tamzarian <mike.honeychurch@gmail.com>
Date2011-05-25 23:33 +0000
Message-ID<irk3k9$7a7$1@smc.vnet.net>
In reply to#2704
On May 25, 8:59 pm, Oliver Ruebenkoenig <ruebe...@wolfram.com> wrote:
> On Wed, 25 May 2011, Joerg Schroeder 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
>
> Joerg,
>
> Position works like Cases:
>
> Position[data, _?(# >= 0.95 &)]
> Select[data, # >= 0.95 &]
> Cases[data, _?(# >= 0.95 &)]
>
> Oliver

Also

Position[data, x_ /; x >= 0.95]

...and so on

Mike

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web