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


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

Re: average of the consecutive coin tosses

From "Harvey P. Dale" <hpd1@nyu.edu>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: average of the consecutive coin tosses
Date 2011-10-07 08:48 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j6medi$78l$1@smc.vnet.net> (permalink)
References <201110060818.EAA22381@smc.vnet.net>

Show all headers | View raw


	Perhaps something like this:

With[{numberoftosses=500},Accumulate[RandomInteger[{0,1},numberoftosses]
]/Range[numberoftosses]]//N

	Best,

	Harvey


-----Original Message-----
From: michael partensky [mailto:partensky@gmail.com]
Sent: Thursday, October 06, 2011 4:18 AM
Subject: average of the consecutive coin tosses

Hi.

What are the better ways of doing what this guy does very inefficiently
for
the average of the consecutive coin tosses:

tr = (flips = 1; (#/flips++) & /@ Accumulate[Table[toss, {1000}]]) //
N);

where

toss= RandomInteger[];

Thanks
Michael

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


Thread

Re: average of the consecutive coin tosses "Harvey P. Dale" <hpd1@nyu.edu> - 2011-10-07 08:48 +0000

csiph-web