{VERSION 2 3 "SUN SPARC SOLARIS" "2.3" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Heading 1" 0 3 1 {CSTYLE "" -1 -1 "" 1 18 0 0 0 0 0 1 0 0 0 0 0 0 0 }1 0 0 0 6 6 0 0 0 0 0 0 -1 0 }} {SECT 0 {SECT 1 {PARA 3 "" 0 "" {TEXT -1 30 "Definition of flip_coin( \+ ) ..." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 52 "flip_coin := proc() \n local val;\n val := rand(0..1" }{TEXT -1 0 "" }{MPLTEXT 1 0 53 " );\n if (val()=0) then\n H;\n else\n T;\n fi\nend:" }}}} {SECT 1 {PARA 3 "" 0 "" {TEXT -1 30 "Definition of roll_dice( ) ..." } }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 67 "roll_dice := proc()\n loca l val;\n val := rand(1..6);\n val();\nend:" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 35 "Definition of random name array ..." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 94 "names := array(1..4):\nnames[1] := Tom:\n names[2] := Susan:\nnames[3] := Jack:\nnames[4] := Cathy:" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 40 "Definition of Problem #1, Set Theory .. ." }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 1481 "prob1 := proc()\nloca l dim, setU, setA, setB, setC, val1, val2, nA, nB, nC, i, ans;\ndim := \{2,4,6,8\}:\nsetU := \{1,2,3,4,5,6,7,8,9, 10\}:\nsetA := \{\}:\nsetB := \{\}:\nsetC := \{\}:\nval1 := rand(1..4):\nval2 := rand(1..10):\nn A:= dim[val1()]:\nnB:= dim[val1()]:\nnC:= dim[val1()]:\nfor i from 1 t o nA do\n setA := setA union \{val2()\}:\nod:\nfor i from 1 to nB do \n setB := setB union \{val2()\}:\nod:\nfor i from 1 to nC do\n setC := setC union \{val2()\}:\nod:\nsetA;\nsetB;\nsetC;\nprintf (`Given t he Universal Set, U= `); lprint(setU);\nprintf (`\\t Given A=`); lprin t(setA);\nprintf (`\\t Given B=`); lprint(setB);\nprintf (`\\t Given C =`); lprint(setC);\n\nprintf (`what is A union B?`);\nans := readstat( `enter answer, followed by;\\n`);\nif (ans = (setA union setB)) then\n printf (`Correct!\\n\\n`);\nelse \n printf (`You said `); lprint(an s);\n printf (`\\t but the correct answer is `);\n lprint(setA union setB); \n printf (`\\n`);\nfi;\n\nprintf (`what is A intersect B?`); \nans := readstat(`enter answer, followed by;\\n`);\nif (ans = (setA i ntersect setB)) then\n printf (`Correct!\\n\\n`);\nelse \n printf (` You said `); lprint(ans);\n printf (`\\t but the correct answer is `) ;\n lprint(setA intersect setB);\n printf (`\\n`);\nfi;\n\nprintf (` what is the complement of A?`);\nans := readstat(`enter answer, follow ed by;\\n`);\nif (ans = (setU minus setA)) then\n printf (`Correct!\\ n\\n`);\nelse \n printf (`You said `); lprint(ans);\n printf (`\\t b ut the correct answer is `);\n lprint(setU minus setA);\n printf (` \\n`);\nfi;\nend:" }}}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "prob1( );" }}}}{MARK "4 0 0" 0 }{VIEWOPTS 1 1 0 1 1 1803 }