Monday

Assignment: Read section 2.1 and 2.2 and do 2.1 number 7 and 2.2 numbers 1,2,5,6,9,10,11. Comments: If you are having trouble with the computer aspects in numbers 9,10, and 11 you may use the following template. (Please try to first do the problem yourself.)

Wait := proc(f,n)

local wait, trans, U, waitlist, i , j,sum,average:

with(stats):

waitlist:=[];

for i from 1 to n

do;

wait := 0;

while wait < 100 do

trans:=unapply(f,x):

U := random[uniform[0,1]]();

wait := wait + trans(U):

od;

waitlist := [op(waitlist), wait - 100];

od;

sum:=0;

for j from 1 to nops(waitlist)

do

sum := sum + waitlist[j];

od;

average := sum/nops(waitlist);

lprint(average);

end: Wait(10*x,10);

Notice the integer used by Wait is the number of experiments run and the function f is the function of the value of the uniform random variable on [0,1] that you are using. In my example above I am using the uniform random variable on [0,10]. You might want to think about the answer! ( For 9 the needed function is described in the book, in 10 it is another linear function and in 11 you must figure out the function (or change the progam to use the general simulation from the previous chapter.))

The computer demos and experiments we are using in class can be found here: Computer Demos.

Wednesday

Assignment: Read section 3.1 and do from section 2.2 problems 4,8,12,13,14,15,Extra Credit 18,19.

Comments: Here is the program that estimates the density function of a random variable on the unit interval with the uniform distribution that we used in class today. (Included is a the area-bargraph program, which it uses.)

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:

Ranvar := proc(f,n,m)

local i,j, data,newdata,y,mx,mn,trans:

with(stats):

data:=[]:

newdata:=[]:

for i from 1 to n

do

y := random[uniform[0,1]]();

data := [y,op(data)];

od;

for j from 1 to n

do

trans:=unapply(f,x):

newdata := [op(newdata), trans(data[j])];

od;

mx := max(op(newdata));

mn := min(op(newdata));

Areabargraph(newdata,mn,mx,m);

end:

Ranvar(x^2,1000,15);

Friday

Assignment: Read sections 3.1 and 3.2 and do from section 3.1 numbers 5,6,8,13,14,18 and from section 3.2 numbers 8,12,14.

Comments: Here are the computer demos for chapter 3.

Computer Demos.





Math 60 Spring 2000
2000-04-07