Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #11964
| From | Dana DeLouis <dana01@me.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: pattern matching |
| Date | 2012-10-06 06:06 +0000 |
| Message-ID | <k4ohp9$i6a$1@smc.vnet.net> (permalink) |
| Organization | Time-Warner Telecom |
> Count[Table[RandomInteger[], {n}], 1]/n, {n, 100, 1000, 10}], x_ < .5]
Hi. Here's one way.
t=Table[Count[Table[RandomInteger[],{n}],1]/n,{n,10,15,1}]
{7/10,4/11,1/2,7/13,3/7,8/15}
Count[t, n_/; n<.5]
2
As a suggestion, note the following with 0 / 1's
Mean[{1,1,0,0,0}]
2/5
Perhaps:
t=Table[Mean[RandomInteger[{0,1},n]],{n,10,15,1}]
{1/2,2/11,2/3,5/13,4/7,2/15}
Count[t, n_/;n<.5]
3
= = = = = = = = = =
HTH :>)
Dana DeLouis
Mac & Mathematica 8
= = = = = = = = = =
On Friday, October 5, 2012 2:43:42 AM UTC-4, Daniel S wrote:
> Consider the following code:
>
>
>
> Count[Table[
>
> Count[Table[RandomInteger[], {n}], 1]/n, {n, 100, 1000, 10}],
>
> x_ < .5]
>
>
>
> I want to count the number of times there are occurrences less than .5 but some how I am not specifying the right pattern. Any suggestions on getting right?
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: pattern matching Dana DeLouis <dana01@me.com> - 2012-10-06 06:06 +0000
csiph-web