##################################################################### ##MKP.txt: Save this file as MKP.txt # ## To use it, stay in the # ##same directory, get into Maple (by typing: maple ) # ##and then type: read MKP.txt # ##Then follow the instructions given there # ## # ##Written by Doron Zeilberger, Rutgers University , # #DoronZeil at gmail dot com # ###################################################################### #Created: Jan. 2018 print(`Created: Jan. 3, 2018`): print(` This is MKP.txt `): print(`It is one of the packages that would accompany, the article `): print(`On Meta-Knowledge Puzzles`): print(`by Shalosh B. Ekhad and Doron Zeilberger`): print(`if that article existed.`): print(`and also available from Zeilberger's website`): print(``): print(`Please report bugs to DoronZeil at gmail dot com `): print(``): print(`The most current version of this package and paper`): print(` are available from`): print(`http://sites.math.rutgers.edu/~zeilberg/ .`): print(`---------------------------------------`): print(`For a list of the Supporting procedures type ezra1();, for help with`): print(`a specific procedure, type ezra(procedure_name); .`): print(``): print(`---------------------------------------`): print(`---------------------------------------`): print(`For a list of the Verbose procedures type ezraV();, for help with`): print(`a specific procedure, type ezra(procedure_name); .`): print(``): print(`---------------------------------------`): print(`---------------------------------------`): print(`For a list of the MAIN procedures type ezra();, for help with`): print(`a specific procedure, type ezra(procedure_name); .`): print(``): print(`---------------------------------------`): with(combinat): ezra1:=proc() if args=NULL then print(` The supporting procedures are: IsGoodPair, IsGoodPairG `): print(``): else ezra(args): fi: end: ezraV:=proc() if args=NULL then print(` DetailS, GoodPairsV, GoodPairsVg, GsetV, GsetVg, IsGoodPairV, IsGoodPairVg, IsGSv, IsGSvG, PosePuzzle`): print(` P1v, P2v, PuzzleBook, PWv, PWvG, S1v, UnPv `): print(``): else ezra(args): fi: end: ezra:=proc() if args=NULL then print(`The main procedures are: DB, FindGoodPuzzles, GoodPairs, GoodPairsG, Gset, GsetG, IsGS, IsGSg, P1, P1g, P2, P2g, PW, PWg,S1, SolTableG, UnP, UnPg `): print(` `): elif nops([args])=1 and op(1,[args])=DB then print(`DB(x,y): a data-base of good puzzles. Try:`): print(`DB(x,y);`): elif nops([args])=1 and op(1,[args])=DetailS then print(`DetaiS(S,x,y): gives detailed solutions to in pre-computed lists of puzzles, S, phrased in terms of variables`): print(`x and y, that are known to be good.`): print(` Try: `): print(` DetailS([op(1..10,DB(x,y))],x,y); `): elif nops([args])=1 and op(1,[args])=FindGoodPuzzles then print(`FindGoodPuzzles(K,M,k,x,y):`): print(`finds all pairs [a*(y-x)^2+b*x^2, c*(y-x)+d*x], with PWg(K,a*(y-x)^2+b*x^2,c*(y-x)+d*x,x,y);`): print(`1<=a,b,c,d<=M has non-emtpy but <=k solutions. Try: `): print(`FindGoodPuzzles(50,3,1,x,y);`): elif nops([args])=1 and op(1,[args])=GoodPairs then print(`GoodPairs(N): the set of pairs [x,y], 1{} and nops(lu)<=k then gu:=gu union {[K,expand(a*(y-x)^2+b*x^2), expand(c*(y-x)+d*x)]}: fi: od: od: od: od: gu: end: #PosePuzzle(N,peu1,peu2,k): poses a Meta-Knowledge puzzle and numbers it Puzzle k. Try #Try PosePuzzle(100,x*y,x+y,1); PosePuzzle:=proc(N,peu1,peu2,k) : print(`Puzzle Number`, k): print(``): print(`All integers greater than one but less than`, N, `are put into a hat and two are drawn, let's call the smaller number x and the larger number y.`): print(` Samantha is given`, peu2, `and Porfirio is given`, peu1): print(`Sanantha says:`): print(` " I can see that you don't know the numbers. "`): print(``): print(`Porfirio replies: NOW I do know them. `): print(``): print(`Now Samantha says: NOW I do TOO!`): print(``): print(`What are the numbers?`): print(``): print(`----------------------------------------------------------------------`): end: #PuzzleBook(S,x,y): makes a book of Meta-Knowledge puzzle given in pre-computed lists of puzzles, S, phrased in terms of variables #x and y, that are known to be good. #Try: #PuzzleBook([op(1..10,DB(x,y))],x,y); PuzzleBook:=proc(S,x,y) local i: print(nops(S)+1, `Meta-Knowledge puzzle inspired by the the Puzzle "Sums and Products" in Peter Winkler's Wonderful book "Mathematical Mind-Benders"`): print(``): print(`By Shalosh B. Ekhad `): print(``): print(`On page 114 of Peter Winkler's book,"Mathematical Mind-Benders" (A.K. Peters, 2007), the following challenging puzzle appeared`): print(``): PosePuzzle(100,x*y,x+y,0) : print(``): print(`Inspired by this puzzle, I composed`, nops(S), `similar puzzles. The answers are at the bottom`): print(`For (very!) detailed solutions see a separate file also available from Doron Zeilberger's website. `): print(``): for i from 1 to nops(S) do PosePuzzle(op(S[i]),i) : od: print(``): print(`------------------------------------------------------------------`): print(``): print(` Answers `): print(``): print(`Answer to the (original) puzzle 0 is`, op(PW(100)[1][2]) ): print(``): for i from 1 to nops(S) do print(`Answer to Puzzle Number `, i, ` is `, op(PWg(op(S[i]),x,y)[1][2])): print(``): od: end: #DetaiS(S,x,y): gives detailed solutions to in pre-computed lists of puzzles, S, phrased in terms of variables #x and y, that are known to be good. #Try: #DetailS([op(1..10,DB(x,y))],x,y); DetailS:=proc(S,x,y) local i: print(nops(S)+1, `Detailed Solutions to Meta-Knowledge puzzle inspired by the the Puzzle "Sums and Products" `): print(`in Peter Winkler's Wonderful book "Mathematical Mind-Benders"`): print(``): print(`By Shalosh B. Ekhad `): print(``): print(`Here is a detailed solution to the original solution`): print(``): PWv(100): print(``): for i from 1 to nops(S) do print(``): print(`Detailed Solution to Puzzle Number`, i): print(``): PWvG(op(S[i]),x,y): print(``): od: end: