{VERSION 6 0 "IBM INTEL NT" "6.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }} {SECT 0 {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 77 "with(Maplets): with(Maplets[Tools]) : with(Maplets[Elements]): \nStartEngine();" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 12 "randomize():" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 1132 "SolveLogEq:=Maplet(onstartup = RunWindow(MAIN), \nW indow[MAIN]('title'=\"Solving Logarithmic Equations\",\n [ halign=non e,\n [ Button(\"New Equation\", Evaluate(function=\"new\")),\n \+ HorizontalGlue(),\n Button(\"Quit\",Shutdown())\n ],\n [ \+ \"Solve the following logarithmic equation for x.\",\n Horizontal Glue()\n ],\n [ MathMLViewer['MMLV1'](width=300, height=50)\n \+ ],\n [ \"Select:\",\n HorizontalGlue(),\n RadioButton[RB sol0](\"0 solutions\", false, group=BG1),\n RadioButton[RBsol1]( \"1 solution\", false, group=BG1),\n RadioButton[RBsol2](\"2 solu tions\", false, group=BG1),\n HorizontalGlue()\n ], \n [ Ho rizontalGlue(),\n Label[Lx1](\"x=\"), TextField['answer1']('width '=5), \n Label[Lx2](\"x=\"), TextField['answer2']('width'=5),\n \+ HorizontalGlue()\n ],\n [ Button(\"Check\", Evaluate('functi on'= \"check\")),\n Button(\"Show\", Evaluate('function'=\"show\" ))\n ],\n [ TextField['reply']('width'=40, 'editable'='false')\n ],\n [ \"Programmer: Tate\",\n HorizontalGlue(),\n \" Copyright P. Yasskin 2005\"\n ]\n ]\n),\nButtonGroup[BG1](onchange =Evaluate(function=\"numsol\"))\n):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 778 "new:=p roc()\nlocal rand12,rand19,q,r,Q,R,P,A,B,C,eqn,sol;\nglobal nsols,corr ectanswer1,correctanswer2;\nrand12:=rand(1..2);\nrand19:=rand(1..9);\n q:=rand12();\nr:=rand12();\nQ:=(-1)^q*rand19();\nR:=(-1)^r*rand19();\n P:=(-1)^(q+r+1)*rand19();\nA:=P;\nB:=-(Q+R);\nC:=-P*Q*R;\neqn:=log(A*x )+log(x+B)=log(C);\nsol:=solve(eqn,x);\nnsols:=nops([sol]);\nif nsols= 2 then\n correctanswer1:=sol[1];\n correctanswer2:=sol[2];\nelif nso ls=1 then\n correctanswer1:=sol;\n correctanswer2:=NULL;\nelse\n co rrectanswer1:=NULL;\n correctanswer2:=NULL;\nend if;\nSet('MMLV1'=Mat hML[Export](eqn));\nSet('RBsol0'=false);\nSet('RBsol1'=false);\nSet('R Bsol2'=false);\nSet(answer1=\"\", answer1(visible)=false);\nSet(answer 2=\"\", answer2(visible)=false);\nSet(Lx1(visible)=false);\nSet(Lx2(vi sible)=false);\nSet(reply=\"\");\nend proc:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 677 "numsol:=proc()\nglobal user_nsols;\nif Get('RBs ol2'::truefalse) then\n user_nsols:=2;\n Set(answer1(visible)=true); \n Set(answer2(visible)=true);\n Set(Lx1(visible)=true);\n Set(Lx2( visible)=true);\nelif Get('RBsol1'::truefalse) then\n user_nsols:=1; \n Set(answer1(visible)=true);\n Set(answer2=\"\", answer2(visible)= false);\n Set(Lx1(visible)=true);\n Set(Lx2(visible)=false);\nelif G et('RBsol0'::truefalse) then\n user_nsols:=0;\n Set(answer1=\"\", an swer1(visible)=false);\n Set(answer2=\"\", answer2(visible)=false);\n Set(Lx1(visible)=false);\n Set(Lx2(visible)=false);\nelse\n Set(re ply=\"You need to select a radio button to indicate the number of solu tions.\");\nend if;\nend proc:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 436 "check:=proc()\n local user_answer1, user_answer2:\nglobal nsols, user_nsols, correctan swer1, correctanswer2:\nuser_answer1:=Get('answer1'::anything);\nuser_ answer2:=Get('answer2'::anything);\nif user_nsols<>nsols then\nSet('re ply'=\"You do not have the correct number of solutions.\");\nreturn\ne nd if;\nif \{user_answer1, user_answer2\} = \{correctanswer1, correcta nswer2\} then\nSet('reply'=\"Correct\");\nelse\nSet('reply'=\"Incorrec t\");\nend if;\nend proc:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 898 "show:=proc()\nglobal nsols, user_nsols, correctanswer1, correctan swer2:\nif correctanswer1=NULL then\n Set('answer1'=\"\");\nelse\n S et('answer1'=correctanswer1);\nend if;\nif correctanswer2=NULL then\n \+ Set('answer2'=\"\");\nelse\n Set('answer2'=correctanswer2);\nend if; \nSet(reply=\"\");\nif nsols=2 then\n Set('RBsol2'=true);\n user_n sols:=2;\n Set(answer1(visible)=true);\n Set(answer2(visible)=true); \n Set(Lx1(visible)=true);\n Set(Lx2(visible)=true);\nelif nsols=1 t hen\n Set('RBsol1'=true);\n user_nsols:=1;\n Set(answer1(visible)=t rue);\n Set(answer2=\"\", answer2(visible)=false);\n Set(Lx1(visible )=true);\n Set(Lx2(visible)=false);\nelif nsols=0 then\n Set('RBsol0 '=true);\n user_nsols:=0;\n Set(answer1=\"\", answer1(visible)=false );\n Set(answer2=\"\", answer2(visible)=false);\n Set(Lx1(visible)=f alse);\n Set(Lx2(visible)=false);\nelse\n Set(reply=\"You need to cl ick on New Equation.\");\nend if;\nend proc:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "Display(SolveLogEq);" }}}}{MARK "0 0 0" 0 } {VIEWOPTS 1 1 1 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }