
Help:=proc(): print(`GF1(x,t), GF1p(x,t,p), GF1pMoa(x,t,p,q)`):end:


#GF1(x,t): the weight-enumerator of the set
#of all words in {1,-1} where the weight of
#a word is t^lenght(w)*x^(sum(w))
GF1:=proc(x,t) local f1,fm1,sol:

#F1={[1]} union {F1 1} union {Fm1 1}:

sol:=
solve({f1=t*x+ f1*t*x+ fm1*t*x,
fm1=t/x+ f1*t/x+ fm1*t/x},{f1,fm1});

factor(normal(1+subs(sol,f1)+subs(sol,fm1)));

end:

#GF1p(x,t,p): the weight-enumerator of the set
#of all words in {1,-1} where the weight of
#a word is t^lenght(w)*x^(sum(w))*its probabilty
GF1p:=proc(x,t,p) local f1,fm1,sol:

#F1={[1]} union {F1 1} union {Fm1 1}:

sol:=
solve({f1=t*x*p+ f1*t*x*p+ fm1*t*x*p,
fm1=t/x*(1-p)+ f1*t/x*(1-p)+ fm1*t/x*(1-p)},{f1,fm1});

factor(normal(1+subs(sol,f1)+subs(sol,fm1)));

end:

#GF1pMoa(x,t,p,q): the weight-enumerator of the set
#of all words in {1,-1} where the weight of
#a word is t^lenght(w)*x^(sum(w))*its probabilty
#where the probability of having the same outcome
#is yesterday is p 
GF1pMoa:=proc(x,t,p,q) local f1,fm1,sol:

#F1={[1]} union {F1 1} union {Fm1 1}:

sol:=
solve({f1=t*x*p+ f1*t*x*p+ fm1*t*x*q,
fm1=t/x*q+ f1*t/x*q+ fm1*t/x*p},{f1,fm1});

factor(normal(1+subs(sol,f1)+subs(sol,fm1)));

end:





