#C12.txt Help12:=proc(): print(`Ex1(), RG(n,K), FM(f,n), BM(f,n) `): end: Ex1:=proc():table([({3})=18,({2})=12,({})=0,({1, 3})=60,({2, 3})=90,({1, 2})=30,({1})=6,({1, 2, 3})=120]):end: with(combinat): #RG(n,K): inputs an and K outputs a random "n-person game" with entries in [0,K] RG:=proc(n,K) local ra,PS,S,f: ra:=rand(0..K): f[{}]:=0: PS:=powerset(n): for S in PS minus {{}} do f[S]:=ra(): od: op(f): end: #FM(f,n): inputs a function from 2^{1,...n} to pos. real numbres #we want g(T)= Sum of g(S) over all subsets S of T FM:=proc(f,n) local S,PS,PN,g,S1: PN:=powerset(n): for S in PN do PS:=powerset(S): g[S]:=add(f[S1], S1 in PS): od: op(g): end: #BM(f,n): inputs a function from 2^{1,...n} to pos. real numbres #we want g(T)= Sum of (-1)^(|T|-|S|)*g(S) over all subsets S of T BM:=proc(f,n) local S,PS,PN,g,S1: PN:=powerset(n): for S in PN do PS:=powerset(S): g[S]:=add( (-1)^(nops(S)-nops(S1))*f[S1], S1 in PS): od: op(g): end: