"The distribution of primes"
Monday, May 1, 7:00-8:00 pm, Moore Psychology Auditorium B03.
WeddaysÕs Homework: Read sectin 8.1 and 8.2. (Yes chapter 8, I think it is a good idea to do chapter 8 before chapter 7, we will do chapter 7 next.) From section 6.3 do 2,6,10,14,26,27,28.
Friday's Homework:
Read section 8.1 and 8.2 over again. Do problems 1,4,5,6,7 from 8.1 and 1,2 and 4 from 8.2.
Comments:
Here is a program to help you simulate the weak law ...
Areabargraph:=proc(data,xmin,xmax,k)
local sorteddata, dx, lines,graphicslist, f: sorteddata:=[]: dx:=(xmax-xmin)/k: lines:=[]: graphicslist:=[]: sorteddata:=sort(data): if ((op(1,sorteddata)<xmin) or (op(nops(sorteddata),sorteddata)>xmax)) then lprint(`Note: some data values lie outside the user-defined interval.`) fi: f:=proc(k,sorteddata,xmin,dx,xmax,lines::evaln) local i,j,currentupperlim,leng,index,counter,result, finallist,q,numb,linelist: finallist:=[]: linelist:=[]: index:=1: leng:=nops(sorteddata): currentupperlim:=xmin+dx: result:=[]: for q from 1 to leng do if ((op(q,sorteddata)>=xmin) and (op(q,sorteddata)<=xmax)) then finallist:=[op(finallist),op(q,sorteddata)] fi: od: numb:=nops(finallist): for i from 1 to k do counter:=0: while ((index<=numb) and (op(index,finallist)<=currentupperlim)) do counter:=counter+1: index:=index+1: od: result:=[op(result),counter]: currentupperlim:=currentupperlim+dx: od: for j from 1 to k do linelist:=[op(linelist),[xmin + (j-1)*dx,0]]: linelist:=[op(linelist),[xmin + (j-1)*dx,op(j,result)/(leng*dx)]]: linelist:=[op(linelist),[xmin + j*dx,op(j,result)/(leng*dx)]]: linelist:=[op(linelist),[xmin + j*dx,0]]: od: lines:=linelist: end: f(k,sorteddata,xmin,dx,xmax,lines): plot(lines,style=LINE); end:
"Here we plug in the function f of the uniform random variable on the unit interval , the number of times n we will average an experiment with this distribution, and m the numbers of trials of this average. Then we see the density function of the average.";
Weak := proc(f,n,m)
local trans, U, explist, i , j, l, sum,average,avlist,xmin,xmax:
with(stats):
avlist:=[];
for l from 1 to m
do;
explist:=[];
for i from 1 to n
do;
trans:=unapply(f,x):
U := random[uniform[0,1]]();
explist := [op(explist), trans(U)];
od;
sum:=0;
for j from 1 to n
do
sum := sum + explist[j];
average := sum/n;
od;
avlist := [op(avlist),average];
od;
xmax := max(op(avlist));
xmin:= min(op(avlist));
Areabargraph(avlist,xmin - .5,xmax + .5,30);
end:
"The uniform example";
Weak(x,100,100);
"The exponential example";
Weak(-ln(-x+1),100,100);
"The geometric example";
Weak(ceil(ln(1-x)/ln(.5)),100,100); "we need a slight modification for the Cauchy example";
WeakC := proc(f,n,m)
local trans, U, explist, i , j, l, sum,average,avlist,xmin,xmax: with(stats): avlist:=[]; for l from 1 to m do; explist:=[]; for i from 1 to n do; trans:=unapply(f,x): U := random[uniform[0,1]](); explist := [op(explist), trans(U)]; od; sum:=0; for j from 1 to n do sum := sum + explist[j]; average := sum/n; od; avlist := [op(avlist),average]; od; xmax := max(op(avlist)); xmin:= min(op(avlist)); Areabargraph(avlist,-10,10,30); end: "The Cauchy example"; WeakC(tan(evalf(Pi)*(x+ 1/2)),1,200);
"The Cauchy example"; WeakC(tan(evalf(Pi)*(x+ 1/2)),100,200);