Chronology Current Month Current Thread Current Date
[Year List] [Month List (current year)] [Date Index] [Thread Index] [Thread Prev] [Thread Next] [Date Prev] [Date Next]

Re: [Phys-L] From a Math Prof (physics BS major) at my institution ( math challenge)



Jeffrey,

When I ran some trials of your code, using several 21,5 sets of lottery data in place of your pseudo random sets, I was disconcerted to find all zero results, when there evidently were numerous 0modulo10 values and sequences visible in the data. So I extended the range of the result tabulations in order to capture higher frequencies of contiguous numbers than the 0..6 that you presented. It seems that under representing sequential numbers in your code is not a prime concern, because a student tendency to under-represent sequences and terminal zeroes, if it exists, does represent a distinctive departure from the results of checking pseudo random arrays generated in the manner you provided.

Brian Whatcott Altus OK

On 2/26/2014 12:36 PM, Jeffrey Schnick wrote:
-----Original Message-----
From: Phys-l [mailto:phys-l-bounces@phys-l.org] On Behalf Of brian
whatcott
Sent: Wednesday, February 26, 2014 12:41 PM
To: phys-l@phys-l.org
Subject: Re: [Phys-L] From a Math Prof (physics BS major) at my institution (
math challenge)

If the intention is to draw five integers in the range 1..35 from a hat, what do
you do if you draw a number that's already drawn?

...
I think what Paul is saying is that after you pick a number you shouldn't put it back in the hat before having picked all five. I can't see how it could matter but I have created a new version of the code, one that uses all values returned by the pseudo-random distribution generator and it is running now with n = a million. I have pasted it below. See any mistakes in it? If not, what is your prediction on how the results will compare with those of the old code?

function dummy = getdist2(n)
tic
for m=1:n
a=zeros(21,5);
for i=1:21
numsLeft=0:36;
for j = 1:5
nIndex = fix(2+rand*(36-j));
a(i,j)=numsLeft(nIndex);
numsLeft=[numsLeft(1:nIndex-1),numsLeft(nIndex+1:38-j)];
end
end
a=sort(a,2);
nrounds(m)=sum(10==a(:)) + sum(20==a(:)) + sum(30==a(:));
nseq2(m)=0;
for i=1:21
b=diff(a(i,:));
nseq2(m)=nseq2(m)+sum(1==b);
end
end


for i=0:6
totalrounds(i+1)=sum(i==nrounds);
end
totalrounds=totalrounds
for i=0:6
totalseq2(i+1)=sum(i==nseq2);
end
totalseq2=totalseq2
for i=0:6
total(i+1)= sum( nseq2<=i & nrounds<=i );
end
total=total
toc
end

_______________________________________________
Forum for Physics Educators
Phys-l@phys-l.org
http://www.phys-l.org/mailman/listinfo/phys-l