>
"Open and run the the Flipping program! This is because the Streaks program uses data produced by the CoinToss program and MaxStreaks uses the program itself.":
"Here is a program that takes a coin flip list (Produced by CoinToss) and lists all the streak totals associted to the list.":
with(stats):
Streaks:=proc(L)
local n,R,t,k;
R:=[];
t:=1;
n:=nops(L);
for k from 2 to n
do
if
L[k] = L[k-1]
then
t:=t+1;
fi;
if L[k] <> L[k-1]
then
R:=[op(R),t] ;
t:=1;
fi;
od;
[op(R),t];
end:
"Here we have a program that perform the follwing experiment m times: take a coin and flip it n times and record the longest streak each time.":
MaxStreak:=proc(n,m)
local i,T;
T:=[];
for i from 1 to m
do
T:=[op(T),max(op(Streaks(CoinToss(n))))];
od;
T;
end:
Warning, these names have been redefined: anova, describe, fit, importdata, random, statevalf, statplots, transform
>
"This example uses the C1 created with in the flipping example":
S1:=Streaks(C1);
> M1:=MaxStreak(14,10);
>
"Notice the colon supresses having to view the list, but the data is still produced after you hit return and the resulting list is called MS":
MS:=MaxStreak(14,1000):
>