> "This is an example of a maple worksheet. If this is your first time using maple I recommend hitting return. By doing
this you will teach the computer the following commands. If you want to modify the commands you can, but maybe not
your first time.":


Spikegraph:=proc(distributionlist,xmin,xmax,show,c)
local num,linelist,j,i,templist:
templist:=[]:
if ((distributionlist[1][1]<xmin) or
(distributionlist[nops(distributionlist)][1]>xmax)
) then
lprint(`Note: some data values lie outside the user-defined interval.`)
fi:
for i from 1 to nops(distributionlist) do
if not((distributionlist[i][1]<xmin) or (distributionlist[i][1]>xmax)) then
templist:=[op(templist),
[distributionlist[i][1],
distributionlist[i][2]
]
]:
fi:
od:
num:=nops(templist):
linelist:=[]:
for j from 1 to num do
linelist:=[op(linelist),[templist[j][1],0]]:
linelist:=[op(linelist),[templist[j][1],templist[j][2]]]:
linelist:=[op(linelist),[templist[j][1],0]]:
od:
if show then plot(linelist,style=LINE,color=c) fi;
end:


Bin:=proc(n,p,k)
(binomial(n,k))*(p^k)*((1-p)^(n-k));
end:

with(plots):
"This programs computes for us the probabilty that our result is due to chance error givne the null hypothesis is true. Its
ofeten called a significane measure. ":


BinomialPlot:=proc(n,m,p,q)
local length,i,j1,j2,j3,j4,j5,spikelist1,spikelist2,spikelist3,
spikelist4,spikelist5,A1,A2,A3,A4,A5:
spikelist1:=[]:
spikelist2:=[]:
spikelist3:=[]:
spikelist4:=[]:
spikelist5:=[]:
for j2 from 0 to n
do
spikelist2:=[op(spikelist2),Bin(n,p,j2)] ;
od:

for j1 from 0 to m-1
do
spikelist1:=[op(spikelist1),[j1+.2,Bin(n,p,j1)]] ;
od:

for j5 from m to n do
spikelist5:=[op(spikelist5),[j5+.2,Bin(n,p,j5)]] ;
od:

for j3 from 0 to m
do
spikelist3:=[op(spikelist3),[j3 -.2,Bin(n,q,j3)]] ;
od:

for j4 from m+1 to n do
spikelist4:=[op(spikelist4),[j4 +.2 .2,Bin(n,q,j4)]] ;
od:

A1:= Spikegraph(spikelist1,0,m,true,black);
A5:=Spikegraph(spikelist5,m-1,n,true,red);

A3:= Spikegraph(spikelist3,0,m+1,true,green);
A4:=Spikegraph(spikelist4,m,n,true,blue);

A2:=Spikegraph([[m,max(op(spikelist2))]],m,m,true,orange);

display(A1,A5,A3,A4,A2);
end:




Hyp:=proc(n,m,p,q)
local r,s;
r:=sum(
binomial(n,k)*(p^k)*((1-p)^(n-k)),k=m...n
);
s:=sum(
binomial(n,k)*(q^k)*((1-q)^(n-k)),k=0...m
);
lprint("There is a",100*r,"percent chance that p will loose given that the p hypothesis is correct while there is a ",
100*s,"percent chance that q loose when the q hypothesis is correct.");
BinomialPlot(n,m,p,q);
end:

> Hyp(58,32,.5,.62);

"There is a", 25.59211542, "percent chance that p will loose given that the p hypothesis is correct while there is a ", 17.42969845, "percent  chance that q  loose when the q hypothesis is correct."

`Note: some data values lie outside the user-defined interval.`

`Note: some data values lie outside the user-defined interval.`

`Note: some data values lie outside the user-defined interval.`

[Maple Plot]

> Hyp(25,17,.5,.8);

"There is a", 5.387607217, "percent chance that p will loose given that the p hypothesis is correct while there is a ", 10.91227960, "percent  chance that q  loose when the q hypothesis is correct."

`Note: some data values lie outside the user-defined interval.`

`Note: some data values lie outside the user-defined interval.`

`Note: some data values lie outside the user-defined interval.`

[Maple Plot]

> Hyp(50,33,.5,.8);

"There is a", 1.641956878, "percent chance that p will loose given that the p hypothesis is correct while there is a ", 1.444165732, "percent  chance that q  loose when the q hypothesis is correct."

`Note: some data values lie outside the user-defined interval.`

`Note: some data values lie outside the user-defined interval.`

`Note: some data values lie outside the user-defined interval.`

[Maple Plot]

> Hyp(100,65,.5,.8);

"There is a", .1758820861, "percent chance that p will loose given that the p hypothesis is correct while there is a ", .3360871616e-1, "percent  chance that q  loose when the q hypothesis is correct."

`Note: some data values lie outside the user-defined interval.`

`Note: some data values lie outside the user-defined interval.`

`Note: some data values lie outside the user-defined interval.`

[Maple Plot]

> Hyp(200,79,.3,.5);

"There is a", .2606229066, "percent chance that p will loose given that the p hypothesis is correct while there is a ", .1817473976, "percent  chance that q  loose when the q hypothesis is correct."

`Note: some data values lie outside the user-defined interval.`

`Note: some data values lie outside the user-defined interval.`

`Note: some data values lie outside the user-defined interval.`

[Maple Plot]