# Daniel Yang, Due Sept. 20, 9:00pm # OK to post Homwork # 1) Carefully study the Maple code for lecture 4 and find # CP({a,b,c},{b,c,d}); = {[a, b], [a, c], [a, d], [b, b], [b, c], [b, d], [c, b], [c, c], [c, d]} # CheckMult({1,2},{3,4}); = true # CheckAdd({1,2,3},{3,4,5}) = {1, 2, 3}, {3, 4, 5}, have the following common elements , {3} FAIL # member([d,o,r,o,n],Words({d,o,n,r},5)); = true # 2) # n = 106 (howevever, I got A262530 instead of A27) # 3) Help3 := proc() print(` PIE2(U,A1,A2)`); end proc; with(combinat); PIE2 := proc(U, A1, A2) local R, S, A, B; if type(U, set) then else return FAIL; fi; if type(A1, set) then else return FAIL; fi; if type(A2, set) then else return FAIL; fi; if A1 subset U then else return FAIL; fi; if A2 subset U then else return FAIL; fi: A := U minus A1; B := U minus A2; S := nops(A intersect B); R := nops(U) - nops(A1) - nops(A2) + nops(A1 intersect A2); [S, R]; end: