Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #2687 > unrolled thread
| Started by | "Joerg Schroeder" <sd-gymwalsrode@gmx.de> |
|---|---|
| First post | 2011-05-25 09:55 +0000 |
| Last post | 2011-05-25 23:31 +0000 |
| Articles | 4 — 4 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
Position "Joerg Schroeder" <sd-gymwalsrode@gmx.de> - 2011-05-25 09:55 +0000
Re: Position David Bailey <dave@removedbailey.co.uk> - 2011-05-25 23:32 +0000
Re: Position Roland Franzius <roland.franzius@uos.de> - 2011-05-25 23:30 +0000
Re: Position Wolfgang Windsteiger <Wolfgang.Windsteiger@risc.jku.at> - 2011-05-25 23:31 +0000
| From | "Joerg Schroeder" <sd-gymwalsrode@gmx.de> |
|---|---|
| Date | 2011-05-25 09:55 +0000 |
| Subject | Position |
| Message-ID | <irijmq$qck$1@smc.vnet.net> |
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
--
Dr. Jörg Schröder
Gymnasium Walsrode
Sunderstrasse 19
29664 Walsrode
NEU: FreePhone - kostenlos mobil telefonieren!
Jetzt informieren: http://www.gmx.net/de/go/freephone
[toc] | [next] | [standalone]
| From | David Bailey <dave@removedbailey.co.uk> |
|---|---|
| Date | 2011-05-25 23:32 +0000 |
| Message-ID | <irk3i8$78l$1@smc.vnet.net> |
| In reply to | #2687 |
On 25/05/2011 10:55, 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
Position is looking for a pattern - it doesn't take a function argument
like Select.
In[11]:= Position[{0.1, 1.0, 0.8, 1.1, 3.3}, x_ /; x > 0.95]
Out[11]= {{2}, {4}, {5}}
David Bailey
http://www.dbaileyconsultancy.co.uk
[toc] | [prev] | [next] | [standalone]
| From | Roland Franzius <roland.franzius@uos.de> |
|---|---|
| Date | 2011-05-25 23:30 +0000 |
| Message-ID | <irk3f8$761$1@smc.vnet.net> |
| In reply to | #2687 |
Am 25.05.2011 11:55, schrieb Joerg Schroeder:
> 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?
Position searches patterns
Position[data, _?(# >= 0.95 &)]
--
Roland Franzius
[toc] | [prev] | [next] | [standalone]
| From | Wolfgang Windsteiger <Wolfgang.Windsteiger@risc.jku.at> |
|---|---|
| Date | 2011-05-25 23:31 +0000 |
| Message-ID | <irk3ft$76l$1@smc.vnet.net> |
| In reply to | #2687 |
Position needs a *pattern*, not a condition. Like what you would write
in Cases[data,...] when used instead of Select[data,...] in order to
filter elements.
WW.
On 05/25/2011 11:55 AM, 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
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web