#Today was such a nice day, so most of the class was outside. In the first 20 minutes we discussed the class project #and below (see Help) are some very rudimentary Maple procedures that may be useful for the porject. #It relies on the stuff we did in C22.txt and C23.txt that is also included in this file Help:=proc(): print(`EvalB(f,n,v), EvalBT(L,n,v), FP(L,n), BtoA(f,x), RandTF(n,r,K), gFP(L,n), `): end: ###stuff from C23.txt Help23:=proc(): print(`IsTa(D1,n), Inter1(S1,S2), Inter(S), Wt(S) , Wtr(S,r), NuPts(D1,n)`) : print(`IsTb(D1,n) `): end: with(combinat): ##stuff from C22.txt #C22.txt, April 11, 2016 #"Tautologically" of Disjunctive normal form DNF Help22:=proc(): print(`RC(n,r), RDNF(n,r,K) ,SubCube(C,n), TF(D1,n) `): end: #Group Class assignment: #Producer: Andrew Lohr #Associate Producer for real Math: Anthony #Associate Producer for human interface: Alejandro #Actors for real math: {John C., Keith, Bryan, Jinyoung}; #Actors for stories (under Alejandro): {Ali,Xukai, Emily, Mingjia} #Sanitation engineer: Richard V. #Becky: can pick what she wants #RC(n,r): a random disjunction in n veriables with r terms #Data structre for a single conjunction is a susbet of {1,2,..,n,-1, ..., -n} #such that i and -i can't be together. For example #not x3 AND x7 AND not x9= {-3,7,-9}. RC:=proc(n,r) local S,a,b,ra1,ra2: ra1:=rand(1..n): ra2:=rand(0..1): S:={}: while nops(S)=1 then RETURN(true,r): fi: od: FAIL: end: ###stuff from C23.txt ##New stuff done by Dr. Z. #EvalB(f,n,v) Evaluates the Boolean function f (in DNF) of variables at truth vector v EvalB:=proc(f,n,v) if member(v,TF(f,n)) then 1: else 0: fi: end: #EvalBT(L,n,v) Evaluates the Boolean transformation(in DNF) of variables at truth vector v EvalBT:=proc(L,n,v) local i: [seq(EvalB(L[i],n,v),i=1..nops(L))]: end: #FP(L,n): the fixed points of the Boolean transformation FP:=proc(L,n) local C,v,S: C:=TF({{}},n): S:={}: for v in C do if EvalBT(L,n,v)=v then S:=S union {v}: fi: od: S: end: #BtoAand(C,x): algebraic rendition of clause C BtoAand:=proc(C,x) local i,gu: gu:=1: for i in C do if i>0 then gu:=gu*x[i]: elif i<0 then gu:=gu*(1-x[-i]): fi: od: gu: end: #BtoA(f,x): BtoA:=proc(f,x) local f1,la,a,b: la:=f[nops(f)]: if nops(f)=1 then RETURN( BtoAand(f[1],x)): fi: f1:=f minus {la}: a:=BtoAand(la,x): b:=BtoA(f1,x): expand(a+b-a*b): end: #RandTF(n,r,K): a random Boolean transformation in n verables where each comoponent is a random DNF with n variables, and K clauses, each with r terms RandTF:=proc(n,r,K) local i: [seq(RDNF(n,r,K),i=1..n)]: end: #gFP(L,n): the fixed points of the Probability-generalization of a Boolean transformation gFP:=proc(L,n) local x,L1,G,g,i: L1:= [seq(BtoA(L[i],x),i=1..nops(L))]: G:={solve({seq(x[i]=L1[i],i=1..nops(L1))},{seq(x[i],i=1..n)})}: {seq(evalf(subs(g,[seq(x[i],i=1..n)])),g in G)}: end: