Free Republic
Browse · Search
General/Chat
Topics · Post Article

To: Lonesome in Massachussets

I have regular plain old BASIC somewhere. Suppose if I got ambitious, I could run it through ten thousand trials or so.

Then convert the program to do roulette...

;-)


19 posted on 03/19/2008 3:23:15 AM PDT by djf (She's filing her nails while they're draggin the lake....)
[ Post Reply | Private Reply | To 18 | View Replies ]


To: djf

% some lunch time matlab, at your service

>> heads = rand(100, 1e5)> .5; % 100,000 trials of coin 100 tosses

>> total_heads = sum(heads); % number of heads

>> mean(total_heads)

ans =

49.9962 % we expect about 50;

>> std(total_heads)

ans =

4.9998 % we expect about 5

>> lx =length( find(mean_x >=45 & mean_x <= 55));

%% “expected” number between 45 and 55
>> fprintf( ‘%20.0f\n’, sum( binopdf( 45:55, 100, .5))*1e5)

72875

%% experimental number between 45 and 55

>> fprintf( ‘%20.0f\n’, lx)

72523


21 posted on 03/19/2008 9:38:04 AM PDT by Lonesome in Massachussets (The women got the vote and the Nation got Harding.)
[ Post Reply | Private Reply | To 19 | View Replies ]

Free Republic
Browse · Search
General/Chat
Topics · Post Article


FreeRepublic, LLC, PO BOX 9771, FRESNO, CA 93794
FreeRepublic.com is powered by software copyright 2000-2008 John Robinson