{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 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 1 }{CSTYLE "2D Output" 2 20 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 256 "" 1 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 257 "" 1 14 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 258 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 259 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 260 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 261 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 262 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 263 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 264 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 265 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 266 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 267 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 268 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 269 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 270 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 271 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 272 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 273 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 274 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 275 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 276 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 277 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 278 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 279 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 280 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 281 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 282 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 283 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 284 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 285 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 } {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 }{PSTYLE "Heading 1" -1 3 1 {CSTYLE "" -1 -1 "Times" 1 18 0 0 0 1 2 1 2 2 2 2 1 1 1 1 }1 1 0 0 8 4 1 0 1 0 2 2 0 1 }{PSTYLE "Text Output" -1 6 1 {CSTYLE "" -1 -1 "Cour ier" 1 10 0 0 255 1 2 2 2 2 2 1 2 1 3 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 } {PSTYLE "Warning" -1 7 1 {CSTYLE "" -1 -1 "Courier" 1 10 0 0 255 1 2 2 2 2 2 1 1 1 3 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Error" -1 8 1 {CSTYLE "" -1 -1 "Courier" 1 10 255 0 255 1 2 2 2 2 2 1 1 1 3 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Maple Output" -1 11 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }3 3 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Normal" -1 256 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }3 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Normal" -1 257 1 {CSTYLE "" -1 -1 "Times" 1 14 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 {PARA 256 "" 0 "" {TEXT -1 0 "" }{TEXT 256 39 "Maple Code for \+ Creating Useful Maplets " }{TEXT -1 0 "" }}{PARA 256 "" 0 "" {TEXT 257 52 "by Douglas Meade, Phillip Yaskin, and Waterloo Maple" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 257 "" 0 "" {TEXT -1 196 "Note that ve rsions of all of the following maplets (and more) are available using \+ the Standard (not the Classic) version of Maple 10 by clicking on the \+ 'Tools' pull down menu and then on 'Tutors'." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 32 "Function Plotter (small example)" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }{TEXT 261 36 "Click in red area and press [Enter]." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 868 "#Douglas Meade\n#with(Maplets[Elements]):\n#with(Maplets):\nuse Maple ts, Maplets[Elements] in\n\nFunctionPlotter := Maplet(\n [\n [\n \+ \"Plot the function\",\n TextBox['f'](width=20, value=\"x^2\")\n \+ ],\n [\n \" on x = \",\n TextBox['a'](width=8,value=\"-2\"), \n \"to \",\n TextBox['b'](width=8,value=\"3\")\n ],\n [\n \+ \"with y = \",\n TextBox['c'](width=8,value=\"0\"), \n \"to \+ \",\n TextBox['d'](width=8,value=\"10\")\n ], \n [\n Plotter ['P'](height=300,width=300)\n ],\n [\n Button(\"Plot\", Evaluat e( 'P' = 'plot(f, x=a..b, y=c..d)' )),\n Button(\"Reset to Default \", onclick='clear' ),\n Button(\"Close\", Shutdown())\n ]\n ], \n Action['clear'](\n SetOption( 'f'=\"x^2\" ),\n SetOption( 'a'= \"-2\" ),\n SetOption( 'b'=\"3\" ),\n SetOption( 'c'=\"0\" ),\n \+ SetOption( 'd'=\"10\" ),\n Evaluate( 'P'='plot(0)' )\n )\n):\nend \+ use:\nMaplets:-Display(FunctionPlotter):" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 10 "Continuity" }}{EXCHG {PARA 0 "" 0 "" {TEXT 262 36 "Click \+ in red area and press [Enter]." }{TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 11844 "# Continutity Maplet\n# Copyright 2002 Waterloo Ma ple Inc.\n# This maplet graphically illustrates the delta-epsilon defi nition of continuity. The definition states that f(x) is continuous a t x=a if, for all e>0, there exists d>0 such that 0<|x-a|0, th ere exists d>0 such that 0<|x-a| \+ " 0 "" {MPLTEXT 1 0 52944 "# Step-by-Step Limit Problem Solver Maplet \n# Copyright 2002 Waterloo Maple\n# \n# This maplet guides the user t hrough a limit problem. The user can apply limit rules one at a time t o a function f and see the resulting expression. The Messages box disp lays status information.\n# \n# The user enters a function with its in dependent variable, x, and the limit point, a, that x approaches. The \+ user can apply limit rules, for example, the sum rule or any specified mathematical function, such as the sine rule. The user can also apply l'Hopital's rule, a rewrite rule, or a change of variable rule by spe cifying additional arguments. When the user applies a rule, the Proble m Status box displays the result.\n# \n# For any rule, the user can di splay a definition.\n# \n# At any time, the user can request a hint fo r the next step, and then apply the hint.\n# \n# The user can also sp ecify that a set of rules is understood, in which case those rules are automatically applied when possible. \n# \n# At any time, the user c an display all solution steps in the solution or display the final ans wer.\n# \n# To run this maplet, click the Execute (!!!) button in the \+ context bar.\nrestart:\nLimMaplet := module()\n\n##################### #######################################\n\nexport iniMathML, addMathML , runLimMaplet, \n startRule, applyRule, applyOtherRule,\n \+ applyMathFuncRule, getHint, applyHint, \n getFinalAnswer, showA llSteps, clearSteps,\n applyRuleWithArgs, changeUnderstoodRules, forgetUnderstoodRule,\n aboutRule, helpStr:\nlocal steps, lhopi talStr, changeStr, rewriteStr:\nsteps := []:\n\n###################### ######################################\n\n############################ ################################\n\nlhopitalStr := \n\"If f(x)/g(x) is an indeterminate form at x = a, then L(f(x)/g(x)) = L(f'(x)/g'(x)) (i f the latter limit exists).\n\nTo use l'Hopital's rule, you must enter the numerator for the application of the rule in the 'Rules with Argu ments' text box.\":\n\nrewriteStr := \n\"The rewrite rule changes the \+ form of the expression in the limit without changing the limit variabl e.\n\nTo use the rewrite rule, you must enter one or more substitution equations in the 'Rules with Arguments' text box. The maplet performs each substitution listed. Occurrences of the left-hand side of each s ubstitution are replaced by the corresponding right-hand side.\":\n \n changeStr := \n\"The change rule changes the variable with respect to \+ which the limit is computed.\n\nTo use the change rule, you must enter an equation describing the change of variables, F(x,u) = G(x,u), in t he 'Rules with Arguments' text box.\":\n\n############################ ################################\n\n################################## ##########################\nhelpStr := \n\"This maplet guides you thro ugh a limit problem. You can apply limit rules one at a time to a func tion f and see the resulting expression. The 'Messages' box displays s tatus information.\n\nEnter a function with its independent variable, \+ x, and the limit point, a, that x approaches. Click the 'Start' button . This clears the problem history and starts a new one. \n\nTo apply \+ limit rules click the corresponding buttons or select rules from the ' Apply the Rule' menu. Rules include the sum rule and any specified mat hematical functions, such as the sine rule. To apply math functions en ter a valid math function command and then click the 'Apply' button, o r click the 'Select a Function' button and then click or enter a math \+ function in the pop-up window and then click the 'Apply' button. To ap ply l'Hopital's rule, a 'rewrite' rule, or a 'change' rule, you must s pecify additional arguments. Enter the arguments in the text box above the buttons (separated by commas if there is more than one). For more information on rules that use additional arguments, select 'Using Rul es with Arguments' from the 'File' menu.\n\nWhen you apply a rule, the 'Problem Status' box displays the result.\n\nTo view the definition o f a rule, select the rule from the 'Rule Definition' menu. \n\nAt an y time, you can request a hint for the next step. To request a hint, c lick the 'Obtain a Hint' button or select 'Obtain a Hint' from the 'Fi le' menu. To apply a hint, click the 'Apply the Hint' button or select 'Apply the Hint' from the 'File' menu.\n\nIf you understand a rule, y ou can select the rule from the 'Understood Rules' menu. The maplet t hen applies the rule when possible.\n\nTo show all solution steps, cli ck the 'All Steps' button or select 'Show All Steps' from the 'File' m enu. To display the final answer, click the 'Final Ans' button or sele ct 'Final Answer' from the 'File' menu.\n\nTo clear the problem histor y, click the 'Clear' button or select 'Clear' from the 'File' menu.\": # end helpStr\n\n#################################################### ########\n\n########################################################## ##\n# pre: iniEqn :: algebraic expression\n# post: returns the Present ation MathML of iniEqn\n\niniMathML := proc(iniEqn)\n MathML:-ExportP resentation(iniEqn);\nend proc: # end iniMathML\n\n################### #########################################\n\n######################### ###################################\n# pre: mathMLStr :: string, in fo rm of Presentation MathML\n# addEqn :: algebraic expression\n# po st: addEqn appends to the next line of mathMLStr,\n# returns the updated mathMLStr \n\naddMathML := proc(mathMLStr, addEqn)\n local \+ tree, cmc, child, children, nl, eqnSign;\n use XMLTools in\n tree \+ := FromString(mathMLStr);\n cmc := ContentModelCount(tree);\n ch ild := FromString(MathML:-ExportPresentation(addEqn));\n children : = ContentModel(child);\n nl := FromString(\" \");\n eqnSign := Element(\"mo\",\"=\");\n tree := AddChild(tre e,nl,cmc);\n tree := AddChild(tree,eqnSign,cmc+1);\n for child i n children do \n cmc := ContentModelCount(tree);\n tree := A ddChild(tree,child,cmc);\n end do:\n tree := MakeElement(\"mrow \", [], ContentModel(tree) ):\n tree := Element(\"math\", tree):\n \+ ToString(tree):\n end use:\nend proc: # end addMathML\n\n######### ###################################################\n\n############### #############################################\n# pre: null \n# post: i nitializes the Limit problem solving process\n# if input is corr ect, limit equation is added to steps\n# understood rules apply \+ if capable\n# MathML Viewer updates too\n# else error mess age shows\n\nstartRule := proc()\n local funStr, varStr, ptStr, dirSt r, limStr, \n infoStr, mlStr, limExpr, limEqn, hints, \n \+ i, uRules, uAppliedRules, rulesStr:\n use Student:-Calculus1, Maplet s:-Tools in\n \n clearSteps():\n funStr := Get('TF_fun'):\n \+ if funStr = \"\" then \n infoStr := \"Enter a valid expression \":\n Set('info'=infoStr):\n error \"No expression entered i n 'Function' text field\":\n end if: \n\n varStr := Get('TF_var' ):\n if varStr = \"\" then \n infoStr := \"Enter the limit var iable\":\n Set('info'=infoStr):\n error \"No limit variable \+ entered in 'Variable' text field\":\n end if: \n\n ptStr := Get( 'CB'):\n if ptStr = \"\" then \n infoStr := \"Enter the limit \+ point\":\n Set('info'=infoStr):\n error \"No limit point in \+ 'at' combination box\":\n end if: \n\n dirStr := Get('DDB'):\n \+ if dirStr <> \"\" then \n dirStr := cat(\", \",dirStr):\n en d if: \n\n limStr := cat(\"Limit(\", funStr, \", \" ,varStr, \"=\", ptStr, dirStr, \")\"):\n limExpr := parse(limStr):\n hints := H int(limExpr):\n mlStr := iniMathML(GetProblem()):\n infoStr := \+ \"Initializing\":\n Set('info'=infoStr):\n \n if nops(hints)> 0 then\n uRules := rhs(Understand(Limit)):\n uAppliedRules : = []:\n\n if nops(uRules) > 0 then\n for i from 1 to nops( hints) do \n if member(hints[i],uRules) = true then\n \+ uAppliedRules := [op(uAppliedRules),hints[i]]:\n end if: \n end do:\n\n limEqn := Rule[](GetProblem()): \n \+ steps := [op(steps),limEqn]:\n\n if nops(uAppliedRules) > 0 th en\n if nops(uRules) = 1 then \n rulesStr := conve rt(uRules,string):\n infoStr := cat(\"Understood rule \", r ulesStr,\n \" is automatically applied\"):\n else \n rulesStr := convert(uRules,string):\n \+ infoStr := cat(\"Understood rules \", rulesStr, \n \+ \" are automatically applied\"):\n end if: # \+ end if nops(uRules)=>1\n Set('info'=infoStr):\n mlSt r := addMathML(mlStr,rhs(limEqn)):\n end if: # end if nops(uApp liedRules)>0\n \n else \n limEqn := Rule[](GetProblem ()):\n steps := [op(steps),limEqn]: \n \n end if: # end \+ if nops(uRules) > 0\n \n Set('ML'=mlStr):\n infoStr := \+ \"Apply any rule below\":\n Set('info'=infoStr):\n \n else \n \+ infoStr := \"No limit rules could be applied\":\n Set('info' =infoStr): \n\n end if : # end if nops(hints)>0\n end use:\nend p roc:\n\n############################################################\n \n############################################################\n# pre: null \n# post: if aRule is a valid limit rule and applicable\n# \+ new step is stored in steps, updates MathMLViewer \n# else mess age shows the rule is not applied\n\napplyRule := proc(aRule)\n local mlStr, infoStr, limEqn, oldEqn:\n use Student:-Calculus1, Maplets:-T ools in\n \n if nops(steps)=0 then\n startRule():\n end \+ if:\n\n mlStr := Get('ML'):\n oldEqn := steps[nops(steps)]:\n \+ limEqn := Rule[aRule](steps[nops(steps)]):\n\n if GetMessage()=NUL L or (not evalb(limEqn=oldEqn)) then\n infoStr := convert(aRule,s tring): \n infoStr := cat(infoStr, \" rule is being applied\"):\n Set('info'=infoStr):\n\n steps := [op(steps),limEqn]:\n \+ mlStr := addMathML(mlStr,rhs(limEqn)):\n Set('ML'=mlStr):\n\n \+ infoStr := convert(aRule,string): \n infoStr := cat(infoStr, \+ \" rule has been applied\"):\n Set('info'=infoStr):\n else\n \+ infoStr := convert(aRule,string): \n infoStr := cat(infoStr, \+ \" rule is not applicable\"):\n Set('info'=infoStr):\n end if: # end if GetMessage()=NULL\n\n end use:\nend proc: # end applyRule() \n\n############################################################\n\n## ##########################################################\n# pre: nul l\n# post: apply the limit rule with arguments\n# if arguments m issing, error message shows\n\napplyRuleWithArgs := proc(aRule)\n loc al ruleArgs, ruleStr:\n use Student:-Calculus1, Maplets:-Tools, Maple ts:-Elements in\n \n ruleStr := convert(aRule,string):\n\n ru leArgs := Get('TB_args'):\n if ruleArgs = \"\" then\n Maplets: -Display(Maplet(\n MessageDialog(\"You must enter arguments to use this rule\"))): \n \n else\n ruleStr := cat(ruleStr, \", \",ruleArgs):\n applyRule([parse(ruleStr)]):\n end if:\n\n end use:\nend proc: # end applyRuleWithArgs\n\n##################### #######################################\n\n########################### #################################\n# pre: null \n# post: read the limi t rule from TF_other, and apply it\n# if TF_other is empty, erro r message shows\n\napplyOtherRule := proc()\n local aRule:\n use Map lets:-Tools in\n aRule := Get('TF_other'):\n if aRule = \"\" the n\n error \"No rule entered in 'Other Maple Mathematical Function s' text field\":\n else \n applyRule(parse(aRule)):\n end i f:\n end use:\nend proc: # end applyOtherRule\n\n#################### ########################################\n\n########################## ##################################\n# pre: null \n# post: read the lim it rule from TF_mathfunc, and apply it\n# if TF_mathfunc is empt y, error message shows\n\napplyMathFuncRule := proc()\n local aRule: \n use Maplets:-Tools in\n aRule := Get('TF_mathfunc'):\n if aR ule = \"\" then\n error \"No rule has been entered in 'Function R ules' text field\":\n else \n applyRule(parse(aRule)):\n en d if:\n end use:\nend proc: # end applyOtherRule\n\n################# ###########################################\n\n####################### #####################################\n# pre: null\n# post: hint for t he current limit problem is shown \n# in the message TextField, \+ info\n\ngetHint := proc()\n local limEqn, hint, infoStr:\n use Stude nt:-Calculus1, Maplets:-Tools in\n\n if nops(steps)=0 then\n s tartRule():\n end if:\n \n limEqn := steps[nops(steps)]:\n \+ hint := Hint(limEqn):\n \n if nops(hint)=0 then\n infoStr: =\"No rule could be applied, or the problem is done\":\n Set('inf o'=infoStr):\n else\n infoStr:=cat(convert(hint,string), \" co uld be applied\"):\n Set('info'=infoStr):\n end if:\n\n hin t: # return value used in applyHint\n\n end use:\nend proc: # end get Hint()\n\n############################################################ \n\n############################################################\n# pr e: null\n# post: hint for the current limit problem is applied \n\napp lyHint := proc()\n local hint:\n\n hint := getHint(): \n\n if nops (hint)>0 then\n applyRule(hint):\n end if:\n\nend proc: # end appl yRule\n\n############################################################ \n\n############################################################\n# pr e: null \n# post: final answer for the current problem is shown\n\nge tFinalAnswer := proc()\n local limEqn, hint, mlStr, infoStr:\n use S tudent:-Calculus1, Maplets:-Tools in\n\n if nops(steps)=0 then\n \+ startRule():\n end if:\n\n limEqn := steps[nops(steps)]:\n \+ hint := Hint(limEqn): \n\n if nops(hint)=0 then\n infoStr := \+ \"No rule could be applied, or the question is done\":\n Set('inf o'=infoStr):\n \n else \n mlStr := Get('ML'): \n while nops(hint)>0 do\n infoStr := cat(convert(hint,string),\" is be ing applied\"):\n Set('info'=infoStr):\n limEqn := Rule[ hint](limEqn):\n hint := Hint(limEqn): \n end do:\n s teps := [op(steps),limEqn]:\n infoStr := \"Exporting final answer \":\n mlStr := addMathML(mlStr,rhs(limEqn)):\n Set('ML'=mlSt r):\n infoStr := \"The final answer is displayed\":\n Set('i nfo'=infoStr):\n\n end if: # end if nops(hint)=0\n\n end use:\nend proc: # end getFinalAnswer\n\n####################################### #####################\n\n############################################# ###############\n# pre: null\n# post: a complete solution for the curr ent problem is shown\n\nshowAllSteps := proc()\n local limEqn, hint, \+ mlStr, infoStr:\n use Student:-Calculus1, Maplets:-Tools in\n\n if nops(steps)=0 then\n startRule():\n end if:\n \n limEqn := steps[nops(steps)]:\n hint := Hint(limEqn):\n\n if nops(hint )=0 then\n infoStr := \"No rule could be applied, or the question is done\":\n Set('info'=infoStr):\n \n else \n mlStr : = Get('ML'):\n\n while nops(hint)>0 do\n infoStr := cat(co nvert(hint,string),\" is being applied\"):\n Set('info'=infoStr ):\n limEqn := Rule[hint](limEqn):\n mlStr := addMathML( mlStr,rhs(limEqn)):\n hint := Hint(limEqn): \n end do:\n\n steps := [op(steps),limEqn]:\n\n infoStr := \"Exporting the complete solution\":\n Set('info'=infoStr):\n Set('ML'=mlSt r):\n infoStr := \"A complete solution is displayed\":\n Set ('info'=infoStr): \n\n end if: # end if nops(hint)=0\n \n \+ \n end use:\nend proc: # showAllSteps\n\n############################ ################################\n\n################################## ##########################\n# pre: name is a valid limit rule \n# \+ fun is in a valid algebraic expression or function \n# post: pop up a Window with the description of the rule 'name'\n\naboutRule := proc(n ame,fun)\n local eqn, limEqn, understoodRules:\n \n use Student:-Cal culus1, Maplets:-Tools in\n\n understoodRules := rhs(Understand(Lim it)):\n Understand(Limit,'none'):\n\n limEqn := Limit(fun,x='a') : \n eqn := limEqn=rhs(Rule[name](limEqn)): \n \n Set('ruleWin (title)'=cat(convert(name,string),\" rule\")):\n Set('ML_rule'=Math ML:-ExportPresentation(eqn)):\n\n Understand(Limit, op(understoodRu les)): \n \n end use: \nend proc: # end aboutRule\n\n############# ###############################################\n\n################### #########################################\n# pre: aRule is a valid lim it rule\n# post: if ruleState=true, aRule is understood\n# else, aRule is removed from understo0d limit rules\n\nchangeUnderstoodRules := proc(aRule, ruleState)\n use Student:-Calculus1 in\n if ruleSt ate=true then \n Understand(Limit,aRule):\n else\n forget UnderstoodRule(aRule):\n end if:\n end use: \nend proc: # end chan geUnderstoodRules\n\n################################################# ###########\n\n####################################################### #####\n# pre: aRule is a valid limit rule \n# post: aRule is removed f rom understood limit rules\n\nforgetUnderstoodRule := proc(aRule)\n l ocal rules:\n use Student:-Calculus1 in\n rules := rhs(Understand( Limit)):\n rules := subs(aRule=NULL,rules):\n Understand(Limit,' none'):\n if nops(rules)>0 then\n Understand(Limit,op(rules)); \n end if:\n end use:\nend proc:\n\n############################## ##############################\n\n#################################### ########################\n# pre: null\n# post: clears the historic rec ord of all steps\n\nclearSteps := proc()\n use Student:-Calculus1, Ma plets:-Tools in\n Set('ML'=\"\"): Set('info'=\"\"): Set('TB_args'= \"\"): \n Clear(all): steps:=[]:\n end use:\nend proc: # end clear Steps()\n\n########################################################### #\n\n############################################################\n# p re: Maple 8 or higher is installed\n# post: run Step-by-Step Limit Sol ver\n\nrunLimMaplet := proc()\n\nlocal maplet, bc, dc, lc:\nbc := 'bac kground'=\"#DDFFFF\":\ndc := 'background'=\"#CCFFFF\":\nlc := 'backgro und'=\"#EEFFFF\":\n\nuse Maplets, Maplets:-Elements, Student:-Calculus 1 in\n\nmaplet := Maplet( \n 'onstartup'=RunWindow('limWin'),\n\n Fo nt['F1'](\"Default\", 'bold'='true', 'size'=14),\n\n################## ##########################################\n \n Window['limWin']( 'm enubar'='limMB',\n 'resizable'='false', \n 'title'=\"Calculus 1 \+ - Step-by-Step Limit Problem Solver\",\n BoxColumn(bc, \n\n Bo xRow('border'='true','inset'=0,'spacing'=0, \n 'caption'=\"Ente r a function\", bc, \n Label('caption'=\"Function \", bc, 'fo nt'=F1),\n TextField['TF_fun']('value'=x*cos(x)*ln(x),'width'=2 0, 'onchange'='A', lc),\n Label('caption'=\" Variable \", bc, 'font'=F1), \n TextField['TF_var'](\"x\", 'width'=2,'onchange' ='A', lc),\n Label('caption'=\" at \", bc, 'font'=F1),\n \+ ComboBox[CB]('value'=\"0\",'onchange'='A', \n \+ [\"0\",\"infinity\",\"-infinity\"], lc),\n Label('caption'=\" \+ Direction \", bc, 'font'=F1),\n DropDownBox[DDB]('value'=\"\", 'onchange'='A',\n [\"\",\"left\",\"right\"], l c) \n ), # end BoxRow\n\n BoxRow('inset'=0,'spacing'=0, bc, \n BoxColumn('border'='true', 'inset'=0, 'spacing'=0, \n \+ 'caption'=\"Problem Status\", bc, \n BoxRow(MathMLViewer[ 'ML']('height'=470, 'width'=400, lc), bc),\n BoxRow('halign'= 'right', bc,\n Button(\"Start\", \n 'onclick'= Evaluate('function'='startRule()'),\n 'tooltip'=\"Initial ize limit problem\", lc),\n Button(\"Final Ans\", \n \+ 'onclick'=Evaluate('function'='getFinalAnswer()'),\n \+ 'tooltip'=\"Display the final answer\", lc), \n Button( \"All Steps\", \n 'onclick'=Evaluate('function'='showAllS teps()'),\n 'tooltip'=\"Display the complete solution\", \+ lc),\n Button(\"Clear\", \n 'onclick'=Evaluate ('function'='clearSteps()'),\n 'tooltip'=\"Clear output a nd problem history\", lc),\n Button(\"Close\", Shutdown(), \+ 'tooltip'=\"Close\", lc) \n ) # end BoxRow\n ), # end \+ BoxColumn\n\n BoxColumn('inset'=0, 'inset'=0, 'spacing'=0, bc, \+ \n\n BoxRow('border'='true', 'caption'=\"Messages\", \n \+ 'inset'=0, 'spacing'=0, bc, \n BoxCell(\n \+ TextBox['info']('editable'='false',\n 'value'= \"\", lc, \n 'tooltip'=\"Messages\", \n \+ 'height'=4, 'width'=24 \n ) # end TextBox\n ) # end BoxCell\n ), # end BoxRow \n\n BoxRo w('border'='true', 'caption'=\"Hints\", \n 'inset'=0, \+ 'spacing'=10, bc, \n BoxCell(Button['B_getHint'](\"Obtain \+ a Hint\", \n 'onclick'=Evaluate('function'='getHint( )'), \n 'tooltip'=\"Receive a hint\", lc)),\n \+ BoxCell(Button['B_applyHint'](\"Apply the Hint\", \n \+ 'onclick'=Evaluate('function'='applyHint()'), \n \+ 'tooltip'=\"Apply the hint\", lc))\n ), # end BoxRow\n\n \+ BoxColumn('border'='true', 'inset'=0, 'spacing'=0,\n \+ 'caption'=\"Limit Rules\", bc, \n BoxRow('halign '='left', 'inset'=0, 'spacing'=4, bc,\n BoxCell('halign'= 'left',\n Button['B_constant'](\" Constant \", lc, \n \+ Evaluate('function'='applyRule(constant)'), \n \+ 'tooltip'=\"Apply constant rule: L(c)=c\")\n ) , # BoxCell\n BoxCell('halign'='left',\n B utton['B_constantmultiple'](\" Constant Multiple \", lc, \n \+ Evaluate('function'='applyRule(constantmultiple)'), \n \+ 'tooltip'=\"Apply constant multiple rule: L(c*f(x)) = c*L(f( x))\")\n ) # BoxCell\n ), # BoxRow\n\n \+ BoxRow('halign'='left', 'inset'=0, 'spacing'=2, bc, \n \+ BoxCell('halign'='left',\n Button['B_identity'](\"Ide ntity\", lc, \n Evaluate('function'='applyRule(ident ity)'), \n 'tooltip'=\"Apply identity rule:L(x) = a\" )\n ), # BoxCell\n BoxCell('halign'='left', \n Button['B_sum'](\"Sum\", lc, \n Eva luate('function'='applyRule(sum)'), \n 'tooltip'=\"Ap ply sum rule: L(f(x)+g(x)) = L(f(x)) + L(g(x))\")\n ), # \+ BoxCell\n BoxCell('halign'='left',\n Butto n['B_difference'](\"Difference\", lc, \n Evaluate('fu nction'='applyRule(difference)'), \n 'tooltip'=\"Appl y difference rule: L(f(x)-g(x)) = L(f(x)) - L(g(x))\")\n \+ ) # BoxCell\n ), # BoxRow\n\n BoxRow('halign'='l eft', 'inset'=0, 'spacing'=1, bc,\n BoxCell('halign'='lef t',\n Button['B_product'](\"Product\", lc, \n \+ Evaluate('function'='applyRule(product)'), \n \+ 'tooltip'=\"Apply product rule: L(f(x)*g(x)) = L(f(x)) * L(g(x))\")\n ), # BoxCell\n BoxCell('halign'='left', \n \+ Button['B_quotient'](\"Quotient\", lc, \n \+ Evaluate('function'='applyRule(quotient)'), \n 't ooltip'=\"Apply quotient rule: L(f(x)/g(x)) = L(f(x)) / L(g(x))\")\n \+ ), # end BoxCell\n BoxCell('halign'='left',\n Button['B_power'](\"Power\", lc, \n E valuate('function'='applyRule(power)'), \n 'tooltip'= \"Apply power rule: L(f(x)^g(x)) = L(f(x)) ^ L(g(x))\")\n \+ ) # BoxCell\n ) # end BoxRow\n ), # end BoxColumn \n\n BoxColumn('border'='true', 'inset'=0, 'spacing'=0,\n \+ 'caption'=\"Function Rules\", bc, \n BoxR ow('halign'='left', 'inset'=0, 'spacing'=0, bc, \n Label ('caption'=\"Enter a Function: \", bc),\n TextField['TF_ mathfunc']('width'=7, lc)\n ), # end BoxRow\n \+ BoxRow('halign'='left', 'inset'=0, 'spacing'=5, bc, \n B utton['B_applyMathFunc'](\"Apply\",\n 'onclick'='A_mat hfunc', lc,\n 'tooltip'=\"Apply the math function\"), \n Button['B_selectMathfunc'](\"Select a Function\", \n \+ 'onclick'=RunWindow('mathfuncWin'), lc, \n \+ 'tooltip'=\"Select a math function\" )\n ) # end BoxRow \n ), # end BoxColumn\n\n BoxColumn('border'='true', 'inset'=0, 'spacing'=0,\n 'caption'=\"Rules with \+ Arguments\", bc, \n BoxCell(\n TextBox['TB_arg s'](\n 'value'=\"\", lc,\n 'tooltip'=\"A rguments for the rule\", \n 'height'=2, 'width'=16 \n \+ ) # end TextBox\n ), # end BoxCell\n\n \+ BoxRow('halign'='left', 'inset'=0, 'spacing'=0, bc, \n \+ BoxCell('halign'='left',\n Button['B_lhopital'](\"L'H opital's\", lc, \n 'onclick'=Evaluate('function'='app lyRuleWithArgs(lhopital)'), \n 'tooltip'=\"Apply l'Ho pital's rule: Enter the numerator\")\n ), # BoxCell\n \+ BoxCell('halign'='left',\n Button['B_rewrite' ](\" Rewrite\", lc, \n 'onclick'=Evaluate('function'= 'applyRuleWithArgs(rewrite)'), \n 'tooltip'=\"Change \+ the form of the limit expression: Enter the substitution equations\") \n ), # BoxCell\n BoxCell('halign'='left',\n Button['B_change'](\" Change \", lc, \n \+ 'onclick'=Evaluate('function'='applyRuleWithArgs(change)'), \n \+ 'tooltip'=\"Change the variable of the limit: Enter the r elationship equation between the current and new variables\")\n \+ ) # BoxCell\n ) # BoxRow\n\n ) # end BoxCol umn \n\n ) # end BoxColumn \n ) # end BoxRow\n\n \+ ) # end BoxColumn\n ), # end Window\n\n############################# ###############################\n\n Window['mathfuncWin']('resizable' ='false',\n 'title'=\"Select a Mathematical Function\",\n 'defau ltbutton'='B_close2',\n BoxColumn(bc, \n\n BoxRow('border'='tr ue', 'inset'=1, 'spacing'=5, bc, \n 'caption'=\"Exponential and Logarithmic Functions\", \n Button['B_exp'](\"Natural Exponent ial\", lc,\n 'onclick'=Action(\n SetOption('TF_ma thfunc'=\"exp\"),\n CloseWindow('mathfuncWin'), \n \+ Evaluate('function'='applyRule(exp)')) \n ), # end Button \+ exp\n Button['B_ln'](\"Natural Logarithm\", lc,\n 'onc lick'=Action(\n SetOption('TF_mathfunc'=\"ln\"),\n \+ CloseWindow('mathfuncWin'), \n Evaluate('function'='a pplyRule(ln)')) \n ) # end Button ln\n ), # end BoxRow\n\n GridLayout('border'='true', 'inset'=1, bc, \n 'caption'= \"Trigonometric, Hyperbolic Functions, and their Inverses\",\n\n \+ GridRow(\n GridCell(Button['B_sin'](\" sin \", lc,\n \+ 'onclick'=Action(\n SetOption('TF_mathfunc'=\" sin\"),\n CloseWindow('mathfuncWin'), \n E valuate('function'='applyRule(sin)') ) \n )), # end Button/Gr idCell\n GridCell(Button['B_cos'](\" cos \", lc,\n \+ 'onclick'=Action(\n SetOption('TF_mathfunc'=\"cos\" ),\n CloseWindow('mathfuncWin'), \n Evaluate ('function'='applyRule(cos)')) \n )), # end Button/GridCell\n GridCell(Button['B_tan'](\" tan \", lc,\n 'o nclick'=Action(\n SetOption('TF_mathfunc'=\"tan\"),\n \+ CloseWindow('mathfuncWin'), \n Evaluate('fun ction'='applyRule(tan)') ) \n )), # end Button/GridCell\n \+ GridCell(Button['B_cot'](\" cot \", lc,\n 'oncl ick'=Action(\n SetOption('TF_mathfunc'=\"cot\"),\n \+ CloseWindow('mathfuncWin'), \n Evaluate('functi on'='applyRule(cot)') ) \n )), # end Button/GridCell\n \+ GridCell(Button['B_sec'](\" sec \", lc,\n 'onclick' =Action(\n SetOption('TF_mathfunc'=\"sec\"),\n \+ CloseWindow('mathfuncWin'), \n Evaluate('function'= 'applyRule(sec)') ) \n )), # end Button/GridCell\n G ridCell(Button['B_csc'](\" csc \", lc,\n 'onclick'=Act ion(\n SetOption('TF_mathfunc'=\"csc\"),\n \+ CloseWindow('mathfuncWin'), \n Evaluate('function'='app lyRule(csc)') ) \n )) # end Button/GridCell\n ), # end GridRow\n \n GridRow(\n GridCell(Button['B_arcsin '](\" arcsin \", lc,\n 'onclick'=Action(\n Se tOption('TF_mathfunc'=\"arcsin\"),\n CloseWindow('mathfu ncWin'), \n Evaluate('function'='applyRule(arcsin)') ) \+ \n )), # end Button/GridCell\n GridCell(Button['B_ar ccos'](\" arccos \", lc,\n 'onclick'=Action(\n \+ SetOption('TF_mathfunc'=\"arccos\"),\n CloseWindow('ma thfuncWin'), \n Evaluate('function'='applyRule(arccos)') ) \n )), # end Button/GridCell\n GridCell(Button['B _arctan'](\" arctan \", lc,\n 'onclick'=Action(\n \+ SetOption('TF_mathfunc'=\"arctan\"),\n CloseWindow( 'mathfuncWin'), \n Evaluate('function'='applyRule(arctan )') ) \n )), # end Button/GridCell\n GridCell(Button ['B_arccot'](\" arccot \", lc,\n 'onclick'=Action(\n \+ SetOption('TF_mathfunc'=\"arccot\"),\n CloseWind ow('mathfuncWin'), \n Evaluate('function'='applyRule(arc cot)') ) \n )), # end Button/GridCell\n GridCell(But ton['B_arcsec'](\" arcsec \", lc,\n 'onclick'=Action(\n \+ SetOption('TF_mathfunc'=\"arcsec\"),\n CloseW indow('mathfuncWin'), \n Evaluate('function'='applyRule( arcsec)') ) \n )), # end Button/GridCell\n GridCell( Button['B_arccsc'](\" arccsc \", lc,\n 'onclick'=Action(\n \+ SetOption('TF_mathfunc'=\"arccsc\"),\n Clo seWindow('mathfuncWin'), \n Evaluate('function'='applyRu le(arccsc)') ) \n )) # end Button/GridCell\n ), # end \+ GridRow\n \n GridRow(\n GridCell(Button['B_sinh'](\" sinh \", lc,\n 'onclick'=Action(\n SetOpt ion('TF_mathfunc'=\"sinh\"),\n CloseWindow('mathfuncWin' ), \n Evaluate('function'='applyRule(sinh)') ) \n \+ )), # end Button/GridCell\n GridCell(Button['B_cosh'](\" \+ cosh \", lc,\n 'onclick'=Action(\n SetOptio n('TF_mathfunc'=\"cosh\"),\n CloseWindow('mathfuncWin'), \n Evaluate('function'='applyRule(cosh)') ) \n \+ )), # end Button/GridCell\n GridCell(Button['B_tanh'](\" ta nh \", lc,\n 'onclick'=Action(\n SetOption( 'TF_mathfunc'=\"tanh\"),\n CloseWindow('mathfuncWin'), \+ \n Evaluate('function'='applyRule(tanh)') ) \n \+ )), # end Button/GridCell\n GridCell(Button['B_coth'](\" cot h \", lc,\n 'onclick'=Action(\n SetOption(' TF_mathfunc'=\"coth\"),\n CloseWindow('mathfuncWin'), \n Evaluate('function'='applyRule(coth)') ) \n )) , # end Button/GridCell\n GridCell(Button['B_sech'](\" sech \+ \", lc,\n 'onclick'=Action(\n SetOption('TF _mathfunc'=\"sech\"),\n CloseWindow('mathfuncWin'), \n \+ Evaluate('function'='applyRule(sech)') ) \n )), \+ # end Button/GridCell\n GridCell(Button['B_csch'](\" csch \+ \", lc,\n 'onclick'=Action(\n SetOption('TF_m athfunc'=\"csch\"),\n CloseWindow('mathfuncWin'), \n \+ Evaluate('function'='applyRule(csch)') ) \n )) # e nd Button/GridCell\n ), # end GridRow\n\n GridRow(\n \+ GridCell(Button['B_arcsinh'](\"arcsinh\", lc,\n 'oncl ick'=Action(\n SetOption('TF_mathfunc'=\"arcsinh\"),\n \+ CloseWindow('mathfuncWin'), \n Evaluate('fu nction'='applyRule(arcsinh)') ) \n )), # end Button/GridCell \n GridCell(Button['B_arccosh'](\"arccosh\", lc,\n \+ 'onclick'=Action(\n SetOption('TF_mathfunc'=\"arccosh\" ),\n CloseWindow('mathfuncWin'), \n Evalua te('function'='applyRule(arccosh)') ) \n )), # end Button/Gri dCell\n GridCell(Button['B_arctanh'](\"arctanh\", lc,\n \+ 'onclick'=Action(\n SetOption('TF_mathfunc'=\"arct anh\"),\n CloseWindow('mathfuncWin'), \n E valuate('function'='applyRule(arctanh)') ) \n )), # end Butto n/GridCell\n GridCell(Button['B_arccoth'](\"arccoth\", lc,\n \+ 'onclick'=Action(\n SetOption('TF_mathfunc'= \"arccoth\"),\n CloseWindow('mathfuncWin'), \n \+ Evaluate('function'='applyRule(arccoth)') ) \n )), # end Button/GridCell\n GridCell(Button['B_arcsech'](\"arcsech\", \+ lc,\n 'onclick'=Action(\n SetOption('TF_mathf unc'=\"arcsech\"),\n CloseWindow('mathfuncWin'), \n \+ Evaluate('function'='applyRule(arcsech)') ) \n )), \+ # end Button/GridCell\n GridCell(Button['B_arccsch'](\"arccsc h\", lc,\n 'onclick'=Action(\n SetOption('TF_ mathfunc'=\"arccsch\"),\n CloseWindow('mathfuncWin'), \n Evaluate('function'='applyRule(arccsch)') ) \n \+ )) # end Button/GridCell\n ) # end GridRow\n\n ), # end G ridLayout\n\n BoxRow('border'='true', 'inset'=1, 'spacing'=5, bc, \n 'caption'=\"Other Maple Mathematical Functions\", \n \+ Label('caption'=\"Enter a Maple mathematical function: \", bc),\n \+ TextField['TF_other'](15, lc),\n Button['B_other'](\"Apply \",'onclick'='A_other', lc)\n ), # end BoxRow\n\n BoxRow( Bu tton['B_close2'](\"Close\",CloseWindow('mathfuncWin'), lc), bc )\n\n \+ ) # end BoxColumn\n ), # end Window\n \n########################### #################################\n\n Window['cmdWin']('defaultbutton '='closeCmdWin',\n 'title'=\"Descriptions of l'Hopital's, Rewrite, \+ and Change Rules\",\n 'resizable'='false',\n BoxColumn('inset'=0 , 'spacing'=0, bc, \n BoxColumn('inset'=0, 'spacing'=3, bc, \n \+ BoxCell(\n TextBox['TB_cmd']('height'=12, 'width'=40, lc , \n 'editable'='false', \n 'value'=\"Click the button below to see the corresponding description.\"\n ) # e nd TextBox\n ) # end BoxCell\n ), # end BoxColumn \n \+ BoxRow('inset'=10, 'spacing'=0, bc,\n Button['closeCmdWin'](\" Close\", CloseWindow('cmdWin'), lc) \n ) # end BoxRow\n ) # en d BoxColumn \n ), # end Window\n\n################################### #########################\n\n Window['ruleWin'](\n 'title'=\"Limit Rule\", 'resizable'='false',\n BoxColumn('inset'=0, 'spacing'=10, \+ bc, \n BoxRow('inset'=0, 'spacing'=0, bc, \n MathMLViewe r['ML_rule']('width'=375, lc) \n ), # end BoxRow\n BoxRow('i nset'=0, 'spacing'=0, bc, \n Button(\"Close\",CloseWindow('rule Win'), lc)\n ) # end BoxRow\n ) # end BoxColumn\n ), # end ru leWin\n\n############################################################ \n\n Window['helpWin']( 'resizable'='false',\n 'title'=\"Using the Step-by-Step Limit Problem Solver Maplet\",\n BoxColumn('border'=' true', 'inset'=0, 'spacing'=8, bc,\n BoxCell(\n TextBox('h eight'=24, 'width'=40, lc,\n 'editable'='false', 'font'='F1', 'foreground'=\"#333399\",\n 'value'=helpStr\n ) # end TextBox\n ), # end BoxCell\n BoxRow('inset'=0, 'spacing'=0, bc,\n Button(\"Close\", lc, \n CloseWindow('helpWin' ))\n ) # end BoxRow\n ) # end BoxColumn\n ), # end helpWin\n \n############################################################\n\n Me nuBar['limMB'](\n\n Menu(\"File\",\n MenuItem(\"Start to Solve \", \n 'onclick'=Evaluate('function'='startRule()')),\n Me nuItem(\"Final Answer\", \n 'onclick'=Evaluate('function'='getF inalAnswer()')),\n MenuItem(\"Show All Steps\", \n 'onclic k'=Evaluate('function'='showAllSteps()')),\n MenuSeparator(),\n \+ MenuItem(\"Obtain a Hint\", \n 'onclick'=Evaluate('function '='getHint()')),\n MenuItem(\"Apply the Hint\", \n 'onclic k'=Evaluate('function'='applyHint()')),\n MenuSeparator(),\n \+ MenuItem(\"Clear\", \n 'onclick'=Evaluate('function'='clearSte ps()')),\n MenuSeparator(),\n MenuItem(\"Close\", Shutdown() )\n ), # end Menu/File\n \n Menu(\"Rule Definition\",\n M enuItem(\"Constant Rule\", 'onclick'='A_i_constant'),\n MenuItem( \"Constant Multiple Rule\", 'onclick'='A_i_constantmultiple'),\n \+ MenuSeparator(),\n MenuItem(\"Identity Rule\", 'onclick'='A_i_ide ntity'),\n MenuItem(\"Power Rule\", 'onclick'='A_i_power'),\n \+ MenuSeparator(),\n MenuItem(\"Sum Rule\", 'onclick'='A_i_sum'), \n MenuItem(\"Difference Rule\", 'onclick'='A_i_difference'),\n \+ MenuSeparator(),\n MenuItem(\"Product Rule\", 'onclick'='A_i_ product'),\n MenuItem(\"Quotient Rule\", 'onclick'='A_i_quotient' ),\n MenuSeparator(),\n MenuItem(\"Natural Exponential\", 'o nclick'='A_i_exp'),\n MenuItem(\"Natural Logarithm\",'onclick'='A _i_ln'),\n MenuSeparator(),\n Menu(\"Trigonometric Functions \",\n MenuItem(\"sin\",'onclick'='A_i_sin'),\n MenuItem( \"cos\",'onclick'='A_i_cos'),\n MenuItem(\"tan\",'onclick'='A_i _tan'),\n MenuItem(\"cot\",'onclick'='A_i_cot'),\n MenuI tem(\"sec\",'onclick'='A_i_sec'),\n MenuItem(\"csc\",'onclick'= 'A_i_csc')\n ), # end Menu/Trig\n Menu(\"Inverse Trigonometr ic Functions\",\n MenuItem(\"arcsin\",'onclick'='A_i_arcsin'), \n MenuItem(\"arccos\",'onclick'='A_i_arccos'),\n MenuIt em(\"arctan\",'onclick'='A_i_arctan'),\n MenuItem(\"arccot\",'o nclick'='A_i_arccot'),\n MenuItem(\"arcsec\",'onclick'='A_i_arc sec'),\n MenuItem(\"arccsc\",'onclick'='A_i_arccsc')\n ), \+ # end Menu/Inverse Trig\n Menu(\"Hyperbolic Functions\",\n \+ MenuItem(\"sinh\",'onclick'='A_i_sinh'),\n MenuItem(\"cosh\",' onclick'='A_i_cosh'),\n MenuItem(\"tanh\",'onclick'='A_i_tanh') ,\n MenuItem(\"coth\",'onclick'='A_i_coth'),\n MenuItem( \"sech\",'onclick'='A_i_sech'),\n MenuItem(\"csch\",'onclick'=' A_i_csch')\n ), # end Menu/Hyperbolic \n Menu(\"Inverse Hype rbolic Functions\",\n MenuItem(\"arcsinh\",'onclick'='A_i_arcsi nh'),\n MenuItem(\"arccosh\",'onclick'='A_i_arccosh'),\n \+ MenuItem(\"arctanh\",'onclick'='A_i_arctanh'),\n MenuItem(\"ar ccoth\",'onclick'='A_i_arccoth'),\n MenuItem(\"arcsech\",'oncli ck'='A_i_arcsech'),\n MenuItem(\"arccsch\",'onclick'='A_i_arccs ch')\n ), # end Menu/Inverse hyperbolic\n MenuSeparator(),\n Menu(\"Rules with Arguments\", \n MenuItem(\"L'Hopital's \",\n 'onclick'='A_i_lhopitals'), \n MenuItem(\"Rewr ite\",\n 'onclick'='A_i_rewrite'),\n MenuItem(\"Change \",\n 'onclick'='A_i_change')\n ) # end Menu/Rules with Arguments\n\n ), # end Menu/Rule Definition\n \n\n\n\n Menu(\"Ap ply the Rule\",\n MenuItem(\"Constant Rule\", \n 'onclick' =Evaluate('function'='applyRule(constant)')),\n MenuItem(\"Consta nt Multiple Rule\", \n 'onclick'=Evaluate('function'='applyRule (constantmultiple)')),\n MenuSeparator(),\n MenuItem(\"Ident ity Rule\", \n 'onclick'=Evaluate('function'='applyRule(identit y)')),\n MenuItem(\"Power Rule\", \n 'onclick'=Evaluate('f unction'='applyRule(power)')),\n MenuSeparator(),\n MenuItem (\"Sum Rule\", \n 'onclick'=Evaluate('function'='applyRule(sum) ')),\n MenuItem(\"Difference Rule\", \n 'onclick'=Evaluate ('function'='applyRule(difference)')),\n MenuSeparator(),\n \+ MenuItem(\"Product Rule\", \n 'onclick'=Evaluate('function'='ap plyRule(product)')),\n MenuItem(\"Quotient Rule\", \n 'onc lick'=Evaluate('function'='applyRule(quotient)')),\n MenuSeparato r(),\n MenuItem(\"Natural Exponential\",\n 'onclick'=Evalu ate('function'='applyRule(exp)')),\n MenuItem(\"Natural Logorithm \", \n 'onclick'=Evaluate('function'='applyRule(ln)')),\n \+ MenuSeparator(),\n Menu(\"Trigonometric Functions\",\n Men uItem(\"sin\",\n 'onclick'=Evaluate('function'='applyRule(sin )')),\n MenuItem(\"cos\",\n 'onclick'=Evaluate('functi on'='applyRule(cos)')),\n MenuItem(\"tan\",\n 'onclick '=Evaluate('function'='applyRule(tan)')),\n MenuItem(\"cot\",\n 'onclick'=Evaluate('function'='applyRule(cot)')),\n M enuItem(\"sec\",\n 'onclick'=Evaluate('function'='applyRule(s ec)')),\n MenuItem(\"csc\",\n 'onclick'=Evaluate('func tion'='applyRule(csc)'))\n ), # end Menu/Trig\n Menu(\"Inver se Trigonometric Functions\",\n MenuItem(\"arcsin\",\n \+ 'onclick'=Evaluate('function'='applyRule(arcsin)')),\n MenuIte m(\"arccos\",\n 'onclick'=Evaluate('function'='applyRule(arcc os)')),\n MenuItem(\"arctan\",\n 'onclick'=Evaluate('f unction'='applyRule(arctan)')),\n MenuItem(\"arccot\",\n \+ 'onclick'=Evaluate('function'='applyRule(arccot)')),\n MenuI tem(\"arcsec\",\n 'onclick'=Evaluate('function'='applyRule(ar csec)')),\n MenuItem(\"arccsc\",\n 'onclick'=Evaluate( 'function'='applyRule(arccsc)'))\n ), # end Menu/Inverse Trig\n \+ Menu(\"Hyperbolic Functions\",\n MenuItem(\"sinh\",\n \+ 'onclick'=Evaluate('function'='applyRule(sinh)')),\n MenuIt em(\"cosh\",\n 'onclick'=Evaluate('function'='applyRule(cosh) ')),\n MenuItem(\"tanh\",\n 'onclick'=Evaluate('functi on'='applyRule(tanh)')),\n MenuItem(\"coth\",\n 'oncli ck'=Evaluate('function'='applyRule(coth)')),\n MenuItem(\"sech \",\n 'onclick'=Evaluate('function'='applyRule(sech)')),\n \+ MenuItem(\"csch\",\n 'onclick'=Evaluate('function'='appl yRule(csch)'))\n ), # end Menu/Hyperbolic \n Menu(\"Inverse \+ Hyperbolic Functions\",\n MenuItem(\"arcsinh\",\n 'onc lick'=Evaluate('function'='applyRule(arcsinh)')),\n MenuItem(\" arccosh\",\n 'onclick'=Evaluate('function'='applyRule(arccosh )')),\n MenuItem(\"arctanh\",\n 'onclick'=Evaluate('fu nction'='applyRule(arctanh)')),\n MenuItem(\"arccoth\",\n \+ 'onclick'=Evaluate('function'='applyRule(arccoth)')),\n Men uItem(\"arcsech\",\n 'onclick'=Evaluate('function'='applyRule (arcsech)')),\n MenuItem(\"arccsch\",\n 'onclick'=Eval uate('function'='applyRule(arccsch)'))\n ) # end Menu/Inverse hyp erbolic\n ), # end Menu/Apply Rules\n\n Menu(\"Understood Rules \",\n CheckBoxMenuItem['CMI_constant'](\"Constant Rule\", \n \+ 'onclick'=Evaluate('function'='changeUnderstoodRules(constant,CMI_c onstant)') ),\n CheckBoxMenuItem['CMI_constantmultiple'](\"Consta nt Multiple Rule\",\n 'onclick'=Evaluate('function'= \n 'changeUnderstoodRules(constantmultiple,CMI_constantmultiple)' ) ),\n MenuSeparator(),\n\n CheckBoxMenuItem['CMI_identity'] (\"Identity Rule\", \n 'onclick'=Evaluate('function'='changeUnd erstoodRules(identity,CMI_identity)') ),\n CheckBoxMenuItem['CMI_ power'](\"Power Rule\", \n 'onclick'=Evaluate('function'='chan geUnderstoodRules(power,CMI_power)') ),\n MenuSeparator(),\n\n \+ CheckBoxMenuItem['CMI_sum'](\"Sum Rule\", \n 'onclick'=Evalu ate('function'='changeUnderstoodRules(sum,CMI_sum)') ),\n CheckBo xMenuItem['CMI_difference'](\"Difference Rule\", \n 'onclick'=E valuate('function'='changeUnderstoodRules(difference,CMI_sum)') ),\n \+ MenuSeparator(), \n\n CheckBoxMenuItem['CMI_product'](\"Produ ct Rule\", \n 'onclick'=Evaluate('function'='changeUnderstoodRu les(product,CMI_product)') ),\n CheckBoxMenuItem['CMI_quotient']( \"Quotient Rule\", \n 'onclick'=Evaluate('function'='changeUnde rstoodRules(quotient,CMI_quotient)') ),\n MenuSeparator(),\n\n \+ CheckBoxMenuItem['CMI_exp'](\"Natural Exponential\", \n 'on click'=Evaluate('function'='changeUnderstoodRules(exp,CMI_exp)') ),\n \+ CheckBoxMenuItem['CMI_ln'](\"Natural Logarithm\", \n 'oncl ick'=Evaluate('function'='changeUnderstoodRules(ln,CMI_ln)') ),\n \+ MenuSeparator(),\n\n Menu(\"Trigonometric Functions\",\n \+ CheckBoxMenuItem['CMI_sin'](\"sin\", \n 'onclick'=Evaluate('f unction'='changeUnderstoodRules(sin,CMI_sin)') ),\n CheckBoxMen uItem['CMI_cos'](\"cos\", \n 'onclick'=Evaluate('function'='c hangeUnderstoodRules(cos,CMI_cos)')),\n CheckBoxMenuItem['CMI_t an'](\"tan\", \n 'onclick'=Evaluate('function'='changeUnderst oodRules(tan,CMI_tan)') ),\n CheckBoxMenuItem['CMI_cot'](\"cot \", \n 'onclick'=Evaluate('function'='changeUnderstoodRules(c ot,CMI_cot)') ),\n CheckBoxMenuItem['CMI_sec'](\"sec\", \n \+ 'onclick'=Evaluate('function'='changeUnderstoodRules(sec,CMI_sec) ') ),\n CheckBoxMenuItem['CMI_csc'](\"csc\", \n 'oncli ck'=Evaluate('function'='changeUnderstoodRules(csc,CMI_csc)') )\n \+ ), # end Menu/Trig\n\n Menu(\"Inverse Trigonometric Functions\", \n CheckBoxMenuItem['CMI_arcsin'](\"arcsin\", \n 'oncl ick'=Evaluate('function'='changeUnderstoodRules(arcsin,CMI_arcsin)') ) ,\n CheckBoxMenuItem['CMI_arccos'](\"arccos\", \n 'onc lick'=Evaluate('function'='changeUnderstoodRules(arccos,CMI_arccos)') \+ ),\n CheckBoxMenuItem['CMI_arctan'](\"arctan\", \n 'on click'=Evaluate('function'='changeUnderstoodRules(arctan,CMI_arctan)') ),\n CheckBoxMenuItem['CMI_arccot'](\"arccot\", \n 'o nclick'=Evaluate('function'='changeUnderstoodRules(arccot,CMI_arccot)' ) ),\n CheckBoxMenuItem['CMI_arcsec'](\"arcsec\", \n ' onclick'=Evaluate('function'='changeUnderstoodRules(arcsec,CMI_arcsec) ') ),\n CheckBoxMenuItem['CMI_arccsc'](\"arccsc\", \n \+ 'onclick'=Evaluate('function'='changeUnderstoodRules(arccsc,CMI_arccsc )') )\n ), # end Menu/Inverse Trig\n\n Menu(\"Hyperbolic Fun ctions\",\n CheckBoxMenuItem['CMI_sinh'](\"sinh\", \n \+ 'onclick'=Evaluate('function'='changeUnderstoodRules(sinh,CMI_sinh)') \+ ),\n CheckBoxMenuItem['CMI_cosh'](\"cosh\", \n 'onclic k'=Evaluate('function'='changeUnderstoodRules(cosh,CMI_cosh)') ),\n \+ CheckBoxMenuItem['CMI_tanh'](\"tanh\", \n 'onclick'=Eval uate('function'='changeUnderstoodRules(tanh,CMI_tanh)') ),\n Ch eckBoxMenuItem['CMI_coth'](\"coth\", \n 'onclick'=Evaluate('f unction'='changeUnderstoodRules(coth,CMI_coth)') ),\n CheckBoxM enuItem['CMI_sech'](\"sech\", \n 'onclick'=Evaluate('function '='changeUnderstoodRules(sech,CMI_sech)') ),\n CheckBoxMenuItem ['CMI_csch'](\"csch\", \n 'onclick'=Evaluate('function'='chan geUnderstoodRules(csch,CMI_csch)') )\n ), # end Menu/Hyperbolic \+ \n\n Menu(\"Inverse Hyperbolic Functions\",\n CheckBoxMenu Item['CMI_arcsinh'](\"arcsinh\", \n 'onclick'=Evaluate('funct ion'='changeUnderstoodRules(arcsinh,CMI_arcsinh)') ),\n CheckBo xMenuItem['CMI_arccosh'](\"arccosh\", \n 'onclick'=Evaluate(' function'='changeUnderstoodRules(arccosh,CMI_arccosh)') ),\n Ch eckBoxMenuItem['CMI_arctanh'](\"arctanh\", \n 'onclick'=Evalu ate('function'='changeUnderstoodRules(arctanh,CMI_arctanh)') ),\n \+ CheckBoxMenuItem['CMI_arccoth'](\"arccoth\", \n 'onclick'= Evaluate('function'='changeUnderstoodRules(arccoth,CMI_arccoth)') ),\n CheckBoxMenuItem['CMI_arcsech'](\"arcsech\", \n 'oncl ick'=Evaluate('function'='changeUnderstoodRules(arccoth,CMI_arccoth)') ),\n CheckBoxMenuItem['CMI_arccsch'](\"arccsch\", \n \+ 'onclick'=Evaluate('function'='changeUnderstoodRules(arccoth,CMI_arcco th)') )\n ) # end Menu/Inverse hyperbolic\n \n ), # end Menu/ Understood Rules\n \n Menu(\"Help\",\n MenuItem(\"Using this M aplet\", 'onclick'=RunWindow('helpWin'))\n ) # end Menu/Help\n\n ) , # end MenuBar\n\n################################################### #########\n\n Action['A_other'](\n SetOption('target'='TF_mathfunc ',Argument('TF_other')),\n CloseWindow('mathfuncWin'), \n Evalua te('function'='applyOtherRule()') \n ), # end A_other\n\n Action['A _mathfunc'](\n Evaluate('function'='applyMathFuncRule()') \n ), # end A_mathfunc\n\n################################################### #########\n\n Action['A_i_constant'](\n Evaluate('function'='about Rule(constant, c)'),\n RunWindow('ruleWin')\n ), # end A_i_constan t\n \n Action['A_i_constantmultiple'](\n Evaluate('function'='abou tRule(constantmultiple, c*f(x))'),\n RunWindow('ruleWin')\n ), # e nd A_i_constantmultiple\n \n Action['A_i_sum'](\n Evaluate('funct ion'='aboutRule(sum,f(x)+g(x))'),\n RunWindow('ruleWin') \n ), # \+ end A_i_sum\n\n Action['A_i_difference'](\n Evaluate('function'='a boutRule(difference,f(x)-g(x))'),\n RunWindow('ruleWin') \n ), # \+ end A_i_difference\n \n Action['A_i_identity'](\n Evaluate('funct ion'='aboutRule(identity,x)'),\n RunWindow('ruleWin')\n ), # end A _i_identity\n \n Action['A_i_power'](\n Evaluate('function'='abou tRule(power,x^n)'),\n RunWindow('ruleWin')\n ), # end A_i_power\n \n Action['A_i_product'](\n Evaluate('function'='aboutRule(product ,f(x)*g(x))'),\n RunWindow('ruleWin')\n ), # end A_i_product\n\n \+ Action['A_i_quotient'](\n Evaluate('function'='aboutRule(quotient,f (x)/g(x))'),\n RunWindow('ruleWin')\n ), # end A_i_quotient\n\n A ction['A_i_exp'](\n Evaluate('function'='aboutRule(exp,exp(x))'),\n RunWindow('ruleWin')\n ), # end A_i_exp\n\n Action['A_i_ln'](\n \+ Evaluate('function'='aboutRule(ln,ln(x))'),\n RunWindow('ruleWin ')\n ), # end A_i_ln\n\n Action['A_i_sin'](\n Evaluate('function' ='aboutRule(sin,sin(x))'),\n RunWindow('ruleWin')\n ), # end A_i_s in\n\n Action['A_i_cos'](\n Evaluate('function'='aboutRule(cos,cos (x))'),\n RunWindow('ruleWin')\n ), # end A_cos\n\n Action['A_i_t an'](\n Evaluate('function'='aboutRule(tan,tan(x))'),\n RunWindo w('ruleWin')\n ), # end A_i_tan\n\n Action['A_i_cot'](\n Evaluate ('function'='aboutRule(cot,cot(x))'),\n RunWindow('ruleWin')\n ), \+ # end A_i_cot\n\n Action['A_i_sec'](\n Evaluate('function'='aboutR ule(sec,sec(x))'),\n RunWindow('ruleWin')\n ), # end A_i_sec\n\n \+ Action['A_i_csc'](\n Evaluate('function'='aboutRule(csc,csc(x))'), \n RunWindow('ruleWin')\n ), # end A_i_csc\n\n Action['A_i_arcsin '](\n Evaluate('function'='aboutRule(arcsin,arcsin(x))'),\n RunW indow('ruleWin')\n ), # end A_i_arcsin\n\n Action['A_i_arccos'](\n \+ Evaluate('function'='aboutRule(arccos,arccos(x))'),\n RunWindow(' ruleWin')\n ), # end A_i_cos\n\n Action['A_i_arctan'](\n Evaluate ('function'='aboutRule(arctan,arctan(x))'),\n RunWindow('ruleWin') \n ), # end A_i_arctan\n\n Action['A_i_arccot'](\n Evaluate('func tion'='aboutRule(arccot,arccot(x))'),\n RunWindow('ruleWin')\n ), \+ # end A_i_arccot\n\n Action['A_i_arcsec'](\n Evaluate('function'=' aboutRule(arcsec,arcsec(x))'),\n RunWindow('ruleWin')\n ), # end A _i_arcsec\n\n Action['A_i_arccsc'](\n Evaluate('function'='aboutRu le(arccsc,arccsc(x))'),\n RunWindow('ruleWin')\n ), # end A_i_arcc sc\n\n Action['A_i_sinh'](\n Evaluate('function'='aboutRule(sinh,s inh(x))'),\n RunWindow('ruleWin')\n ), # end A_i_sinh\n\n Action[ 'A_i_cosh'](\n Evaluate('function'='aboutRule(cosh,cosh(x))'),\n \+ RunWindow('ruleWin')\n ), # end A_i_cosh\n\n Action['A_i_tanh'](\n \+ Evaluate('function'='aboutRule(tanh,tanh(x))'),\n RunWindow('rul eWin')\n ), # end A_i_tanh\n\n Action['A_i_coth'](\n Evaluate('fu nction'='aboutRule(coth,coth(x))'),\n RunWindow('ruleWin')\n ), # \+ end A_i_coth\n\n Action['A_i_sech'](\n Evaluate('function'='aboutR ule(sech,sech(x))'),\n RunWindow('ruleWin')\n ), # end A_i_sech\n \n Action['A_i_csch'](\n Evaluate('function'='aboutRule(csch,csch( x))'),\n RunWindow('ruleWin')\n ), # end A_i_csch\n\n Action['A_i _arcsinh'](\n Evaluate('function'='aboutRule(arcsinh,arcsinh(x))'), \n RunWindow('ruleWin')\n ), # end A_i_arcsinh\n\n Action['A_i_ar ccosh'](\n Evaluate('function'='aboutRule(arccosh,arccosh(x))'),\n \+ RunWindow('ruleWin')\n ), # end A_i_cosh\n\n Action['A_i_arctanh' ](\n Evaluate('function'='aboutRule(arctanh,arctanh(x))'),\n Run Window('ruleWin')\n ), # end A_i_arctanh\n\n Action['A_i_arccoth']( \n Evaluate('function'='aboutRule(arccoth,arccoth(x))'),\n RunWi ndow('ruleWin')\n ), # end A_i_arccoth\n\n Action['A_i_arcsech'](\n \+ Evaluate('function'='aboutRule(arcsech,arcsech(x))'),\n RunWindo w('ruleWin')\n ), # end A_i_arcsech\n\n Action['A_i_arccsch'](\n \+ Evaluate('function'='aboutRule(arccsch,arccsch(x))'),\n RunWindow(' ruleWin')\n ), # end A_i_arccsch\n\n Action[A_i_lhopitals](\n Run Window(cmdWin),\n SetOption('cmdWin(title)'=\"L'Hopital's rule\"), \n SetOption('TB_cmd'=lhopitalStr)\n ), # end A_i_lhopitals\n\n \+ Action[A_i_rewrite](\n RunWindow(cmdWin),\n SetOption('cmdWin(ti tle)'=\"Rewrite rule\"),\n SetOption('TB_cmd'=rewriteStr)\n ), # \+ end A_i_rewrite\n\n Action[A_i_change](\n RunWindow(cmdWin),\n \+ SetOption('cmdWin(title)'=\"Change rule\"),\n SetOption('TB_cmd'=ch angeStr)\n ), # end A_i_change\n\n################################## ##########################\n\n Action['A']()\n\n): # end maplet\n\nU nderstand(Limit,none) :\nMaplets[Display](maplet) :\n\nend use: # end \+ use\nend proc: # end runLimMaplet\n\n################################# ###########################\n\n####################################### #####################\n\nend module: # end LimMaplet()\nLimMaplet:-run LimMaplet();" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 27 "Limit Check (small example)" }}{EXCHG {PARA 0 "" 0 "" {TEXT 264 36 "Click in red area and press [Enter]." } {TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 2734 "# Douglas Meade\n #limit_eval := proc( F, PT, TYPE )\n# if TYPE[2] then\n# return li mit( F, PT, left )\n# elif TYPE[3] then\n# return limit( F, PT, ri ght )\n# else\n# return limit( F, PT )\n# end if;\n#end proc:\n\n limit_eval := proc( F, PT, DIR )\n if member(DIR,\{`left`,`right`\}) \+ then\n return limit( F, PT, DIR )\n else\n return limit( F, PT \+ )\n end if;\nend proc:\n\nguess_check := proc( L, GUESS )\n `if`( L= GUESS, green, red )\nend proc:\n\nuse Maplets, Maplets:-Elements in\n \nLimitCheck:= Maplet(\n Window(\n 'title' = \"Limit Evalua tor\",\n [ # col\n [ # row\n [ # col\n [ # row\n \"lim \"\n ],\n [ # row\n \+ TextField['x'](width=3, onchange=SetOption('L'=\"\")),\n \+ \" -> \",\n TextField['c'](width=3, onchange=SetOption('L'= \"\"))\n ],\n [ # row\n \"Direction: \"\n \+ ],\n [ # row\n DropDownBox['dir']('value'= \"two-sided\",[\"two-sided\",\"left\",\"right\"])\n ]\n \+ ],\n [ # col\n [ # row\n TextField['f']( onchange=SetOption('L'=\"\")),\n \"=\",\n TextFiel d['L'](editable=false)\n ],\n [ # row\n \" \"\n ]\n ]\n ],\n# [ # row\n# \+ \"Type of limit: \",\n# RadioButton['two'](\"2-sided\", 'value '=true, 'group'='BG1'),\n# RadioButton['oneL'](\"left\", 'v alue'=false, 'group'='BG1'),\n# RadioButton['oneR'](\"right\", 'value'=false, 'group'='BG1')\n# ],\n# [ # row\n# \+ \"Expected value of the limit \",\n# TextField['guess']('f oreground'=black)\n# ],\n [ # row\n Button(\"Eva luate limit\",\n 'onclick' = 'evaluate'\n \+ ),\n Button(\"Clear all fields\",\n 'onclick ' = 'clear'\n ),\n Button(\"Close\",\n \+ Shutdown()\n )\n ]\n ] ),\n Act ion['clear'](\n SetOption( 'x' = \"\" ),\n Set Option( 'c' = \"\" ),\n SetOption( 'f' = \"\" ),\n \+ SetOption( 'L' = \"\" ),\n SetOption( 'dir' = \"two-s ided\" ),\n# SetOption( 'two' = true ),\n# Set Option( 'oneL' = false ),\n# SetOption( 'oneR' = false ), \n# SetOption( 'guess' = \"\" ),\n# SetOption( 'guess'('foreground') = black )\n NULL\n \+ ),\n Action['evaluate'](\n# Evaluate( 'L' = 'l imit_eval( f, x=c, [two,oneL,oneR] )' )#,\n Evaluate( 'L' \+ = 'limit_eval( f, x=c, dir )' )#,\n# Evaluate( 'guess(fore ground)' = 'guess_check( L, guess )' )\n ),\n \+ ButtonGroup['BG1']()\n ):\nend use:\nMaplets:-Display(Limit Check);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 17 "Area Maximization" }}{EXCHG {PARA 0 "" 0 "" {TEXT 265 36 "Click in red area and press [Enter]." }{TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 9816 "# Area Maximization Maplet\n# C opyright 2002 Waterloo Maple Inc.\n# \n# The Area Maximization maplet \+ is designed to give the user an intuitive understanding of optimizatio n problems. It provides an interactive demonstration of the following problem typically studied in calculus.\n# \n# Given a parabola with r eal roots, find the rectangle between the parabola and the x-axis that has maximal area.\n# \n# The user enters the expression for a parabol a in the uppermost text area. The user experiments with the value of \+ the width of the box by entering values in the text region to try to a pproach the optimum by trial and error. \n# \n# When the user clicks \+ the Optimize button, the optimal solution is displayed both numericall y and graphically.\n# \n# To run this maplet, click the Execute (!!!) \+ button in the context bar.\n# \nrestart; \nAreaMaximiztionMaplet:= mo dule()\n############################################################\n \nexport parabArea, parabRoots, parabInitialDraw, parabDraw,parabOptWi dth,runAreaMaximization:\nlocal helpStr:\n\n########################## ##################################\nhelpStr:=\n\"The Area Maximization maplet is designed to give you an intuitive understanding of optimiza tion problems. It provides an interactive demonstration of the follow ing problem typically studied in calculus.\n\nGiven a parabola with re al roots, find the rectangle between the parabola and the x-axis that \+ has maximal area.\n\nEnter the expression for a parabola in the upperm ost text area. Experiment with the value of the width of the box by e ntering values in the text region to try to approach the optimum by tr ial and error. To display the optimal solution both numerically and g raphically, click the 'Optimize' button.\":\n\n\n##################### #######################################\n#computes the area of a recta ngle of width width embedded between a parabola f and \n#the x-axis\n \n parabArea := proc(fun, width)\n local cent, f, wid;\n \n \+ f:=parse(fun):\n f:=unapply(f,x):\n wid:=parse(width):\n if t ype(wid, constant) and Im(wid)=0 and evalf(wid)>=0 then \n cen t:=solve(diff(f(x),x)=0,x);\n evalf(abs(wid*f(cent+wid/2.0)), 4); \n else error \"Width must be a real, non-negative constant\";\n \+ end if;\n end proc:\n\n############################################# ###############\n#computes the roots of parabola f and returns them in ascending order\n\n parabRoots := proc(f)\n local Roots;\n if \+ type(f(x),quadratic) then \n Roots:=solve(f(x)=0,x);\n if I m(Roots[1])=0 and \n Im(Roots[2])=0 \n then\n \+ [min(Roots), max(Roots)];\n else error \"The parabola must \+ intersect the x-axis\";\n end if;\n else error \"Entered funct ion must be quadratic\";\n end if;\n end proc:\n\n################ ############################################\n#draws parabola \n\n p arabInitialDraw := proc(fun)\n local Roots ,f;\n f:=parse(fun): \n f:=unapply(f,x):\n Roots:=parabRoots(f);\n plot(f, Roots[1 ]-1..Roots[2]+1, thickness=3);\n end proc: \n\n###################### ######################################\n#draws parabola f along with t he embedded rectangle of width width\n\n parabDraw := proc(fun, wid) \n local cent, d, rec1, graph, Roots,width,f;\n\n f:=parse(fun): \n f:=unapply(f,x):\n width:=parse(wid):\n if type(width, con stant) and Im(width)=0 and evalf(width)>=0 then\n Roots:=parabRoo ts(f);\n if evalf(width) <= evalf(abs(Roots[2]-Roots[1])) then \n cent := (Roots[1]+Roots[2])/2.0;\n d := width/2.0;\n \+ rec1 := plottools[rectangle]([cent-d, 0],[cent+d, f(cent+d)], col or=green, thickness=2);\n graph := plot(f, Roots[1]-1..Roots[2] +1, thickness=3):\n plots[display](rec1, graph);\n else er ror \"This box does not fit between the parabola and the x-axis\"\n \+ end if;\n else error \"Width must be real and non-negative\";\n \+ end if;\n end proc:\n\n########################################### #################\n#computes the width of a box embedded between parab ola f and the x-axis having\n#maximal area\n\n parabOptWidth := proc( fun)\n local Roots, wCrits, wOpt, areaOpt, cent,f;\n \n f:=pa rse(fun):\n f:=unapply(f,x):\n Roots:=parabRoots(f);\n cent:= solve( diff(f(x),x)=0, x);\n areaOpt := wOpt*f(cent+wOpt/2);\n w Crits := solve( diff(areaOpt,wOpt)=0, wOpt );\n max(wCrits[1], wCri ts[2]);\n end proc: \n\n############################################ ################\nrunAreaMaximization :=proc()\nlocal maplet:\nuse Map lets:-Elements in\nmaplet := Maplet( 'onstartup'=RunWindow('mainWin'), \n\nFont['F2']('family'=\"Default\", 'bold'='true', 'size'=14),\n\n M enuBar['MB'](\n\n Menu(\"File\", \n MenuItem(\"Optimize\", 'on click'=A3),\n MenuSeparator(),\n MenuItem(\"Close\", 'onclic k'=Shutdown())\n ), # end Menu/File\n\n Menu(\"Help\", \n M enuItem(\"Using this Maplet\", 'onclick'=RunWindow('helpWin'))\n ) \+ # end menu/Help\n\n ), # end MenuBar \n\n\n Window['mainWin' ]('menubar'='MB',\n title=\"Calculus 1 - Area Maximization\" ,\n\n BoxRow \n ('background'=\"#DDFFFF\",\n\n \+ BoxColumn\n ('background'=\"#DDFFFF\", \n\n \+ BoxRow('background'=\"#DDFFFF\", 'caption'=\"Enter a parabol a\",\n border='true', \n TextFie ld[F](\"9-x^2\", 'background'=\"#EEFFFF\") \n ), # \+ end BoxRow\n\n BoxRow('background'=\"#DDFFFF\", 'border' ='true', 'caption'=\"Plot Window\",\n Plotter[PL1]('ba ckground'=\"#EEFFFF\")\n ) # end BoxRow\n\n \+ ), # end BoxColumn\n\n BoxColumn('background'=\"#DDF FFF\",\n\n BoxColumn('background'=\"#DDFFFF\", caption =\"Experimentation\", border=true,\n\n BoxRow('backg round'=\"#DDFFFF\",\n BoxCell( halign='left', \"Gu ess the width of the biggest box \" ), \n BoxCell( halign='left', TextField[W](3, 'value'=\" \",'background'=\"#EEFFFF\" ) ),\n BoxCell(), \n BoxCell(B utton(\"Plot Box\", onclick='A2', 'background'=\"#CCFFFF\")) \n \+ ), # end BoxRow\n\n BoxRow('back ground'=\"#DDFFFF\",\n BoxCell( halign='left', \" Area of this box \" ), \n BoxCell( halign='left', TextField[AREA1](value=0, not editable, 10, \n \+ 'background'=\"#EEFFFF\") ) \n ) # end BoxR ow\n ), # end BoxColumn\n\n BoxColumn ('background'=\"#DDFFFF\", caption=\"Optimization\", border=true,\n\n \+ BoxRow('background'=\"#DDFFFF\",\n \+ BoxCell(halign='left', \"Width of the biggest box \" ),\n \+ BoxCell( halign='center', \n M athMLViewer[WIDTH](height=50, width=150, 'background'=\"#EEFFFF\" ))\n ), # end BoxRow\n \+ \n BoxRow('background'=\"#DDF FFF\",\n BoxCell( halign='left', \"Area of the bi ggest box \" ),\n BoxCell( halign='left', TextFie ld[AREA2](value=0, not editable, 10, \n \+ 'background'=\"#EEFFFF\" ))\n ), # end BoxRow\n\n \+ BoxRow('background'=\"#DDFFFF\",\n \+ BoxCell( halign='left', Button( \"Optimize\", onclick=A3, \+ 'background'=\"#CCFFFF\") )\n \+ ) # end BoxRow\n\n ), # end BoxColumn \+ \n\n BoxRow('background'=\"#DDFFFF\", 'spacing'=1 0, 'inset'=10,\n Button(\"Plot Parabola\", 'backgrou nd'=\"#CCFFFF\", 'onclick'=A1 ),\n Button(\"Close\", 'background'=\"#CCFFFF\", Shutdown() )\n ) # end BoxR ow\n\n ) # end BoxColumn\n )\n ) \n ,\n\n Window['helpWin']( 'resizable'='false',\n 'title' =\"Using the Area Maximization Maplet\",\n BoxColumn('border'='true ', 'inset'=0, 'spacing'=5,\n 'background'=\"#CCFFFF\",\n Box Cell(\n TextBox('height'=13, 'width'=42,\n 'background '=\"#DDFFFF\", 'foreground'=\"#333399\", 'font'='F2',\n 'edit able'='false',\n 'value'=helpStr\n ) # end TextBox\n \+ ), # end BoxCell\n BoxRow('inset'=0, 'spacing'=0, 'background '=\"#CCFFFF\",\n Button(\"Close\", 'background'=\"#CCFFFF\", \n CloseWindow('helpWin'))\n ) # end BoxRow\n ) # end B oxColumn\n ), # end helpWin\n\n Action['A1']\n ( Evaluate \n ( 'waitforresult'='false','target'='PL1','function' = 'para bInitialDraw',\n Argument('F',quotedtext='true')\n ) \n ),\n \n Action['A2']\n ( Evaluate\n ( 'wai tforresult'='false','target'='AREA1',\n 'function'='parabAre a',\n Argument('F',quotedtext='true'),\n Argument( 'W',quotedtext='true')\n ),\n Evaluate\n ( 'wa itforresult'='false','target'='PL1', \n 'function'='parabDra w',\n Argument('F',quotedtext='true'),\n Argument( 'W',quotedtext='true')\n )\n ),\n \n Action['A3']\n ( Evaluate\n ( 'target'='TF1','function' = 'parabOptWid th',\n Argument('F',quotedtext='true')\n ),\n \+ Evaluate\n ( 'target'='WIDTH','function' = 'MathML:-Export(T F1)' \n ),\n Evaluate\n ( 'target'='AREA2' ,'f unction'= 'parabArea',\n Argument('F',quotedtext='true'),\n \+ Argument('TF1',quotedtext='true')\n ), \n \+ Evaluate\n ( 'target'='PL1' ,'function'= 'parabDraw',\n \+ Argument('F',quotedtext='true'),\n Argument('TF1',quoted text='true')\n ) \n ),\n TextField[ 'TF1'](1)\n \n\n): # end Maplet\n\nMaplets:-Display(maplet):\n \nend use:\nend proc:\n\nend module: # end Maplet\nAreaMaximiztionMapl et:-runAreaMaximization();" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 14 "Curve Analysis" }} {EXCHG {PARA 0 "" 0 "" {TEXT 266 36 "Click in red area and press [Ente r]." }{TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 22797 "# Curve An alysis Maplet\n# Copyright 2002 Waterloo Maple Inc.\n# \n# The Curve A nalysis maplet allows the user to analyze the graph of a function usin g first and second derivatives. \n# \n# The user enters a function. \+ The maplet displays the intervals over which the function is increasin g, decreasing, concave or convex, or the local maximum and minimum poi nts. \n# \n# Additionally, the user can view a plot of all intervals \+ and points.\n# \n# To run this maplet, click the Execute (!!!) button \+ in the context bar.\n# \nDigits:=5:\nCurveAnalysisMaplet := module()\n \nexport DisplayOptions, PlotOptions, showFunc, showConUp, showConDown , showInc, showDec, showMax, showMin, Calc1Maplet, showConUp1, showCon Down1, showInc1, showDec1, showMax1, showMin1, DisplayMax, DisplayMin, DisplayConcaveUp, DisplayConcaveDown, DisplayInc, DisplayDec, showAll , showTangent, findRoots, maplet; \n\nlocal helpStr;\n\n############## ##############################################\n\nhelpStr := \n\"The C urve Analysis maplet allows you to analyze the graph of a function usi ng first and second derivatives.\n \nEnter a continuous function and i ts domain. To display the function, select Show the Function and clic k the 'Show' button. \n\nTo display the maximum and minimum points of this function, select Show the Local Maxima or Show the Local Minima \+ and click the 'Show' button. \n\nTo display the intervals over which \+ the function is increasing or decreasing, select Show the Increasing I ntervals or Show the Decreasing Intervals and click the 'Show' button. \n\nTo display the intervals over which the function is concave or co nvex, select Show the Concave Up Intervals or Show the Concave Down In tervals and click the 'Show' button. \n\nTo view a plot of all interva ls and points, click the 'Plot All' button.\":\n\n#################### ########################################\n\nDisplayOptions:= proc()\n \nif Maplets:-Tools:-Get('TBh2'(value)) then \n DisplayMax(Maplets:- Tools:-Get(F::algebraic), \n Maplets:-Tools:-Get(NEGX::al gebraic), \n Maplets:-Tools:-Get(POSX::algebraic));\n\nel if Maplets:-Tools:-Get('TBh3'(value)) then \n DisplayMin(Maplets:-To ols:-Get(F::algebraic), \n Maplets:-Tools:-Get(NEGX::alge braic), \n Maplets:-Tools:-Get(POSX::algebraic));\n\nelif Maplets:-Tools:-Get('TBh4'(value)) then \n DisplayInc(Maplets:-Too ls:-Get(F::algebraic), \n Maplets:-Tools:-Get(NEGX::algeb raic), \n Maplets:-Tools:-Get(POSX::algebraic));\n\nelif \+ Maplets:-Tools:-Get('TBh5'(value)) then \n DisplayDec(Maplets:-Tools :-Get(F::algebraic), \n Maplets:-Tools:-Get(NEGX::algebra ic), \n Maplets:-Tools:-Get(POSX::algebraic));\n\nelif Ma plets:-Tools:-Get('TBh6'(value)) then \n DisplayConcaveUp(Maplets:-T ools:-Get(F::algebraic), \n Maplets:-Tools:-Get(NEG X::algebraic), \n Maplets:-Tools:-Get(POSX::algebra ic));\n\nelif Maplets:-Tools:-Get('TBh7'(value)) then \n DisplayConc aveDown(Maplets:-Tools:-Get(F::algebraic), \n Map lets:-Tools:-Get(NEGX::algebraic), \n Maplets:-To ols:-Get(POSX::algebraic));\n\nend if;\nend proc: \n\n################ ############################################\n\nPlotOptions:= proc()\n \nif Maplets:-Tools:-Get('TBh1'(value)) then\n showFunc(Maplets:-To ols:-Get(F::algebraic), \n Maplets:-Tools:-Get(NEGX::algeb raic), \n Maplets:-Tools:-Get(POSX::algebraic));\n\nelif M aplets:-Tools:-Get('TBh2'(value)) then \n showMax1(Maplets:-Tools:- Get(F::algebraic), \n Maplets:-Tools:-Get(NEGX::algebraic) , \n Maplets:-Tools:-Get(POSX::algebraic));\n\nelif Maplet s:-Tools:-Get('TBh3'(value)) then \n showMin1(Maplets:-Tools:-Get(F ::algebraic), \n Maplets:-Tools:-Get(NEGX::algebraic), \n \+ Maplets:-Tools:-Get(POSX::algebraic));\n\nelif Maplets:-To ols:-Get('TBh4'(value)) then \n showInc1(Maplets:-Tools:-Get(F::alg ebraic), \n Maplets:-Tools:-Get(NEGX::algebraic), \n \+ Maplets:-Tools:-Get(POSX::algebraic));\n\nelif Maplets:-Tools:-Ge t('TBh5'(value)) then \n showDec1(Maplets:-Tools:-Get(F::algebraic), \n Maplets:-Tools:-Get(NEGX::algebraic), \n Map lets:-Tools:-Get(POSX::algebraic));\n\nelif Maplets:-Tools:-Get('TBh6' (value)) then\n showConUp1(Maplets:-Tools:-Get(F::algebraic), \n \+ Maplets:-Tools:-Get(NEGX::algebraic), \n Maplet s:-Tools:-Get(POSX::algebraic));\n\nelif Maplets:-Tools:-Get('TBh7'(va lue)) then \n showConDown1(Maplets:-Tools:-Get(F::algebraic), \n \+ Maplets:-Tools:-Get(NEGX::algebraic), \n Ma plets:-Tools:-Get(POSX::algebraic));\n\nend if;\nend proc: \n \n### #########################################################\nuse Maplets :-Elements in\n\nmaplet := Maplet('onstartup'=RunWindow('mainWin'),\n \n############################################################\n\n Fon t['F1']('family'=\"Default\", 'bold'='false', 'size'=12),\n Font['F2'] ('family'=\"Default\", 'bold'='true', 'size'=14),\n\n################# ###########################################\n\n MenuBar[MB1](\n \+ Menu(\"File\",\n MenuItem(\"Show\", 'onclick'=' A1'), \n MenuSeparator(),\n MenuItem(\"P lot All\", 'onclick'='A3'),\n MenuItem(\"Clear\", 'oncl ick'='A4'),\n MenuSeparator(),\n MenuIte m(\"Close\", Shutdown())\n ), # end menu/File\n \+ \n Menu(\"Help\", \n MenuItem(\"Us ing this Maplet\", 'onclick'=RunWindow('helpWin'))\n \+ ) # end menu/Help\n ), # end MenuBar \n\n###################### ######################################\n\n Window[mainWin](title=\"Ca lculus 1 - Curve Analysis\", height=450, width=700, menubar=MB1, 'layo ut' = BL1,\n\n BoxLayout[BL1](inset=0, 'background'=\"#DDFFFF\", \+ \n \n BoxColumn(inset=0, spacing=0, 'background'=\"#DDFFFF\", \n'caption'=\"Plot Window\", 'border'=true,\n Plotter[P1]('backgr ound'=\"#EEFFFF\")\n ), # end BoxColumn for Plotter\n\n BoxColumn (inset=0, spacing=0, 'background'=\"#DDFFFF\", \n\n BoxRow(i nset=0, 'caption'=\"Enter a continuous function and its domain\", \n \+ 'border'='true', spacing=0, 'background'=\"#DDFFFF\",\n \+ \n Label(\"Function \", 'font' = 'F1'),\n TextField [F](\"cos(x)*x\", 'width'=15, 'background'=\"#EEFFFF\"),\n Labe l(\" x = \", 'font' = 'F1'),\n BoxCell(TextField[NEGX](width=2, \"-10\", 'background'=\"#EEFFFF\")),\n Label(\" to \", 'font' = 'F1'),\n BoxCell(TextField[POSX](width=2,\"10\", 'background'= \"#EEFFFF\"))\n \n ), # end BoxRow\n\n BoxRow('inset'=0 , 'spacing'=0, 'background'=\"#DDFFFF\",\n BoxColumn('inset'=0 , 'spacing'=0, 'background'=\"#DDFFFF\",\n \n \+ RadioButton['TBh1'](\"Show the Function\", 'background'=\"#DDFFFF\" ,'group'='BG1', 'value'='true'), # end RadioButton\n Radi oButton['TBh2'](\"Show the Local Maxima\", 'background'=\"#DDFFFF\",'g roup'='BG1'\n ), # end RadioButton\n RadioBu tton['TBh3'](\"Show the Local Minima\", 'background'=\"#DDFFFF\",'grou p'='BG1'\n ) # end RadioButton \n\n ), # end BoxColumn \n\n BoxColumn('inset'=0, 'spacing'=0, 'background'=\"#DDFFFF \",\n\n RadioButton['TBh4'](\"Show the Increasing Interva ls\", 'background'=\"#DDFFFF\", 'group'='BG1'), \n # e nd RadioButton \n RadioButton['TBh5'](\"Show the Decreasi ng Intervals\", 'background'=\"#DDFFFF\", 'group'='BG1'),\n \+ # end RadioButton\n RadioButton['TBh6'](\"Show the \+ Concave Up Intervals\", 'background'=\"#DDFFFF\",'group'='BG1'), \n \+ # end RadioButton \n RadioButton['TBh7'](\" Show the Concave Down Intervals\", 'background'=\"#DDFFFF\",'group'='B G1') \n # end RadioButton\n\n ) # end BoxColumn \n ), # end BoxRow\n\n BoxRow('background'=\"#DDFFFF\", \n\n \+ Button(\"Show\", 'onclick'='A1', 'background'=\"#EEFFFF\", \n \+ 'font' = 'F1'\n ) # end Show button\n \+ ), # end BoxRow \n \n BoxRow('caption'=\"Points and I ntervals\", border=true, inset=0, spacing=0, 'background'=\"#DDFFFF\", \n MathMLViewer['T1']( 'background'=\"#EEFFFF\")\n \+ ), # end BoxRow\n\n BoxRow('background'=\"#DDFFFF\",\n\n \+ Button[all](\"Plot All\", 'onclick'='A3', 'font' = 'F1',\n \+ 'background'=\"#EEFFFF\"), # end Plot All button\n\n \+ Button[clear](\"Clear\", 'onclick'='A4', 'font' = 'F1',\n \+ 'background'=\"#EEFFFF\"), # end Clear button\n\n \+ Button[close](\"Close\", Shutdown(), 'font' = 'F1',\n \+ 'background'=\"#EEFFFF\") # end Close button \n ) # en d BoxRow\n ) # end BoxColumn\n) # end BoxLayout\n), # end Window \+ \n\n############################################################\n\n \+ Window['helpWin']( 'resizable'='false',\n 'title'=\"Using the Curve Analysis Maplet\",\n BoxColumn('border'=true, 'background'=\"#DDFF FF\", 'inset'=0, 'spacing'=4,\n\n BoxRow('inset'=0, 'spacing'=0, \+ 'background'=\"#DDFFFF\", \n\n TextBox('height'=22, 'width'=36, 'background'=\"#DDFFFF\", 'font'='F2',\n 'editable'='false', 'value'=helpStr, 'foreground'=\"#333399\"\n ) # end TextBox\n \n ), # end BoxRow\n\n BoxRow('inset'=0, 'spacing'=0, 'backg round'=\"#DDFFFF\", \n Button(\"Close\", 'font'='F1', 'backgrou nd'=\"#CCFFFF\", CloseWindow('helpWin') )\n ) # end BoxRow\n\n \+ ) # end BoxColumn\n ), # end helpWin\n\n############################ ################################\n\nButtonGroup['BG1'](),\n\nAction['A 1'](Evaluate('T1'='DisplayOptions'), \n Evaluate('P1'='Plo tOptions')\n ), # end A1\n\nAction['A3'](Evaluate(P1='showAl l(F, NEGX, POSX)'), \n SetOption('T1'=\"\")\n ), # end A2\n\nAction['A4'](SetOption('F'=\"\"), \n SetOpti on('NEGX'=\"\"), \n SetOption('POSX'=\"\"), \n \+ SetOption('T1'=\"\"),\n Evaluate('P1' = plot(undefined, x = 0..10))\n ) # end A3\n):\n\nend use:\n################## ##########################################\n\n######################## ####################################\n\nshowFunc := proc(f, negX, posX ) option remember:\n plot(f, x=negX..posX, color=black, thickness=3): \nend proc:\n\nshowConUp1 := proc(f, negX, posX) option remember:\n p lots[display](showConUp(f, negX, posX), showFunc(f, negX, posX)):\nend proc:\n\nshowConDown1 := proc(f, negX, posX) option remember:\n plot s[display](showConDown(f, negX, posX), showFunc(f, negX, posX)):\nend \+ proc:\n\nshowInc1 := proc(f, negX, posX) option remember:\n plots[dis play](showInc(f, negX, posX), showFunc(f, negX, posX)):\nend proc:\n\n showDec1 := proc(f, negX, posX) option remember:\n plots[display](sho wDec(f, negX, posX), showFunc(f, negX, posX)):\nend proc:\n\nshowMax1 \+ := proc(f, negX, posX) option remember:\n plots[display](showMax(f, n egX, posX), showFunc(f, negX, posX)):\nend proc:\n\nshowMin1 := proc(f , negX, posX) option remember:\n plots[display](showMin(f, negX, posX ), showFunc(f, negX, posX)):\nend proc:\n\n########################### #################################\n\nshowConUp := proc(f, negX, posX) \+ option remember:\n local d2, sols, i, n, polys, j, delta, X1, X2, Y1, Y2, p:\n d2 := diff(f,x$2);\n sols := findRoots(d2, negX, posX);\n \+ \n if not member(evalf(negX), sols) then\n sols := [evalf(negX), \+ op(sort(sols))]:\n end if:\n \n if not member(evalf(posX), sols) th en\n sols := [op(sort(sols)), evalf(posX)]:\n end if:\n \n n := \+ 100: polys := []:\n \n for j from 1 to (nops(sols) - 1) do\n if e valf(subs(x = (sols[j] + sols[j+1])/2, d2)) > 0 then\n delta := ( sols[j+1] - sols[j]) / n:\n X2 := sols[j]:\n for i from 1 to n do\n X1 := evalf(X2): Y1 := evalf(subs(x = X1, f)):\n \+ X2 := evalf(sols[j] + i * delta): Y2 := evalf(subs(x=X2,f)):\n \+ p[i] := plots[polygonplot]([[X1, 0],[X1, Y1],[X2, Y2],[X2, 0]], color =plum, style=patchnogrid):\n end do:\n polys := [op(polys), \+ seq(p[i],i=1..n)]:\n end if:\n end do:\n if nops(polys) = 0 then \n return NULL:\n end if:\n plots[display](seq(polys[i],i=1..nops (polys))):\nend proc:\n\n############################################# ###############\n\nshowConDown := proc(f, negX, posX) option remember: \n local d2, sols, i, n, polys, j, delta, X1, X2, Y1, Y2, p:\n d2 := diff(f,x$2);\n sols := findRoots(d2, negX, posX);\n if not member(e valf(negX), sols) then\n sols := [evalf(negX), op(sort(sols))]:\n \+ end if:\n if not member(evalf(posX), sols) then\n sols := [op(sort (sols)), evalf(posX)]:\n end if:\n n := 100: polys := []:\n for j f rom 1 to (nops(sols) - 1) do\n if evalf(subs(x = (sols[j] + sols[j+ 1])/2, d2)) < 0 then\n delta := (sols[j+1] - sols[j]) / n:\n \+ X2 := sols[j]:\n for i from 1 to n do\n X1 := evalf(X2): \+ Y1 := evalf(subs(x=X1,f)):\n X2 := evalf(sols[j] + i * delta): \+ Y2 := evalf(subs(x=X2,f)):\n p[i] := plots[polygonplot]([[X1, 0 ],[X1, Y1],[X2, Y2],[X2, 0]], color=pink, style=patchnogrid):\n e nd do:\n polys := [op(polys), seq(p[i],i=1..n)]:\n end if:\n \+ end do:\n if nops(polys) = 0 then\n return NULL:\n end if:\n plo ts[display](seq(polys[i],i=1..nops(polys))):\nend proc:\n\n########### #################################################\n\nshowInc := proc(f , negX, posX) option remember:\n local d1, sols, i, lines, j:\n d1 : = diff(f,x);\n sols := findRoots(d1, negX, posX);\n if not member(ev alf(negX), sols) then\n sols := [evalf(negX), op(sort(sols))]:\n e nd if:\n if not member(evalf(posX), sols) then\n sols := [op(sort( sols)), evalf(posX)]:\n end if:\n lines := []:\n for j from 1 to (n ops(sols) - 1) do\n if evalf(subs(x=(sols[j]+sols[j+1])/2,d1)) > 0 \+ then\n lines := [op(lines), plot(f, x=sols[j]..sols[j+1], color=b lue, thickness=3)]:\n end if:\n end do:\n if nops(lines) = 0 then \n return NULL:\n end if:\n plots[display](seq(lines[i],i=1..nops (lines))):\nend proc:\n\n############################################# ###############\n\nshowDec := proc(f, negX, posX) option remember:\n \+ local d1, sols, i, lines, j:\n d1 := diff(f,x);\n sols := findRoots( d1, negX, posX);\n if not member(evalf(negX), sols) then\n sols := [evalf(negX), op(sort(sols))]:\n end if:\n if not member(evalf(posX ), sols) then\n sols := [op(sort(sols)), evalf(posX)]:\n end if:\n lines := []:\n for j from 1 to (nops(sols) - 1) do\n if evalf(su bs(x=(sols[j] + sols[j+1])/2,d1)) < 0 then\n lines := [op(lines), plot(f, x=sols[j]..sols[j+1], color=red, thickness=3)]:\n end if: \n end do:\n if nops(lines) = 0 then\n return NULL:\n end if:\n \+ plots[display](seq(lines[i],i=1..nops(lines))):\nend proc:\n\n####### #####################################################\n\nshowMax := pr oc(f, negX, posX) option remember:\n local d1, d2, sols, i, p:\n d1 \+ := diff(f,x);\n d2 := diff(f,x$2);\n sols := DisplayMax(f, negX, pos X);\n p := []:\n for i from 1 to nops(sols) do\n if evalf(subs(x= sols[i][1],d2)) < 0 then\n p := [op(p), plottools[line]([sols[i][ 1],0],[sols[i][1],subs(x=sols[i][1], f)], color=blue, thickness=3)]:\n end if:\n end do:\n if nops(p) = 0 then\n return NULL:\n end if:\n plots[display](seq(p[i],i=1..nops(p))):\nend proc:\n\n######## ####################################################\n\nshowMin := pro c(f, negX, posX) option remember:\n local d1, d2, sols, i, p:\n d1 : = diff(f,x);\n d2 := diff(f,x$2);\n sols := DisplayMin(f, negX, posX );\n p := []:\n for i from 1 to nops(sols) do\n if evalf(subs(x=s ols[i][1],d2)) > 0 then\n p := [op(p), plottools[line]([sols[i][1 ],0],[sols[i][1],subs(x=sols[i][1], f)],color=red,thickness=3)]:\n \+ end if:\n end do:\n if nops(p) = 0 then\n return NULL:\n end if: \n plots[display](seq(p[i],i=1..nops(p))):\nend proc:\n\n############ ################################################\n\nDisplayMax:=proc(f , negX, posX)\nlocal Max, CritPoints, i, Diffunc;\nMax:=[]:\nCritPoint s:=Student:-Calculus1:-CriticalPoints(f, x=negX..posX):\nDiffunc:=diff (f, x):\nif CritPoints = [] then\n CritPoints:=Student:-Calculus1:-Cr iticalPoints(f, numeric, x=negX..posX):\nend if;\nif CritPoints <> [] \+ then\nfor i from 1 to nops(CritPoints) do\n if i<>nops(CritPoints) a nd evalf(subs(x=(CritPoints[i+1]+CritPoints[i])/2, Diffunc))<0 then\n \+ Max:=[op(Max), [CritPoints[i], value(subs(x=CritPoints[i], f))]] ;\n elif i=nops(CritPoints) and evalf(subs(x=((posX+CritPoints[nops( CritPoints)])/2), Diffunc))<0 then\n Max:=[op(Max), [CritPoints[ i], value(subs(x=CritPoints[i], f))]];\nend if;\nend do;\nend if;\nMax ;\nend proc:\n\n###################################################### ######\n\nDisplayMin:=proc(f, negX, posX)\nlocal Min, CritPoints, i, D iffunc;\nMin:=[]:\nCritPoints:=Student:-Calculus1:-CriticalPoints(f, x =negX..posX):\nDiffunc:=diff(f, x):\nif CritPoints = [] then\n CritPo ints:=Student:-Calculus1:-CriticalPoints(f, numeric, x=negX..posX):\ne nd if;\nif CritPoints <> [] then\nfor i from 1 to nops(CritPoints) do \n if i<>nops(CritPoints) and evalf(subs(x=(CritPoints[i+1]+CritPoin ts[i])/2, Diffunc))>0 then\n Min:=[op(Min), [CritPoints[i], valu e(subs(x=CritPoints[i], f))]];\n elif i=nops(CritPoints) and evalf(s ubs(x=((posX+CritPoints[nops(CritPoints)])/2), Diffunc))>0 then\n \+ Min:=[op(Min), [CritPoints[i], value(subs(x=CritPoints[i], f))]];\ne nd if;\nend do;\nend if;\nMin;\nend proc:\n\n######################### ###################################\n\nDisplayInc:=proc(f, negX, posX) \nlocal Inc, Points, d1, i;\nInc:=[]:\nd1:=diff(f, x):\nPoints:=Studen t:-Calculus1:-CriticalPoints(f, x=negX..posX):\nif Points = [] then\n \+ Points:=Student:-Calculus1:-CriticalPoints(f, numeric, x=negX..posX) :\nend if; \nif Points <> [] then\n for i from 1 to nops(Points) do\n if i=1 and evalf(subs(x=((Points[i]+negX)/2), d1))>0 and negX <> Po ints[1] then \n Inc:=[op(Inc), [negX, Points[i]]]; \n elif e valf(subs(x=Points[i]+0.1, d1))>0 and i <> nops(Points) then\n I nc:=[op(Inc), [Points[i],Points[i+1]]];\n elif i=nops(Points) and ev alf(subs(x=((posX+Points[nops(Points)])/2), d1))>0 and Poi nts[i]<> posX then \n Inc:=[op(Inc), [Points[i], posX]];\nend if ;\nend do;\nend if; \nInc;\nend proc:\n\n############################# ###############################\n\nDisplayDec:=proc(f, negX, posX)\nlo cal Dec, Points, d1, i;\nDec:=[]:\nd1:=diff(f, x):\nPoints:=Student:-C alculus1:-CriticalPoints(f, x=negX..posX):\nif Points = [] then\n Po ints:=Student:-Calculus1:-CriticalPoints(f, numeric, x=negX..posX):\ne nd if; \nif Points <> [] then \n for i from 1 to nops(Points) do\n \+ if i=1 and evalf(subs(x=((Points[1]+negX)/2), d1))<0 and negX <> Point s[1] then \n Dec:=[op(Dec), [negX, Points[i]]]; \n elif eval f(subs(x=Points[i]+0.1, d1))<0 and i <> nops(Points) then\n Dec: =[op(Dec), [Points[i], Points[i+1]]];\n elif i=nops(Points) and eval f(subs(x=((posX+Points[nops(Points)])/2), d1))<0 and posX \+ <> Points[i] then\n Dec:=[op(Dec), [Points[i], posX]];\nend if ;\nend do;\nend if;\nDec; \nend proc:\n\n############################# ###############################\n\nDisplayConcaveUp:=proc(f, negX, pos X)\nlocal ConcaveUp, Points, d1, i;\nConcaveUp:=[]:\nd1:=diff(f, x$2): \nPoints:=Student:-Calculus1:-InflectionPoints(f, x=negX..posX):\nfor \+ i from 1 to nops(Points) do\n if i=1 and evalf(subs(x=((Points[1]+ne gX)/2), d1))>0 and negX <> Points[1] then \n if type(Points[i] , RootOf) then\n ConcaveUp:=[op(ConcaveUp), [negX, evalf(Poi nts[i])]];\n else \n ConcaveUp:=[op(ConcaveUp) , [negX, Points[i]]];\n end if; \n elif evalf(subs(x=Points[ i]+0.1, d1))>0 and i <> nops(Points) then\n if type(Points[i], \+ RootOf) then\n ConcaveUp:=[op(ConcaveUp), [evalf(Points[i]), evalf(Points[i+1])]];\n else\n ConcaveUp:=[op(Concav eUp), [Points[i], Points[i+1]]];\n end if; \n elif i=nops(Poi nts) and evalf(subs(x=((posX+Points[i])/2), d1))>0 and posX <> Points[ i] then\n if type(Points[i], RootOf) then\n ConcaveUp :=[op(ConcaveUp), [evalf(Points[i]), posX]];\n else\n \+ ConcaveUp:=[op(ConcaveUp), [Points[i], posX]];\n end if; \nen d if;\nend do;\nif nops(Points)=0 then\n Points:=Student:-Calcul us1:-CriticalPoints(f, x=negX..posX); \n if evalf(subs(x=((posX+Poi nts[1])/2), d1))>0 then\n ConcaveUp:=[negX, posX];\nend if;\nend if;\nConcaveUp; \nend proc:\n\n###################################### ######################\n\nDisplayConcaveDown:=proc(f, negX, posX)\nloc al ConcaveDown, Points, d1, i;\nConcaveDown:=[]:\nd1:=diff(f, x$2):\nP oints:=Student:-Calculus1:-InflectionPoints(f, x=negX..posX):\nfor i f rom 1 to nops(Points) do\n if i=1 and evalf(subs(x=((Points[1]+negX) /2), d1))<0 and negX <> Points[1] then \n if type(Points[i], Ro otOf) then\n ConcaveDown:=[op(ConcaveDown), [negX, evalf(Point s[i])]];\n else\n ConcaveDown:=[op(ConcaveDown), [negX, P oints[i]]]; \n end if;\n elif evalf(subs(x=Points[i]+0.1, d1) )<0 and i <> nops(Points) then\n if type(Points[i], RootOf) then \n ConcaveDown:=[op(ConcaveDown), [evalf(Points[i]), evalf(Poin ts[i+1])]];\n else\n ConcaveDown:=[op(ConcaveDown), [Poin ts[i], Points[i+1]]];\n end if; \n elif i=nops(Points) and eva lf(subs(x=((posX+Points[nops(Points)])/2), d1))<0 and posX \+ <> Points[i] then\n if type(Points[i], RootOf) then \n \+ ConcaveDown:=[op(ConcaveDown), [evalf(Points[i]), posX]];\n el se\n ConcaveDown:=[op(ConcaveDown), [Points[i], posX]];\n \+ end if;\nend if;\nend do;\nif nops(Points)=0 then\n Points:=Stu dent:-Calculus1:-CriticalPoints(f, x=negX..posX); \n if evalf(subs( x=((posX+Points[1])/2), d1))<0 then\n ConcaveDown:=[negX, posX]; \nend if;\nend if;\nConcaveDown;\nend proc:\n\n####################### #####################################\n\nshowTangent := proc(f, negX, \+ posX);\nplots[display](Student:-Calculus1:-MeanValueTheorem(f, x=negX. .posX, showfunction=false, showpoints=false, showline=false, title=` ` , tangentoptions=[thickness=3, color=green], tangentlength=0.5), showF unc(f, negX, posX));\nend proc:\n\n################################### #########################\n\nshowAll := proc(f, negX, posX) option rem ember:\n plots[display](showMin(f, negX, posX), showMax(f, negX, posX ), showConDown(f, negX, posX), showConUp(f, negX, posX), showDec(f, ne gX, posX), showInc(f, negX, posX)):\nend proc:\n\n#################### ########################################\n\nfindRoots := proc(f, negX, posX) option remember:\n local n, i, delta, li, X1, X2, sol, IN, j: \n n := 100:\n li := []:\n delta := (evalf(posX) - evalf(negX)) / n :\n X2 := evalf(negX):\n for i from 1 to n do\n X1 := evalf(X2): \+ X2 := evalf(negX + i * delta):\n sol := fsolve(f = 0, x=X1..X2):\n \+ if type(sol, numeric) then\n if not member(sol, li) then\n \+ li := [ op(li), sol]:\n end if:\n end if:\n end do:\n li ;\nend proc:\nMaplets:-Display(maplet);\nend module:\n################ ############################################\n#CurveAnalysisMaplet:-Ca lc1Maplet():\nMaplets:-Display(CurveAnalysisMaplet:-maplet):" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 " " {TEXT -1 15 "Derivative Plot" }}{EXCHG {PARA 0 "" 0 "" {TEXT 267 36 "Click in red area and press [Enter]." }{TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 11111 "# Derivative Plot Maplet\n# Copyright 2002 Wa terloo Maple Inc.\n# \n# The Derivative Plot maplet plots the derivati ves of a given function.\n# \n# The user enters a differentiable funct ion f(x) and a range on the x-axis [a,b]. If the user does not specify a range, -10..10 is used by default. The maplet plots the function an d all specified derivatives.\n# \n# To run this maplet, click the Exec ute (!!!) button in the context bar.\n# \nrestart;\nDerivativeMaplet : = module()\n\n######################################################## ####\n\nexport getDerivativePlot, runDerivativeMaplet:\nlocal helpStr, orderStr, colorStr:\n\n############################################## ##############\n\n\n################################################## ##########\n\nhelpStr := \n\"The Derivative Plot maplet plots the deri vatives of a given function.\n\nEnter a differentiable function f(x) a nd a range on the x-axis [a,b]. If you do not specify a range, -10..1 0 is used by default. To plot the function and all specified derivativ es, click the 'Plot' button.\":\n\n################################### #########################\n\n######################################### ###################\n\norderStr := \n\"The 'order' option specifies th e order of the derivatives to be plotted. You can use any of the foll owing forms: posint, posint1..posint2, \{posint1, posint2,..., posintk \}, or [posint1, posint2,..., posintk], where posint, posint1, posint2 ,..., posintk are positive integers.\n\nposint\nThe posintth derivativ e (where posint is a positive integer) of f(x) is plotted. By default , only the first derivative is plotted.\n\nposint1..posint2\nThe posin t1th through posint2th derivatives (where posint1 and posint2 are posi tive integers) of f(x) are plotted. For example, entering 1..4 plots \+ the first, second, third, and forth derivatives.\n\n[posint1, posint2, ..., posintk]\nor \{posint1, posint2,..., posintk\}\nThe posint1th, po sint2th,..., posintkth derivatives (where posint1, posint2,..., posint k are positive integers) are plotted. For example, entering [1, 2, 5] plots the first, second, and fifth derivatives.\":\n\n############### #############################################\n\n\n################### #########################################\n\ncolorStr := \n\"The color of the graph of the function is red by default.\n\nThe 'color' option specifies the colors of the derivatives to be plotted. You can use an y of the following forms: color, color1..color2, or [color1, color2,.. ., colork], where the predefined colors are aquamarine, black, blue, n avy, coral, cyan, brown, gold, green, gray, grey, khaki, magenta, maro on, orange, pink, plum, red, sienna, turquoise, violet, wheat, white, \+ and yellow.\n\ncolor\nThe derivatives to be plotted are the input colo r. \n\ncolor..color\nThe derivative plots are interpolated between co lor1 and color2. \n\n[color1, color2,..., colork]\nA list of colors m ust have at least as many colors as the number of derivatives specifie d. \n \nBy default, the color of a single derivative is blue, and blue ..green is the color spectrum for more than one derivative.\":\n\n#### ########################################################\n\n\n######## ####################################################\n\ngetDerivativeP lot := proc(boo1, boo2,P_fun, P_a, P_b, P_order, P_color,P_x1, P_x2 ,P _y1, P_y2)\n\n local temp, temp2, str, view:\n \n use Maplets:-Tools , StringTools in\n\n str:=Trim(P_fun):\n if str=\"\" then \n \+ return plots[textplot]([1,1,\"Enter a differentiable function\"]):\n end if:\n\n temp:=Trim(P_a):\n temp2:=Trim(P_b):\n if tem p<>\"\" and temp2<>\"\" then\n str:=cat(str, \", \", temp, \"..\" , temp2):\n end if:\n\n if not boo1 then str := cat(str, \", sho wfunction=false\") end if:\n if not boo2 then str := cat(str, \", s howderivative=false\") end if:\n if not(boo1 or boo2) then \n \+ return plots[textplot]( [1,1,\"Select function or derivatives\"]):\n \+ end if: \n\n\n temp:=Trim(P_order):\n temp2:=Trim(P_color):\n if temp<>\"\" then\n str := cat(str, \", order=\", temp):\n \+ end if:\n if temp2<>\"\" then\n str := cat(str, \", derivati vecolors=\", temp2):\n end if:\n\n view := [\"DEFAULT\",\"DEFAUL T\"]:\n\n temp:=Trim(P_x1):\n temp2:=Trim(P_x2):\n if temp<> \"\" and temp2<>\"\" then\n view[1]:=cat(temp, \"..\", temp2):\n \+ end if: \n\n temp:=Trim(P_y1):\n temp2:=Trim(P_y2):\n if t emp<>\"\" and temp2<>\"\" then\n view[2]:=cat(temp, \"..\", temp2 ):\n end if: \n\n temp:=cat(\", view=[\", view[1], \", \", view[ 2], \"]\"):\n str := cat(str, temp):\n\n Student:-Calculus1:-Der ivativePlot(parse(str),title=\" \"):\n\n end use: \n\nend proc:\n\n## ##########################################################\n\n\n###### ######################################################\n\nrunDerivativ eMaplet := proc()\n\nlocal maplet, b, s, c, dc, lc:\n\nb := 'border'=t rue:\ns := 'inset'=0, 'spacing'=0:\nc := 'background'=\"#DDFFFF\":\ndc := 'background'=\"#CCFFFF\":\nlc := 'background'=\"#EEFFFF\": \n\nuse Maplets:-Elements in\n\n############################################# ###############\n\nmaplet := Maplet( \n 'onstartup'=RunWindow('mainWi n'),\n\n############################################################\n \n Font['F1']('family'=\"Default\", 'bold'='true', 'italic'='true', ' size'=14),\n Font['F2']('family'=\"Default\", 'bold'='true', 'size'=1 4),\n\n############################################################\n \n MenuBar['MB'](\n Menu(\"File\", \n MenuItem(\"Plot\", \n \+ 'onclick'='A_plot' ),\n MenuSeparator(),\n MenuItem(\" Close\", 'onclick'=Shutdown())\n ), # end Menu/File\n Menu(\"Hel p\",\n MenuItem(\"Using Orders\", 'onclick'=RunWindow('orderWin') ), \n MenuItem(\"Using Colors\", 'onclick'=RunWindow('colorW in')),\n MenuSeparator(), \n MenuItem(\"Using this Maplet\", 'onclick'=RunWindow('helpWin'))\n ) # end menu/Help\n ), # end Me nuBar \n\n############################################################ \n\n Window['mainWin']('resizable'='false', \n 'title'=\"Calculus \+ 1 - Derivative Plot\",\n 'menubar'='MB', 'defaultbutton'='B_plot', \+ \n \n BoxRow(s, b, c,\n \n BoxColumn(s, c, b, 'caption'=\"Plo t Window\", \n Plotter['P'](lc)\n ), # end BoxRow for Plot ter\n\n BoxColumn(s, 'border'=false, c, \n\n BoxRow(s, c, b, 'c aption'=\"Enter a function and a range\", \n Label(\"Functio n \", 'font'='F2', c), \n TextField['TF_fun']('width'=15, lc, 'value'=2*exp(x/2), \n 'tooltip'=\"Differentiable functio n\"),\n Label(\" a \", 'font'='F2', c), \n Label(\" \+ = \", 'font'='F1', c), \n TextField['TF_a']('value'=-2, 'widt h'=4, lc),\n Label(\" b \", 'font'='F2', c), \n Labe l(\" = \", 'font'='F1', c), \n TextField['TF_b']('value'=2, ' width'=4, lc)\n ), # end BoxRow \n \n BoxColumn(s, c, b, 'ca ption'=\"Orders and colors of derivatives\",\n BoxRow(s, c, \n Label(\"orders\", 'font'='F2', c), \n Label(\" = \" , 'font'='F1', c), \n TextField['TF_order']('width'=20, lc, \+ \n 'value'=[1,2,3,4] ),\n Button(\"Using Orders\", dc, 'onclick'=RunWindow(orderWin))\n ), # end BoxRow\n \+ BoxRow(s, c, \n Label(\"colors\", 'font'='F2', c), \n \+ Label(\" = \", 'font'='F1', c), \n TextField['TF_color']('w idth'=20, lc, \n 'value'=[blue, green, gold, violet] ),\n \+ Button(\"Using Colors\", dc, 'onclick'=RunWindow(colorWin))\n \+ ) # end BoxRow\n\n ), # end BoxColumn\n\n BoxRow('inse t'=0, 'spacing'=0, 'background'=\"#DDFFFF\", \n BoxColumn('inse t'=0, 'spacing'=10, 'background'=\"#DDFFFF\", \n 'border'='tr ue', 'caption'=\"Display Options\", \n BoxRow('inset'=0, 'spa cing'=4, 'background'=\"#DDFFFF\", \n CheckBox['CB1']('valu e'=true, c, 'caption'=\"Show function\" ),\n CheckBox['CB2' ]('value'=true, c, 'caption'=\"Show derivatives\" )\n ), # en d BoxRow\n BoxRow('inset'=0, 'spacing'=3, 'background'=\"#DDFFFF \",\n Label(\"x =\", 'font'='F2', 'background'=\"#DDFFFF\") ,\n TextField['x1'](2, lc, value=\" \"), \n Labe l(\"..\", 'font'='F1', 'background'=\"#DDFFFF\"),\n TextFie ld['x2'](2, lc, value=\" \"),\n Label(\"y =\", 'font'='F2', c),\n TextField['y1'](2, lc, value=\" \"),\n La bel(\"..\", 'font'='F1', c),\n TextField['y2'](2, lc, value =\" \") \n ) # end BoxRow\n )), # end Column\n\n \+ BoxRow('inset'=0, 'spacing'=5, c, \n Button['B_plot' ](\" Plot\", dc, 'onclick'='A_plot' \n ), # end Button Plot \n Button(\"Close\", dc, Shutdown()) \n ) # end \+ BoxColumn\n\n # end BoxRow\n \n ) # end BoxColumn\n ) # end BoxColumn\n ), # end Window\n\n##################################### #######################\n\n Window['helpWin']( 'resizable'='false',\n 'title'=\"Using the Derivative Plot Maplet\",\n BoxColumn(b, 'i nset'=0, 'spacing'=5, c,\n BoxCell(\n TextBox('height'=8, \+ 'width'=32, lc, 'foreground'=\"#333399\", \n 'editable'='fals e', 'font'='F2', 'value'=helpStr\n ) # end TextBox\n ), # \+ end BoxCell\n BoxRow(s, c, \n Button(\"Close\", dc, Close Window('helpWin')) \n ) # BoxRow\n ) # end BoxColumn\n ), # \+ end helpWin\n\n####################################################### #####\n\n Window['orderWin']( 'resizable'='false',\n 'title'=\"Usi ng the 'order' Option\",\n BoxColumn(b, c, 'inset'=0, 'spacing'=5, \n BoxCell(\n TextBox('height'=19, 'width'=46, lc, \n'for eground'=\"#333399\", 'font'='F2', 'editable'='false', 'value '=orderStr\n ) # end TextBox\n ), # end BoxCell\n Box Row(s, c, \n Button(\"Close\", dc, CloseWindow('orderWin') )\n ) # end BoxRow\n ) # end BoxColumn\n ), # end orderWin\n\n# ###########################################################\n\n Windo w['colorWin']( 'resizable'='false',\n 'title'=\"Using the 'color' O ption\",\n BoxColumn(b, c, 'inset'=0, 'spacing'=5,\n BoxCell( \n TextBox('height'=24, 'width'=46, lc, 'foreground'=\"#333399 \", 'font'='F2', 'editable'='false', 'value'=colorStr\n \+ ) # end TextBox\n ), # end BoxCell\n BoxRow(s, c, \n \+ Button(\"Close\", dc, CloseWindow('colorWin') )\n ) # end BoxR ow\n ) # end BoxColumn\n ), # end colorWin\n\n################### #########################################\n\n Action['A'](),\n Actio n['A_plot']\n ( Evaluate\n ( 'waitforresult'='false', 'target'='P' ,\n 'function'='getDerivativePlot',\n Argument('CB1'),\n \+ Argument('CB2'),\n Argument('TF_fun', quotedtext='true'),\n \+ Argument('TF_a', quotedtext='true'),\n Argument('TF_b', quotedt ext='true'),\n Argument('TF_order', quotedtext='true'),\n Ar gument('TF_color', quotedtext='true'),\n Argument('x1', quotedtex t='true'),\n Argument('x2', quotedtext='true'),\n Argument(' y1', quotedtext='true'),\n Argument('y2', quotedtext='true')\n \+ )\n )\n\n########################################################### #\n\n): # end Maplet\n\n############################################## ##############\n\nMaplets:-Display(maplet):\n\nend use: # end use\nend proc: # end proc\n\n################################################# ###########\n\nend module: # end DerivativeMaplet\nDerivativeMaplet:-r unDerivativeMaplet();" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 15 "Differ entiation" }}{EXCHG {PARA 0 "" 0 "" {TEXT 268 36 "Click in red area an d press [Enter]." }{TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 54066 "# Step-by-Step Differentiation Problem Solver Maplet\n# Copyrig ht 2002 Waterloo Maple Inc.\n# This maplet guides the user through a d ifferentiation problem. The user can apply differentiation rules one a t a time to a function f and view the resulting expression. The Messag es box displays status information. \n# \n# The user enters a functi on with its independent variable. The user can apply differentiation r ules, for example, the sum rule (D(f+g) = D(f) + D(g)), the chain rule (D(f(g(x)) = D(f)(g(x))* D(g)(x)), and rules for special functions su ch as D(sin(x))=cos(x). When the user applies a rule, the Problem Stat us box is updated with the result of the applied rule.\n# \n# At any t ime, the user can request a hint for the next rule to apply, and then \+ apply the hint. \n# \n# The user can also specify that a set of rules is understood, in which case those rules are automatically applied (w hen possible).\n# \n# The user can rewrite a problem in a more conveni ent form. The rewrite rule is useful for an expression like \nx^x;# , \+ which can be rewritten as \nexp(x*ln(x));# . \n# \n# At any time, the user can display all solution steps in the solution or display the fi nal answer.\n# \n# To run this maplet, click the Execute (!!!) button \+ in the context bar.\n# \nrestart;\nDiffMaplet := module() \n\n######## ####################################################\n\n\n############ ################################################\n\nexport iniMathML, \+ addMathML, runDiffMaplet, \n startRule, applyRule, diffAllSteps, \n clearSteps, getHint, applyHint, aboutRule,\n changeUnd erstoodRules, removeRule,\n getFinalResult, applyOtherRule, appl yRewriteRule:\nlocal rewriteStr, helpStr, steps:\nsteps := []:\n\n#### ########################################################\n\n########## ##################################################\n\nrewriteStr :=\n \"This differentiation rule requires parameters. This rule is used to \+ change the form of the expression being differentiated. It has the gen eral form: \n [rewrite, f1(x) = g1(x), f2(x) = g2(x), ...]\nThe effect of applying the rewrite rule is to perform each of the substitutions \+ listed as the parameters to the rule, where occurrences of the left-ha nd side of each substitution are replaced by the corresponding right-h and side. \nThe main application of this rule is to rewrite an express ion of the form f(x)^g(x), where the exponent (at least) depends on th e differentiation variable, as an exponential. The rule would thus be \+ given as: \n [rewrite, f(x)^g(x) = exp(g(x) * ln(f(x))) ]\":\n\n###### ######################################################\n\n############ ################################################\n\nhelpStr := \n\"Thi s maplet guides you through a differentiation problem. You can apply \+ differentiation rules one at a time to a function f and view the resul ting expression. At any step of the problem, you can request a hint f or the next rule to apply. You can also specify that you understand a set of rules, in which case those rules are automatically applied (wh en possible).\n\nEnter a function with its independent variable. Click the 'Start' button. This clears the problem history and starts a new \+ one.\n\nTo apply differentiation rules, click the corresponding button s or select rules from the 'Apply the Rule' menu. Rules include the su m rule (D(f+g) = D(f) + D(g)), the chain rule (D(f(g(x))) = D(f)(g(x)) * D(g)(x)), and rules for special functions like D(sin(x))=cos(x).\nYo u can also rewrite a problem in a more convenient form. The rewrite ru le is useful for an expression such as x^x, which can be rewritten as \+ exp( x*ln(x) ). \n\nWhen you apply a rule, the 'Problem Status' box i s updated with the result of the applied rule.\n\nTo request a hint, c lick the 'Obtain a Hint' button or select 'Obtain a Hint' from the 'Fi le' menu. To apply the hint, click the 'Apply the Hint' button or sele ct 'Apply the Hint' from the 'File' menu.\n\nIf you understand a rule, you can select the rule from the 'Understood Rules' menu. The maplet \+ then applies that rule automatically when possible.\n\nTo clear the pr oblem history, click the 'Clear' button.\n\nTo show all steps in the s olution, click the 'All Steps' button. To display the final answer, cl ick the 'Final Ans' button or select 'Final Answer' from the 'File' me nu.\n\":\n\n########################################################## ##\n\n############################################################\n# \+ pre: iniEqn :: algebraic expression\n# post: returns the Presentation \+ MathML of iniEqn\n\niniMathML := proc(iniEqn)\n MathML:-ExportPresent ation(iniEqn);\nend proc:\n\n######################################### ###################\n\n############################################### #############\n# pre: mathMLStr :: string, in form of Presentation Mat hML\n# addEqn :: algebraic expression \n\naddMathML := proc(mathM LStr, addEqn)\n local tree, cmc, child, children, nl, eqnSign;\n use XMLTools in\n tree := FromString(mathMLStr);\n cmc := ContentMo delCount(tree);\n child := FromString(MathML:-ExportPresentation(ad dEqn));\n children := ContentModel(child);\n nl := FromString(\" \");\n eqnSign := Element(\"mo\",\"=\");\n \+ tree := AddChild(tree,nl,cmc);\n tree := AddChild(tree,eqnSign,c mc+1);\n for child in children do \n cmc := ContentModelCount( tree);\n tree := AddChild(tree,child,cmc);\n end do:\n tree := MakeElement(\"mrow\", [], ContentModel(tree) ):\n tree := Eleme nt(\"math\", tree):\n ToString(tree):\n end use:\nend proc:\n\n### #########################################################\n\n######### ###################################################\n# pre: null \n# p ost: initializes the differentiation\n# if input is correct, dif ferentiation equation\n# is added to steps, understood rules app lied\n# if applicapable, MathMLViewer updates as well\n# e lse error message shows \n\nstartRule := proc()\n local diffFun, cal_ eqn, mlStr, infoStr, uRulesStr, \n uRules, uAppliedRules, i, hi nts, \n diffVarStr, diffFunStr, diffEqnStr:\n\n use Student:- Calculus1, Maplets:-Tools in\n clearSteps():\n\n diffFunStr := G et('TF_fun'):\n if diffFunStr=\"\" then \n infoStr := \"Enter \+ a valid function\":\n Set('TB'=infoStr):\n error \"No functi on has been entered\": \n end if:\n\n diffVarStr := Get('TF_var' ):\n if diffVarStr=\"\" then \n infoStr := \"Enter a valid ind ependent variable\":\n Set('TB'=infoStr):\n error \"No indep endent variable has been entered\": \n end if:\n\n diffEqnStr := cat(\"Diff(\",diffFunStr,\",\",diffVarStr,\")\"):\n diffFun := par se(diffEqnStr):\n hints := Hint(diffFun):\n mlStr := iniMathML(G etProblem()):\n infoStr := \"Initializing\":\n Set('TB'=infoStr) :\n\n if nops(hints)>0 then\n uRules := rhs(Understand(Diff)): \n uAppliedRules := []:\n\n if nops(uRules) > 0 then\n\n \+ for i from 1 to nops(hints) do\n if member(hints[i],uRule s)=true then\n uAppliedRules := [op(uAppliedRules),hints[i] ]:\n end if: \n end do:\n\n cal_eqn := Rule[](G etProblem()):\n steps := [op(steps), cal_eqn]: \n\n if n ops(uAppliedRules) > 0 then\n \n if nops(uAppliedRules) = 1 then \n uRulesStr := convert(uAppliedRules,string):\n \+ infoStr := cat(\"Understood rule \", uRulesStr, \" is \"):\n \+ else \n uRulesStr := convert(uAppliedRules,string): \n infoStr := cat(\"Understood rules \", uRulesStr, \" are \+ \"):\n end if :# end if nops(uAppliedRules)=1\n\n in foStr := cat(infoStr, \"automatically applied\"):\n Set('TB'= infoStr):\n mlStr := addMathML(mlStr,rhs(cal_eqn)): \n\n \+ end if: # end if nops(uAppliedRules)>0\n\n else # nops(uRules) =0\n cal_eqn := Rule[](GetProblem()):\n steps := [op(ste ps), cal_eqn]: \n\n end if : # end if nops(uRules)>0 \n\n \+ Set('ML'=mlStr):\n infoStr := \"Apply a rule below\":\n \+ Set('TB'=infoStr): \n\n else\n infoStr := (\"No differ entiation rule could be applied\"):\n Set('TB'=infoStr): \n\n \+ end if: # nops(hints)\n end use:\nend proc: # end startRule\n\n###### ######################################################\n\n############ ################################################\n# pre: null\n# post: if aRule is a valid differentiation rule \n# and applicable new step is stored in steps, \n# updates MathMLViewer \n# els e message displays the rule is not applicable\n\napplyRule := proc(aRu le)\n local mlStr, infoStr, cal_eqn:\n use Student:-Calculus1, Maple ts:-Tools in\n\n if nops(steps)=0 then\n startRule():\n end if:\n\n mlStr := Get('ML'):\n cal_eqn := Rule[aRule](steps[nops (steps)]):\n\n if GetMessage()=NULL then\n infoStr := cat(conv ert(aRule,string), \n \" rule is being applied\") :\n Set('TB'=infoStr):\n\n steps := [op(steps),cal_eqn]:\n \+ mlStr := addMathML(mlStr,rhs(cal_eqn)):\n\n Set('ML'=mlStr): \n infoStr := cat(convert(aRule,string), \n \+ \" rule has been applied\"):\n Set('TB'=infoStr):\n\n else\n \+ infoStr := cat(convert(aRule,string), \n \" ru le is not applicable\"):\n Set('TB'=infoStr): \n\n end if: \n \n end use:\nend proc: # end applyRule\n\n########################### #################################\n\n################################# ###########################\n# pre: null\n# post: read the differentia tion rule from \n# in otherWin, and apply it\n# if TF_othe r is empty, error message displays\n\napplyOtherRule := proc()\n loca l aRule:\n use Maplets:-Tools, Maplets:-Elements in\n aRule := Get ('TF_other'):\n if aRule = \"\" then \n Maplets:-Display(Maple t(\n MessageDialog(\"No rule has been entered\"))): \n els e\n applyRule(parse(aRule)):\n end if:\n end use:\nend proc: \n\n############################################################\n\n## ##########################################################\n# pre: nul l\n# post: get argument from TF_args, and apply\n# the rewrite r ule to the diff problem\n\napplyRewriteRule := proc()\n local str:\n \+ use Student:-Calculus1, Maplets:-Tools, Maplets:-Elements in\n\n str := Get('TF_args'):\n if str=\"\" then\n Maplets:-Display(Maplet (\n MessageDialog(\"You must specify a rewrite equation\"))): \+ \n else\n str := cat(\"rewrite, \", str):\n applyRule([parse(s tr)]):\n end if:\n\n end use:\nend proc:\n\n######################## ####################################\n\n############################## ##############################\n# pre: null\n# post: a complete soluti on for the current problem is displayed\n\ndiffAllSteps := proc() \n \+ local diffEqn, hint, mlStr, infoStr:\n use Student:-Calculus1, Maplet s:-Tools in \n \n if nops(steps)=0 then\n startRule():\n \+ end if:\n\n diffEqn := steps[nops(steps)]:\n hint := Hint(diffE qn):\n\n if nops(hint)=0 then\n infoStr:=\"No rule could be ap plied, or the problem is done\":\n Set('TB'=infoStr):\n \n e lse\n mlStr:=Get('ML'):\n\n while nops(hint)>0 do\n i nfoStr := convert(hint,string):\n infoStr := cat(infoStr, \" is being applied\"):\n Set('TB'=infoStr):\n diffEqn:=Rule[ hint](diffEqn):\n mlStr := addMathML(mlStr,rhs(diffEqn)):\n \+ hint := Hint(diffEqn):\n end do:\n \n steps := [op( steps),diffEqn]:\n\n infoStr := \"Exporting the full solution\": \n Set('TB'=infoStr): \n Set('ML'=mlStr):\n infoStr := \+ \"A complete solution is displayed\":\n Set('TB'=infoStr):\n\n \+ end if: # end if nops(hint)=0\n\n end use: \nend proc: # end diffAll Steps\n\n############################################################ \n\n############################################################\n# pr e: null\n# post: final answer for the current problem is displayed\n\n getFinalResult := proc()\n local diffEqn, hint, mlStr, infoStr:\n us e Student:-Calculus1, Maplets:-Tools in \n \n if nops(steps)=0 t hen\n startRule():\n end if:\n\n diffEqn := steps[nops(step s)]:\n hint := Hint(diffEqn):\n\n if nops(hint)=0 then\n in foStr:=\"No rule could be applied, or the problem is done\":\n Se t('TB'=infoStr):\n \n else\n mlStr:=Get('ML'):\n\n whil e nops(hint)>0 do\n infoStr := convert(hint,string):\n i nfoStr := cat(infoStr, \" is being applied\"):\n Set('TB'=infoS tr):\n diffEqn:=Rule[hint](diffEqn):\n hint := Hint(diff Eqn):\n end do:\n \n steps := [op(steps),diffEqn]:\n\n \+ infoStr := \"Exporting final answer\":\n Set('TB'=infoStr): \+ \n mlStr := addMathML(mlStr,rhs(diffEqn)):\n Set('ML'=mlStr) :\n infoStr := \"The final answer is displayed\":\n Set('TB' =infoStr):\n\n end if: # end if nops(hint)=0\n\n end use: \nend pr oc: # end getFinalResult\n\n########################################## ##################\n\n################################################ ############\n# pre: null\n# post: clears the historic record of all s teps\n\nclearSteps := proc()\n use Student:-Calculus1, Maplets:-Tools in\n Set('ML'=\"\"): Set('TB'=\"\"):\n Clear(all): steps:=[]:\n end use:\nend proc: # end clearStep:\n\n############################ ################################\n\n################################## ##########################\n# pre: null\n# post: a hint to solve the q uestion is displayed\n\ngetHint := proc()\n local cal_eqn, hint, info Str: \n use Student:-Calculus1, Maplets:-Tools in\n\n if nops(step s)=0 then\n startRule():\n end if:\n\n cal_eqn := steps[nop s(steps)]:\n hint := Hint(cal_eqn):\n\n if nops(hint)=0 then\n \+ infoStr:=\"No rule could be applied, or the problem is done\":\n \+ Set('TB'=infoStr):\n else\n infoStr:=convert(hint,string): \n Set('TB'=infoStr):\n end if:\n\n hint:\n\n end use\nend proc: # end getHint\n\n############################################## ##############\n\n#################################################### ########\n# pre: null\n# post: a rule is applied if there is at least \n# one rule that works\n\napplyHint := proc()\n local hint:\n \n hint := getHint():\n if nops(hint)>0 then \n applyRule(hint): \n end if: \nend proc: # end applyHint\n\n########################### #################################\n\n################################# ###########################\n# pre: name is a valid differentiation ru le\n# fun is in a valid algebraic expression or function\n# post: Window ruleInfo pop ups with the\n# description of the differen tiation rule 'name'\n\naboutRule := proc(name,fun)\n local eqn:\n us e Maplets[Tools] in \n Set('ruleWin(title)'=cat(convert(name,string ),\" rule\")):\n if name=power then \n eqn := Diff(fun,x)=n*x^ (n-1):\n elif name=quotient then\n eqn := Diff(fun,x)=normal(d iff(fun,x),expanded):\n else \n eqn := Diff(fun,x)=diff(fun,x) :\n end if:\n Set('ML_rule'=MathML:-ExportPresentation(eqn)):\n \+ end use: \nend proc: # end aboutRule\n\n############################# ###############################\n\n################################### #########################\n# pre: aRule is a differentiation rule, rul eState:boolean\n# post: if ruleState=true, then aRule is understood\n# else aRule is removed from understood rules list\nchangeUnderst oodRules := proc(aRule, ruleState)\n use Student:-Calculus1 in\n i f ruleState=true then\n Understand(Diff,aRule):\n else \n \+ removeRule(aRule):\n end if:\n end use:\nend proc: # end changeUn derstoodRules\n\n##################################################### #######\n\n########################################################### #\n# pre: aRule is a valid differentiation rule\n# post: aRule is remo ved from understood rules list\n\nremoveRule := proc(aRule)\n local r ules;\n use Student:-Calculus1 in\n rules := rhs(Understand(Diff)) ;\n rules := subs(aRule = NULL,rules);\n Understand(Diff,'none') ;\n if nops(rules) > 0 then\n Understand(Diff,op(rules));\n \+ end if:\n end use:\nend proc: # end removeRule\n\n################## ##########################################\n\n######################## ####################################\n# pre: Maple 8 or a higher versi on is installed\n# post: run Step-by-Step differentiator\n\nrunDiffMap let := proc()\n\nlocal maplet, color, lightcolor, darkcolor:\ncolor := 'background'=\"#DDFFFF\":\nlightcolor := 'background'=\"#EEFFFF\":\nd arkcolor := 'background'=\"#CCFFFF\":\n\nuse Maplets, Maplets:-Element s, Student:-Calculus1 in\n\nmaplet := Maplet( \n 'onstartup'=RunWindo w('diffWin'),\n Font['F1']('family'=\"Default\",italic='true','size'= 12),\n Font['F2']('family'=\"Default\", 'bold'='true', 'size'=14), \n \n Window['diffWin']('menubar'='diffMB', 'resizable'='false', \n \+ 'title'=\"Calculus 1 - Step-by-Step Differentiation Problem Solver\", \n BoxColumn(color, 'inset'=0, 'spacing'=0, \n\n BoxRow(color , 'border'='true','inset'=0,'spacing'=3, \n 'caption'=\"Enter a function\",\n Label('caption'=\"Function \", 'font'=F2,'bac kground'=\"#DDFFFF\"), \n TextField['TF_fun']('value'=sin(x)*x, lightcolor, 'width'=36),\n Label('caption'=\"Variable \", 'f ont'=F2,'background'=\"#DDFFFF\"), \n TextField['TF_var'](light color,\"x\",8)\n ), # end BoxRow\n\n BoxRow(color, 'inset'=0 ,'spacing'=0, \n BoxColumn(color, 'border'='true', 'inset'=0, \+ 'spacing'=0, \n 'caption'=\"Problem Status\",\n Bo xRow(color, \n MathMLViewer['ML']('height'=470, 'width'= 400, lightcolor)\n ), # end BoxRow\n BoxRow(color, ' halign'='right', color, \n Button(\"Start\", 'onclick'='A_D iff', lightcolor, \n 'tooltip'=\"Initialize differentiati on\"),\n Button(\"Final Ans\", 'onclick'='A_diff', lightcol or,\n 'tooltip'=\"Display final answer\"), \n \+ Button(\"All Steps\", 'onclick'='A_diffAll', lightcolor,\n \+ 'tooltip'=\"Display a complete solution\"),\n Button(\"Cl ear\", 'onclick'='A_clear', lightcolor,\n 'tooltip'=\"Cle ar the problem history\"),\n Button(\"Close\", Shutdown(), \+ 'tooltip'=\"Close the maplet\", lightcolor) \n ) # end BoxRow \n ), # end BoxColumn\n\n BoxColumn(color, 'inset'=0, 'i nset'=0, 'spacing'=0, \n\n BoxRow(color, 'border'='true', 'ca ption'=\"Messages\", \n 'inset'=0, 'spacing'=0, \n \+ BoxCell(\n TextBox['TB'](lightcolor, 'editable' ='false',\n 'value'=\"\",\n 'tooltip'=\" Messages\", 'font'='F1', 'height'=3 \n ) # end TextBox\n \+ ) # end BoxCell\n ), # end BoxRow \n\n \+ BoxRow(color, 'border'='true', 'caption'=\"Hints\", \n \+ 'inset'=0, 'spacing'=12, \n BoxCell(Button['B_getHi nt'](\"Obtain a Hint\", lightcolor, \n 'onclick'='A _getHint', 'tooltip'=\"Receive a hint\")),\n BoxCell(Button ['B_applyHint'](\"Apply the Hint\", lightcolor, \n \+ 'onclick'='A_applyHint', 'tooltip'=\"Apply the hint displayed in the M essages box\"))\n ), # end BoxRow\n\n BoxColumn(colo r, 'border'='true', 'inset'=0, 'spacing'=0,\n 'cap tion'=\"Differentiation Rules\", \n \n BoxRow(co lor, 'halign'='left', 'inset'=0, 'spacing'=0,\n BoxCell(' halign'='left',\n Button['B_constant'](\" Constant \", \+ \n 'onclick'='A_constant', lightcolor, \n \+ 'tooltip'=\"Apply constant rule: c' = 0\")\n ), # B oxCell\n BoxCell('halign'='left',\n Button ['B_constantmultiple'](\"Constant Multiple\", \n 'onc lick'='A_constantmultiple', lightcolor, \n 'tooltip'= \"Apply constant multiple rule: (c*f)' = c*f'\")\n ) # Bo xCell\n ), # BoxRow\n\n BoxRow(color, 'halign'=' left', 'inset'=0, 'spacing'=0,\n BoxCell('halign'='left', \n Button['B_identiy'](\"Identity\", \n \+ 'onclick'='A_identity', lightcolor, \n 'tooltip'=\" Apply identity rule: x' = 1\")\n ), # BoxCell\n \+ BoxCell('halign'='left',\n Button['B_power'](\"Powe r\", \n 'onclick'='A_power', lightcolor, \n \+ 'tooltip'=\"Apply power rule: (x^n)' = n*x^(n-1)\")\n \+ ), # BoxCell\n BoxCell('halign'='left',\n \+ Button['B_int'](\"Integral \", \n 'onclick'='A_i nt', lightcolor, \n 'tooltip'=\"Apply integral rule: \+ (Int(f(t),t=c..x))'=f(x)\")\n ) # BoxCell\n ), # BoxRow\n\n BoxRow(color, 'halign'='left', 'inset'=0, 'sp acing'=0,\n BoxCell('halign'='left',\n But ton['B_sum'](\"Sum \", \n 'onclick'='A_sum', lightcol or, \n 'tooltip'=\"Apply sum rule: (f+g)' = f'+g'\") \n ), # BoxCell\n BoxCell('halign'='left',\n Button['B_product'](\"Product\", \n ' onclick'='A_product', lightcolor,\n 'tooltip'=\"Apply product rule: (f*g)' = f'*g + f*g'\")\n ), # BoxCell\n \+ BoxCell('halign'='left', \n Button['B_quoti ent'](\"Quotient\", \n 'onclick'='A_quotient', lightc olor, \n 'tooltip'=\"Apply quotient rule: (f/g)'= (g* f'-f'*g)/g^2\")\n ) # BoxCell\n ), # BoxRow\n \n BoxRow(color, 'halign'='left', 'inset'=0, 'spacing'=0, \+ \n BoxCell('halign'='left',\n Button['B_ch ain'](\"Chain Rule\", \n 'onclick'='A_chain', lightco lor, \n 'tooltip'=\"Apply chain rule: (f(g(x)))'=f'(g (x))*g'(x)\")\n ), # BoxCell\n BoxCell('hali gn'='left',\n Button['B_exp'](\"Exponential \", \n \+ 'onclick'='A_exp', lightcolor, \n 'toolt ip'=\"Differentiate natural exponential function\")\n ) # BoxCell\n ), # BoxRow\n\n BoxRow(color, 'halign '='left', 'inset'=0, 'spacing'=0, \n BoxCell('halign'='le ft',\n Button['B_ln'](\"Natural Logarithm\", \n \+ 'onclick'='A_ln', lightcolor, \n 'tooltip'= \"Differentiate natural logarithm function\")\n ), # BoxC ell\n BoxCell('halign'='left',\n Button['B _log10'](\"Log 10\", \n 'onclick'='A_log10', lightcol or, \n 'tooltip'=\"Differentiate common logarithm fun ction\")\n ) # BoxCell\n ), # BoxRow\n\n \+ BoxRow(color, 'halign'='left', 'inset'=0, 'spacing'=0, \n \+ BoxCell('halign'='left',\n Button['B_sin'](\" \+ sin \", \n 'onclick'='A_sin', lightcolor, \n \+ 'tooltip'=\"Differentiate sine function\")\n \+ ), # BoxCell\n BoxCell('halign'='left',\n \+ Button['B_cos'](\" cos \", \n 'onclick'='A_cos', \+ lightcolor, \n 'tooltip'=\"Differentiate cosine funct ion\")\n ), # BoxCell\n BoxCell('halign'='le ft',\n Button['B_tan'](\" tan \", \n \+ 'onclick'='A_tan', lightcolor, \n 'tooltip'=\"Diff erentiate tangent function\")\n ) # BoxCell\n \+ ), # BoxRow\n\n BoxRow(color, 'halign'='left', 'inset'=0, ' spacing'=0, \n BoxCell('halign'='left',\n \+ Button['B_cot'](\" cot \", \n 'onclick'='A_cot', lightcolor, \n 'tooltip'=\"Differentiate cotangent f unction\")\n ), # BoxCell\n BoxCell('halign' ='left',\n Button['B_sec'](\" sec \", \n \+ 'onclick'='A_sec', lightcolor, \n 'tooltip'=\" Differentiate secant function\")\n ), # BoxCell\n \+ BoxCell('halign'='left',\n Button['B_csc'](\" c sc \", \n 'onclick'='A_csc', lightcolor, \n \+ 'tooltip'=\"Differentiate cosecant function\")\n \+ ) # BoxCell\n ), # BoxRow\n\n BoxRow(color, 'h align'='left', 'inset'=0, 'spacing'=0, \n BoxCell('halign '='left',\n Button['B_sinh'](\" sinh \", \n \+ 'onclick'='A_sinh', lightcolor, \n 'tooltip'= \"Differentiate sinh function\")\n ), # BoxCell\n \+ BoxCell('halign'='left',\n Button['B_cosh'](\" c osh \", \n 'onclick'='A_cosh', lightcolor, \n \+ 'tooltip'=\"Differentiate cosh function\")\n ) , # BoxCell\n BoxCell('halign'='left',\n B utton['B_tanh'](\" tanh \", \n 'onclick'='A_tanh', \+ lightcolor, \n 'tooltip'=\"Differentiate tanh functio n\")\n ) # BoxCell\n ), # BoxRow\n\n \+ BoxRow(color, 'halign'='left', 'inset'=0, 'spacing'=0, \n \+ BoxCell('halign'='left',\n Button['B_coth'](\" coth \", \n 'onclick'='A_coth', lightcolor, \n \+ 'tooltip'=\"Differentiate coth function\")\n ), # BoxCell\n BoxCell('halign'='left',\n Butt on['B_sech'](\" sech \", \n 'onclick'='A_sech', lig htcolor, \n 'tooltip'=\"Differentiate sech function\" )\n ), # BoxCell\n BoxCell('halign'='left', \n Button['B_csch'](\" csch \", \n ' onclick'='A_csch', lightcolor, \n 'tooltip'=\"Differe ntiate csch function\")\n ) # BoxCell\n ), # B oxRow\n\n BoxRow(color, 'halign'='left', 'inset'=0, 'spacin g'=0, \n BoxCell('halign'='left',\n Button ['B_arcsin'](\" arcsin \", \n 'onclick'='A_arcsin', l ightcolor, \n 'tooltip'=\"Differentiate arcsin functi on\")\n ), # BoxCell\n BoxCell('halign'='lef t',\n Button['B_arccos'](\" arccos \", \n \+ 'onclick'='A_arccos', lightcolor, \n 'tooltip'=\" Differentiate arccos function\")\n ), # BoxCell\n \+ BoxCell('halign'='left',\n Button['B_arctan'](\" \+ arctan \", \n 'onclick'='A_arctan', lightcolor, \n \+ 'tooltip'=\"Differentiate arctan function\")\n \+ ) # BoxCell\n ), # BoxRow\n\n BoxRow(color, 'halign'='left', 'inset'=0, 'spacing'=0, \n BoxCell('hal ign'='left',\n Button['B_arccot'](\" arccot \", \n \+ 'onclick'='A_arccot', lightcolor, \n 'to oltip'=\"Differentiate arccot function\")\n ), # BoxCell \n BoxCell('halign'='left',\n Button['B_ar csec'](\" arcsec \", \n 'onclick'='A_arcsec', lightco lor, \n 'tooltip'=\"Differentiate arcsec function\") \n ), # BoxCell\n BoxCell('halign'='left',\n Button['B_arccsc'](\" arccsc \", \n ' onclick'='A_arccsc', lightcolor, \n 'tooltip'=\"Diffe rentiate arccsc function\")\n ) # BoxCell\n ), # BoxRow\n\n BoxRow(color, 'halign'='left', 'inset'=0, 'sp acing'=0, \n BoxCell('halign'='left', \n B utton['B_arcsinh'](\"arcsinh\", \n 'onclick'='A_arcsi nh', lightcolor, \n 'tooltip'=\"Differentiate arcsinh function\")\n ), # BoxCell\n BoxCell('halig n'='left', \n Button['B_arccosh'](\"arccosh\", \n \+ 'onclick'='A_arccosh', lightcolor, \n 'to oltip'=\"Differentiate arccosh function\")\n ), # BoxCell \n BoxCell('halign'='left',\n Button['B_ar ctanh'](\"arctanh\", \n 'onclick'='A_arctanh', lightc olor, \n 'tooltip'=\"Differentiate arctanh function\" )\n ) # BoxCell\n ), # BoxRow\n\n B oxRow(color, 'halign'='left', 'inset'=0, 'spacing'=0, \n \+ BoxCell('halign'='left',\n Button['B_arccoth'](\"arccot h\", \n 'onclick'='A_arccoth', lightcolor, \n \+ 'tooltip'=\"Differentiate arccoth function\")\n \+ ), # BoxCell\n BoxCell('halign'='left',\n \+ Button['B_arcsech'](\"arcsech\", \n 'onclick'='A_arc sech', lightcolor, \n 'tooltip'=\"Differentiate arcse ch function\")\n ), # BoxCell\n BoxCell('hal ign'='left',\n Button['B_arccsch'](\"arccsch\", \n \+ 'onclick'='A_arccsch', lightcolor, \n 't ooltip'=\"Differentiate arccsch function\")\n ) # BoxCell \n ) # BoxRow\n\n ) # end BoxLayout\n \n \+ ) # end BoxColumn \n ) # end BoxRow\n\n ) # end BoxColumn \n ), # end Window\n\n############################################### #############\n\n MenuBar['diffMB'](\n Menu(\"File\",\n MenuI tem(\"Obtain a Hint\", 'onclick'='A_getHint'),\n MenuItem(\"Apply the Hint\", 'onclick'='A_applyHint'),\n MenuSeparator(),\n \+ MenuItem(\"Start to Differentiate\", 'onclick'='A_Diff'),\n MenuI tem(\"Show All Steps\", 'onclick'='A_diffAll'),\n MenuItem(\"Fina l Answer\", 'onclick'='A_diff'), \n MenuSeparator(),\n \+ MenuItem(\"Clear\", 'onclick'='A_clear'),\n MenuSeparator(),\n \+ MenuItem(\"Close\", Shutdown())\n ), # end Menu/File\n \n Men u(\"Rule Definition\",\n MenuItem(\"Chain Rule\", 'onclick'='A_i_ chain'),\n MenuSeparator(),\n MenuItem(\"Constant Rule\", 'o nclick'='A_i_constant'),\n MenuItem(\"Constant Multiple\", 'oncli ck'='A_i_constantmultiple'),\n MenuSeparator(),\n MenuItem( \"Identity Rule\", 'onclick'='A_i_identity'),\n MenuItem(\"Power \+ Rule\", 'onclick'='A_i_power'),\n MenuSeparator(),\n MenuIte m(\"Sum Rule\", 'onclick'='A_i_sum'),\n MenuItem(\"Difference Rul e\", 'onclick'='A_i_difference'),\n MenuSeparator(),\n MenuI tem(\"Product Rule\", 'onclick'='A_i_product'),\n MenuItem(\"Quot ient Rule\", 'onclick'='A_i_quotient'),\n MenuSeparator(),\n \+ MenuItem(\"Natural Exponential\", 'onclick'='A_i_exp'),\n MenuIt em(\"Natural Logarithm\",'onclick'='A_i_ln'),\n MenuItem(\"Logari thm Base 10\",'onclick'='A_i_log10'),\n MenuSeparator(),\n M enu(\"Trigonometric Functions\",\n MenuItem(\"sin\",'onclick'=' A_i_sin'),\n MenuItem(\"cos\",'onclick'='A_i_cos'),\n Me nuItem(\"tan\",'onclick'='A_i_tan'),\n MenuItem(\"cot\",'onclic k'='A_i_cot'),\n MenuItem(\"sec\",'onclick'='A_i_sec'),\n \+ MenuItem(\"csc\",'onclick'='A_i_csc')\n ), # end Menu/Trig\n \+ Menu(\"Inverse Trigonometric Functions\",\n MenuItem(\"arcsi n\",'onclick'='A_i_arcsin'),\n MenuItem(\"arccos\",'onclick'='A _i_arccos'),\n MenuItem(\"arctan\",'onclick'='A_i_arctan'),\n \+ MenuItem(\"arccot\",'onclick'='A_i_arccot'),\n MenuItem( \"arcsec\",'onclick'='A_i_arcsec'),\n MenuItem(\"arccsc\",'oncl ick'='A_i_arccsc')\n ), # end Menu/Inverse Trig\n Menu(\"Hyp erbolic Functions\",\n MenuItem(\"sinh\",'onclick'='A_i_sinh'), \n MenuItem(\"cosh\",'onclick'='A_i_cosh'),\n MenuItem( \"tanh\",'onclick'='A_i_tanh'),\n MenuItem(\"coth\",'onclick'=' A_i_coth'),\n MenuItem(\"sech\",'onclick'='A_i_sech'),\n \+ MenuItem(\"csch\",'onclick'='A_i_csch')\n ), # end Menu/Hyperbol ic \n Menu(\"Inverse Hyperbolic Functions\",\n MenuItem(\" arcsinh\",'onclick'='A_i_arcsinh'),\n MenuItem(\"arccosh\",'onc lick'='A_i_arccosh'),\n MenuItem(\"arctanh\",'onclick'='A_i_arc tanh'),\n MenuItem(\"arccoth\",'onclick'='A_i_arccoth'),\n \+ MenuItem(\"arcsech\",'onclick'='A_i_arcsech'),\n MenuItem(\" arccsch\",'onclick'='A_i_arccsch')\n ), # end Menu/Inverse hyperb olic\n MenuSeparator(),\n MenuItem(\"Integral Rule\", 'oncli ck'='A_i_int'),\n MenuItem(\"Rewrite Rule\", 'onclick'=RunWindow( 'rewriteInfoWin'))\n ), # end Menu/Rule Definition\n\n Menu(\"Appl y the Rule\",\n MenuItem(\"Chain Rule\", 'onclick'='A_chain'),\n \+ MenuSeparator(),\n MenuItem(\"Constant Rule\", 'onclick'='A_ constant'),\n MenuItem(\"Constant Multiple\", 'onclick'='A_consta ntmultiple'),\n MenuSeparator(),\n MenuItem(\"Identity Rule \", 'onclick'='A_identity'),\n MenuItem(\"Power Rule\", 'onclick' ='A_power'),\n MenuSeparator(),\n MenuItem(\"Sum Rule\", 'on click'='A_sum'),\n MenuItem(\"Difference Rule\", 'onclick'='A_dif ference'),\n MenuSeparator(),\n MenuItem(\"Product Rule\", ' onclick'='A_product'),\n MenuItem(\"Quotient Rule\", 'onclick'='A _quotient'),\n MenuSeparator(),\n MenuItem(\"Natural Exponen tial\", 'onclick'='A_exp'),\n MenuItem(\"Natural Logarithm\",'onc lick'='A_ln'),\n MenuItem(\"Logarithm Base 10\",'onclick'='A_log1 0'),\n MenuSeparator(),\n Menu(\"Trigonometric Functions\", \n MenuItem(\"sin\",'onclick'='A_sin'),\n MenuItem(\"cos \",'onclick'='A_cos'),\n MenuItem(\"tan\",'onclick'='A_tan'),\n MenuItem(\"cot\",'onclick'='A_cot'),\n MenuItem(\"sec\" ,'onclick'='A_sec'),\n MenuItem(\"csc\",'onclick'='A_csc')\n \+ ), # end Menu/Trig\n Menu(\"Inverse Trigonometric Functions\", \n MenuItem(\"arcsin\",'onclick'='A_arcsin'),\n MenuItem (\"arccos\",'onclick'='A_arccos'),\n MenuItem(\"arctan\",'oncli ck'='A_arctan'),\n MenuItem(\"arccot\",'onclick'='A_arccot'),\n MenuItem(\"arcsec\",'onclick'='A_arcsec'),\n MenuItem( \"arccsc\",'onclick'='A_arccsc')\n ), # end Menu/Inverse Trig\n \+ Menu(\"Hyperbolic Functions\",\n MenuItem(\"sinh\",'onclick '='A_sinh'),\n MenuItem(\"cosh\",'onclick'='A_cosh'),\n \+ MenuItem(\"tanh\",'onclick'='A_tanh'),\n MenuItem(\"coth\",'onc lick'='A_coth'),\n MenuItem(\"sech\",'onclick'='A_sech'),\n \+ MenuItem(\"csch\",'onclick'='A_csch')\n ), # end Menu/Hyperbo lic \n Menu(\"Inverse Hyperbolic Functions\",\n MenuItem( \"arcsinh\",'onclick'='A_arcsinh'),\n MenuItem(\"arccosh\",'onc lick'='A_arccosh'),\n MenuItem(\"arctanh\",'onclick'='A_arctanh '),\n MenuItem(\"arccoth\",'onclick'='A_arccoth'),\n Men uItem(\"arcsech\",'onclick'='A_arcsech'),\n MenuItem(\"arccsch \",'onclick'='A_arccsch')\n ), # end Menu/Inverse hyperbolic\n \+ MenuSeparator(),\n MenuItem(\"Integral Rule\", 'onclick'='A_in t'),\n MenuItem(\"Rewrite Rule\", 'onclick'=RunWindow('rewriteWin ')),\n MenuSeparator(),\n MenuItem(\"Enter a Diff Rule\", 'o nclick'=RunWindow('otherWin'))\n ), # end Menu/Apply Rules\n \n \+ Menu(\"Understood Rules\",\n CheckBoxMenuItem['CMI_chain'](\"C hain Rule\", 'onclick'='A_u_chain'),\n MenuSeparator(), \n \+ CheckBoxMenuItem['CMI_constant'](\n \"Constant Rule\", 'onc lick'='A_u_constant'),\n CheckBoxMenuItem['CMI_constantmultiple'] (\n \"Constant Multiple\", 'onclick'='A_u_constantmultiple') ,\n MenuSeparator(),\n CheckBoxMenuItem['CMI_identity'](\"Id entity Rule\", 'onclick'='A_u_identity'),\n CheckBoxMenuItem['CMI _power'](\"Power Rule\", 'onclick'='A_u_power'),\n MenuSeparator( ),\n CheckBoxMenuItem['CMI_sum'](\"Sum Rule\", 'onclick'='A_u_sum '),\n CheckBoxMenuItem['CMI_difference'](\"Difference Rule\", 'on click'='A_u_difference'),\n MenuSeparator(),\n CheckBoxMenuI tem['CMI_product'](\"Product Rule\", 'onclick'='A_u_product'),\n \+ CheckBoxMenuItem['CMI_quotient'](\"Quotient Rule\", 'onclick'='A_u_quo tient'),\n MenuSeparator(),\n CheckBoxMenuItem['CMI_exp'](\" Natural Exponential\", 'onclick'='A_u_exp'),\n CheckBoxMenuItem[' CMI_ln'](\"Natural Logarithm\",'onclick'='A_u_ln'),\n CheckBoxMen uItem['CMI_log10'](\"Logarithm Base 10\",'onclick'='A_u_log10'),\n \+ MenuSeparator(),\n Menu(\"Trigonometric Functions\",\n C heckBoxMenuItem['CMI_sin'](\"sin\",'onclick'='A_u_sin'),\n Chec kBoxMenuItem['CMI_cos'](\"cos\",'onclick'='A_u_cos'),\n CheckBo xMenuItem['CMI_tan'](\"tan\",'onclick'='A_u_tan'),\n CheckBoxMe nuItem['CMI_cot'](\"cot\",'onclick'='A_u_cot'),\n CheckBoxMenuI tem['CMI_sec'](\"sec\",'onclick'='A_u_sec'),\n CheckBoxMenuItem ['CMI_csc'](\"csc\",'onclick'='A_u_csc')\n ), # end Menu/Trig\n \+ Menu(\"Inverse Trigonometric Functions\",\n CheckBoxMenuIte m['CMI_arcsin'](\"arcsin\",'onclick'='A_u_arcsin'),\n CheckBoxM enuItem['CMI_arccos'](\"arccos\",'onclick'='A_u_arccos'),\n Che ckBoxMenuItem['CMI_arctan'](\"arctan\",'onclick'='A_u_arctan'),\n \+ CheckBoxMenuItem['CMI_arccot'](\"arccot\",'onclick'='A_u_arccot'), \n CheckBoxMenuItem['CMI_arcsec'](\"arcsec\",'onclick'='A_u_arc sec'),\n CheckBoxMenuItem['CMI_arccsc'](\"arccsc\",'onclick'='A _u_arccsc')\n ), # end Menu/Inverse Trig\n Menu(\"Hyperbolic Functions\",\n CheckBoxMenuItem['CMI_sinh'](\"sinh\",'onclick' ='A_u_sinh'),\n CheckBoxMenuItem['CMI_cosh'](\"cosh\",'onclick' ='A_u_cosh'),\n CheckBoxMenuItem['CMI_tanh'](\"tanh\",'onclick' ='A_u_tanh'),\n CheckBoxMenuItem['CMI_coth'](\"coth\",'onclick' ='A_u_coth'),\n CheckBoxMenuItem['CMI_sech'](\"sech\",'onclick' ='A_u_sech'),\n CheckBoxMenuItem['CMI_csch'](\"csch\",'onclick' ='A_u_csch')\n ), # end Menu/Hyperbolic \n Menu(\"Inverse Hy perbolic Functions\",\n CheckBoxMenuItem['CMI_arcsinh'](\"arcsi nh\",'onclick'='A_u_arcsinh'),\n CheckBoxMenuItem['CMI_arccosh' ](\"arccosh\",'onclick'='A_u_arccosh'),\n CheckBoxMenuItem['CMI _arctanh'](\"arctanh\",'onclick'='A_u_arctanh'),\n CheckBoxMenu Item['CMI_arccoth'](\"arccoth\",'onclick'='A_u_arccoth'),\n Che ckBoxMenuItem['CMI_arcsech'](\"arcsech\",'onclick'='A_u_arcsech'),\n \+ CheckBoxMenuItem['CMI_arccsch'](\"arccsch\",'onclick'='A_u_arccs ch')\n ), # end Menu/Inverse hyperbolic\n MenuSeparator(),\n CheckBoxMenuItem['CMI_int'](\"Integral Rule\", 'onclick'='A_u_in t')\n ), # end Menu/Understood Rules\n \n Menu(\"Help\",\n \+ MenuItem(\"Using this Maplet\", 'onclick'=RunWindow('helpWin'))\n ) # end Menu/Help\n\n ), # end MenuBar\n\n############################ ################################\n\n Window[ruleWin]('resizable'='fal se',\n 'title'=\"Differentiation Rule\",\n BoxColumn(color, 'ins et'=0, 'spacing'=10, \n 'border'='true', \n BoxRow(color, ' inset'=0, 'spacing'=0, \n MathMLViewer['ML_rule']('width'=375, lightcolor) \n ), # end BoxRow\n BoxRow(color, 'inset'=0, ' spacing'=0, \n Button(\"Close\", lightcolor, CloseWindow(ruleWi n))\n ) # end BoxRow\n ) # end BoxColumn\n ), # end ruleInfo \n\n############################################################\n\n \+ Window['otherWin']( 'resizable'='false',\n 'title'=\"Enter Diff Rul e\", \n BoxColumn(color, 'inset'=0, 'spacing'=5, \n 'border'=' true', \n BoxRow(color, 'inset'=0, 'spacing'=0, \n TextF ield['TF_other']('width'=10, lightcolor)\n ), # end BoxRow\n \+ BoxRow(color, 'inset'=0, 'spacing'=10, \n Button(\"Apply\", \+ \n 'onclick'='A_other', darkcolor),\n Button(\"Close\" , \n 'onclick'=CloseWindow('otherWin'), darkcolor)\n ) \+ # end BoxRow\n ) # end BoxColumn\n ), # end Window otherWin \n\n## ##########################################################\n\n Window ['rewriteWin']( 'resizable'='false', \n 'title'=\"Apply Rewrite Rul e\",\n BoxColumn(color, 'inset'=0, 'spacing'=5, \n 'border'=' true', \n BoxRow(color, 'inset'=0, 'spacing'=0, \n Labe l(\"Enter the parameters (separated by commas): \") \n ), # end B oxRow\n BoxRow(color, 'inset'=0, 'spacing'=0, \n TextFiel d['TF_args']('width'=18, lightcolor)\n ), # end BoxRow\n Box Row(color, 'inset'=0, 'spacing'=8, \n Button(\"Apply\", darkcol or, \n 'onclick'=Evaluate('function'='applyRewriteRule()') ) ,\n Button(\"About\", darkcolor, \n 'onclick'=RunWind ow('rewriteInfoWin') ), \n Button(\"Close\", darkcolor, \n \+ 'onclick'=CloseWindow('rewriteWin') )\n ) # end BoxRow\n \+ ) # end BoxColumn \n ), # end rewriteWin\n \n################### #########################################\n\n Window['rewriteInfoWin' ]( 'resizable'='false',\n 'title'=\"Using the Rewrite Rule\", \n \+ BoxColumn(color, 'inset'=0, 'spacing'=5, \n 'border'='true', \+ \n BoxRow(color, 'inset'=0, 'spacing'=0, \n TextBox['TB_re write']('value'=rewriteStr, \n 'editable'='false', 'visible' ='true', lightcolor, \n 'height'=19, 'width'=50, 'tooltip'= \"Using the rewrite rule\") \n ), # end BoxRow\n BoxRow(co lor, 'inset'=0, 'spacing'=20, \n Button(\"Close\", darkcolor, ' onclick'=CloseWindow('rewriteInfoWin'))\n ) # end BoxRow\n ) # end BoxColumn \n ), # end rewriteWin\n\n######################### ###################################\n\n Window['helpWin']( 'resizable '='false',\n 'title'=\"Using the Step-by-Step Differentiation Probl em Solver Maplet\",\n BoxColumn(color, 'border'='true', 'inset'=0, \+ 'spacing'=8,\n BoxCell(\n TextBox('height'=24, 'width'=40, \n lightcolor, 'foreground'=\"#333399\", \n 'editabl e'='false', 'font'='F2', \n 'value'=helpStr\n ) # end \+ TextBox\n ), # end BoxCell\n BoxRow(color, 'inset'=0, 'spaci ng'=0, \n Button(\"Close\", lightcolor, \n CloseWindow ('helpWin'))\n ) # end BoxRow\n ) # end BoxColumn\n ), # end \+ helpWin\n\n########################################################### #\n\n Action['A_Diff'](\n Evaluate('function'='startRule()') \n ) , # end A_Diff\n \n Action['A_diffAll'](\n Evaluate('function'='d iffAllSteps()')\n ), # end A_diffAll\n\n Action['A_diff'](\n Eval uate('function'='getFinalResult()')\n ), # end A_diff \n\n Action[' A_clear'](\n Evaluate('function'='clearSteps()')\n ), # end A_clea r\n \n Action['A_getHint'](\n Evaluate('function'='getHint()')\n \+ ), # end A_getHint\n\n Action['A_applyHint'](\n Evaluate('functio n'='applyHint()')\n ), # end A_applyHint\n\n Action['A_other'](\n \+ Evaluate('function'='applyOtherRule()'),\n CloseWindow('otherWin') , \n SetOption('TF_other'=\"\")\n ), # end A_other\n\n############ ################################################\n\n Action['A_i_cons tant'](\n Evaluate('function'='aboutRule(constant,c)'),\n RunWin dow('ruleWin')\n ), # end A_i_constant\n \n Action['A_i_constantmult iple'](\n Evaluate('function'='aboutRule(constantmultiple,c*f(x))') ,\n RunWindow('ruleWin')\n ), # end A_i_constantmultiple\n \n Ac tion['A_i_sum'](\n Evaluate('function'='aboutRule(sum,f(x)+g(x))'), \n RunWindow('ruleWin') \n ), # end A_i_sum\n\n Action['A_i_diff erence'](\n Evaluate('function'='aboutRule(sum,f(x)-g(x))'),\n R unWindow('ruleWin') \n ), # end A_i_difference\n \n Action['A_i_id entity'](\n Evaluate('function'='aboutRule(identity,x)'),\n RunW indow('ruleWin')\n ), # end A_i_identity\n \n Action['A_i_power']( \n Evaluate('function'='aboutRule(power,x^n)'),\n RunWindow('rul eWin')\n ), # end A_i_power\n\n Action['A_i_product'](\n Evaluate ('function'='aboutRule(product,f(x)*g(x))'),\n RunWindow('ruleWin') \n ), # end A_i_product\n\n Action['A_i_quotient'](\n Evaluate('f unction'='aboutRule(quotient,f(x)/g(x))'),\n RunWindow('ruleWin')\n ), # end A_i_sum\n\n Action['A_i_chain'](\n Evaluate('function'= 'aboutRule(chain,f(g(x)))'),\n RunWindow('ruleWin')\n ), # end A_i _chain\n\n Action['A_i_int'](\n Evaluate('function'='aboutRule(int ,Int(f(t),t=c..x))'),\n RunWindow('ruleWin')\n ), # end A_i_chain \n\n Action['A_i_exp'](\n Evaluate('function'='aboutRule(exp,exp(x ))'),\n RunWindow('ruleWin')\n ), # end A_i_exp\n\n Action['A_i_l og10'](\n Evaluate('function'='aboutRule(log10,log10(x))'),\n Ru nWindow('ruleWin')\n ), # end A_i_log10\n\n Action['A_i_ln'](\n E valuate('function'='aboutRule(ln,ln(x))'),\n RunWindow('ruleWin')\n ), # end A_i_ln\n\n Action['A_i_sin'](\n Evaluate('function'='ab outRule(sin,sin(x))'),\n RunWindow('ruleWin')\n ), # end A_i_sin\n \n Action['A_i_cos'](\n Evaluate('function'='aboutRule(cos,cos(x)) '),\n RunWindow('ruleWin')\n ), # end A_cos\n\n Action['A_i_tan'] (\n Evaluate('function'='aboutRule(tan,tan(x))'),\n RunWindow('r uleWin')\n ), # end A_i_tan\n\n Action['A_i_cot'](\n Evaluate('fu nction'='aboutRule(cot,cot(x))'),\n RunWindow('ruleWin')\n ), # en d A_i_cot\n\n Action['A_i_sec'](\n Evaluate('function'='aboutRule( sec,sec(x))'),\n RunWindow('ruleWin')\n ), # end A_i_sec\n\n Acti on['A_i_csc'](\n Evaluate('function'='aboutRule(csc,csc(x))'),\n \+ RunWindow('ruleWin')\n ), # end A_i_csc\n\n Action['A_i_arcsin'](\n Evaluate('function'='aboutRule(arcsin,arcsin(x))'),\n RunWindow ('ruleWin')\n ), # end A_i_arcsin\n\n Action['A_i_arccos'](\n Eva luate('function'='aboutRule(arccos,arccos(x))'),\n RunWindow('ruleW in')\n ), # end A_i_cos\n\n Action['A_i_arctan'](\n Evaluate('fun ction'='aboutRule(arctan,arctan(x))'),\n RunWindow('ruleWin')\n ), # end A_i_arctan\n\n Action['A_i_arccot'](\n Evaluate('function'= 'aboutRule(arccot,arccot(x))'),\n RunWindow('ruleWin')\n ), # end \+ A_i_arccot\n\n Action['A_i_arcsec'](\n Evaluate('function'='aboutR ule(arcsec,arcsec(x))'),\n RunWindow('ruleWin')\n ), # end A_i_arc sec\n\n Action['A_i_arccsc'](\n Evaluate('function'='aboutRule(arc csc,arccsc(x))'),\n RunWindow('ruleWin')\n ), # end A_i_arccsc\n\n Action['A_i_sinh'](\n Evaluate('function'='aboutRule(sinh,sinh(x) )'),\n RunWindow('ruleWin')\n ), # end A_i_sinh\n\n Action['A_i_c osh'](\n Evaluate('function'='aboutRule(cosh,cosh(x))'),\n RunWi ndow('ruleWin')\n ), # end A_i_cosh\n\n Action['A_i_tanh'](\n Eva luate('function'='aboutRule(tanh,tanh(x))'),\n RunWindow('ruleWin') \n ), # end A_i_tanh\n\n Action['A_i_coth'](\n Evaluate('function '='aboutRule(coth,coth(x))'),\n RunWindow('ruleWin')\n ), # end A_ i_coth\n\n Action['A_i_sech'](\n Evaluate('function'='aboutRule(se ch,sech(x))'),\n RunWindow('ruleWin')\n ), # end A_i_sech\n\n Act ion['A_i_csch'](\n Evaluate('function'='aboutRule(csch,csch(x))'), \n RunWindow('ruleWin')\n ), # end A_i_csch\n\n Action['A_i_arcsi nh'](\n Evaluate('function'='aboutRule(arcsinh,arcsinh(x))'),\n \+ RunWindow('ruleWin')\n ), # end A_i_arcsinh\n\n Action['A_i_arccosh' ](\n Evaluate('function'='aboutRule(arccosh,arccosh(x))'),\n Run Window('ruleWin')\n ), # end A_i_cosh\n\n Action['A_i_arctanh'](\n \+ Evaluate('function'='aboutRule(arctanh,arctanh(x))'),\n RunWindow ('ruleWin')\n ), # end A_i_arctanh\n\n Action['A_i_arccoth'](\n E valuate('function'='aboutRule(arccoth,arccoth(x))'),\n RunWindow('r uleWin')\n ), # end A_i_arccoth\n\n Action['A_i_arcsech'](\n Eval uate('function'='aboutRule(arcsech,arcsech(x))'),\n RunWindow('rule Win')\n ), # end A_i_arcsech\n\n Action['A_i_arccsch'](\n Evaluat e('function'='aboutRule(arccsch,arccsch(x))'),\n RunWindow('ruleWin ')\n ), # end A_i_arccsch\n\n######################################## ####################\n\n Action['A_constant'](\n Evaluate('functio n'='applyRule(constant)')\n ), # end A_constant\n \n Action['A_cons tantmultiple'](\n Evaluate('function'='applyRule(constantmultiple)' )\n ), # end A_constantmultiple\n \n Action['A_sum'](\n Evaluate ('function'='applyRule(sum)')\n ), # end A_sum\n\n Action['A_differe nce'](\n Evaluate('function'='applyRule(difference)')\n ), # end A _difference\n \n Action['A_identity'](\n Evaluate('function'='app lyRule(identity)')\n ), # end A_identity\n \n Action['A_power'](\n \+ Evaluate('function'='applyRule(power)')\n ), # end A_power\n\n Ac tion['A_product'](\n Evaluate('function'='applyRule(product)')\n ) , # end A_product\n\n Action['A_quotient'](\n Evaluate('function'= 'applyRule(quotient)')\n ), # end A_quotient\n\n Action['A_chain']( \n Evaluate('function'='applyRule(chain)')\n ), # end A_chain\n\n \+ Action['A_int'](\n Evaluate('function'='applyRule(int)')\n ), # e nd A_chain\n\n Action['A_exp'](\n Evaluate('function'='applyRule(e xp)')\n ), # end A_exp\n\n Action['A_log10'](\n Evaluate('functio n'='applyRule(log10)')\n ), # end A_log10\n\n Action['A_ln'](\n E valuate('function'='applyRule(ln)')\n ), # end A_ln\n\n Action['A_si n'](\n Evaluate('function'='applyRule(sin)')\n ), # end A_sin\n\n \+ Action['A_cos'](\n Evaluate('function'='applyRule(cos)')\n ), # e nd A_cos\n\n Action['A_tan'](\n Evaluate('function'='applyRule(tan )')\n ), # end A_tan\n\n Action['A_cot'](\n Evaluate('function'=' applyRule(cot)')\n ), # end A_cot\n\n Action['A_sec'](\n Evaluate ('function'='applyRule(sec)')\n ), # end A_sec\n\n Action['A_csc']( \n Evaluate('function'='applyRule(csc)')\n ), # end A_csc\n\n Act ion['A_arcsin'](\n Evaluate('function'='applyRule(arcsin)')\n ), # end A_arcsin\n\n Action['A_arccos'](\n Evaluate('function'='apply Rule(arccos)')\n ), # end A_cos\n\n Action['A_arctan'](\n Evaluat e('function'='applyRule(arctan)')\n ), # end A_arctan\n\n Action['A_ arccot'](\n Evaluate('function'='applyRule(arccot)')\n ), # end A_ arccot\n\n Action['A_arcsec'](\n Evaluate('function'='applyRule(ar csec)')\n ), # end A_arcsec\n\n Action['A_arccsc'](\n Evaluate('f unction'='applyRule(arccsc)')\n ), # end A_arccsc\n\n Action['A_sinh '](\n Evaluate('function'='applyRule(sinh)')\n ), # end A_sinh\n\n Action['A_cosh'](\n Evaluate('function'='applyRule(cosh)')\n ), \+ # end A_cosh\n\n Action['A_tanh'](\n Evaluate('function'='applyRul e(tanh)')\n ), # end A_tanh\n\n Action['A_coth'](\n Evaluate('fun ction'='applyRule(coth)')\n ), # end A_coth\n\n Action['A_sech'](\n \+ Evaluate('function'='applyRule(sech)')\n ), # end A_sech\n\n Acti on['A_csch'](\n Evaluate('function'='applyRule(csch)')\n ), # end \+ A_csch\n\n Action['A_arcsinh'](\n Evaluate('function'='applyRule(a rcsinh)')\n ), # end A_arcsinh\n\n Action['A_arccosh'](\n Evaluat e('function'='applyRule(arccosh)')\n ), # end A_cosh\n\n Action['A_a rctanh'](\n Evaluate('function'='applyRule(arctanh)')\n ), # end A _arctanh\n\n Action['A_arccoth'](\n Evaluate('function'='applyRule (arccoth)')\n ), # end A_arccoth\n\n Action['A_arcsech'](\n Evalu ate('function'='applyRule(arcsech)')\n ), # end A_arcsech\n\n Action ['A_arccsch'](\n Evaluate('function'='applyRule(arccsch)')\n ), # \+ end A_arccsch\n\n\n################################################### #########\n\n Action['A_u_constant'](\n Evaluate('function'='chang eUnderstoodRules(constant, CMI_constant)')\n ), # end A_u_constant\n \+ \n Action['A_u_constantmultiple'](\n Evaluate('function'='changeU nderstoodRules(constantmultiple, CMI_constantmultiple)')\n ), # end A _u_constantmultiple\n \n Action['A_u_sum'](\n Evaluate('function' ='changeUnderstoodRules(sum, CMI_sum)')\n ), # end A_u_sum\n\n Actio n['A_u_difference'](\n Evaluate('function'='changeUnderstoodRules(d ifference, CMI_difference)')\n ), # end A_u_difference\n \n Action[ 'A_u_identity'](\n Evaluate('function'='changeUnderstoodRules(ident ity, CMI_identity)')\n ), # end A_u_identity\n \n Action['A_u_power '](\n Evaluate('function'='changeUnderstoodRules(power, CMI_power)' )\n ), # end A_u_power\n\n Action['A_u_product'](\n Evaluate('fun ction'='changeUnderstoodRules(product, CMI_product)')\n ), # end A_u_ product\n\n Action['A_u_quotient'](\n Evaluate('function'='changeU nderstoodRules(quotient, CMI_quotient)')\n ), # end A_u_quotient\n\n \+ Action['A_u_chain'](\n Evaluate('function'='changeUnderstoodRules( chain, CMI_chain)')\n ), # end A_u_chain\n\n Action['A_u_int'](\n \+ Evaluate('function'='changeUnderstoodRules(int, CMI_int)')\n ), # en d A_u_chain\n\n Action['A_u_exp'](\n Evaluate('function'='changeUn derstoodRules(exp, CMI_exp)')\n ), # end A_u_exp\n\n Action['A_u_log 10'](\n Evaluate('function'='changeUnderstoodRules(log10, CMI_log10 )')\n ), # end A_u_log10\n\n Action['A_u_ln'](\n Evaluate('functi on'='changeUnderstoodRules(ln, CMI_ln)')\n ), # end A_u_ln\n\n Actio n['A_u_sin'](\n Evaluate('function'='changeUnderstoodRules(sin, CMI _sin)')\n ), # end A_u_sin\n\n Action['A_u_cos'](\n Evaluate('fun ction'='changeUnderstoodRules(cos, CMI_cos)')\n ), # end A_u_cos\n\n \+ Action['A_u_tan'](\n Evaluate('function'='changeUnderstoodRules(ta n, CMI_tan)')\n ), # end A_u_tan\n\n Action['A_u_cot'](\n Evaluat e('function'='changeUnderstoodRules(cot, CMI_cot)')\n ), # end A_u_co t\n\n Action['A_u_sec'](\n Evaluate('function'='changeUnderstoodRu les(sec, CMI_sec)')\n ), # end A_u_sec\n\n Action['A_u_csc'](\n E valuate('function'='changeUnderstoodRules(csc, CMI_csc)')\n ), # end \+ A_u_csc\n\n Action['A_u_arcsin'](\n Evaluate('function'='changeUnd erstoodRules(arcsin, CMI_arcsin)')\n ), # end A_u_arcsin\n\n Action[ 'A_u_arccos'](\n Evaluate('function'='changeUnderstoodRules(arccos, CMI_arccos)')\n ), # end A_u_cos\n\n Action['A_u_arctan'](\n Eva luate('function'='changeUnderstoodRules(arctan, CMI_arctan)')\n ), # \+ end A_u_arctan\n\n Action['A_u_arccot'](\n Evaluate('function'='ch angeUnderstoodRules(arccot, CMI_arccot)')\n ), # end A_u_arccot\n\n \+ Action['A_u_arcsec'](\n Evaluate('function'='changeUnderstoodRules( arcsec, CMI_arcsec)')\n ), # end A_u_arcsec\n\n Action['A_u_arccsc'] (\n Evaluate('function'='changeUnderstoodRules(arccsc, CMI_arccsc)' )\n ), # end A_u_arccsc\n\n Action['A_u_sinh'](\n Evaluate('funct ion'='changeUnderstoodRules(sinh, CMI_sinh)')\n ), # end A_u_sinh\n\n Action['A_u_cosh'](\n Evaluate('function'='changeUnderstoodRules( cosh, CMI_cosh)')\n ), # end A_u_cosh\n\n Action['A_u_tanh'](\n E valuate('function'='changeUnderstoodRules(tanh, CMI_tanh)')\n ), # en d A_u_tanh\n\n Action['A_u_coth'](\n Evaluate('function'='changeUn derstoodRules(coth, CMI_coth)')\n ), # end A_u_coth\n\n Action['A_u_ sech'](\n Evaluate('function'='changeUnderstoodRules(sech, CMI_sech )')\n ), # end A_u_sech\n\n Action['A_u_csch'](\n Evaluate('funct ion'='changeUnderstoodRules(csch, CMI_csch)')\n ), # end A_u_csch\n\n Action['A_u_arcsinh'](\n Evaluate('function'='changeUnderstoodRul es(arcsinh, CMI_arcsinh)')\n ), # end A_u_arcsinh\n\n Action['A_u_ar ccosh'](\n Evaluate('function'='changeUnderstoodRules(arccosh, CMI_ arccosh)')\n ), # end A_u_cosh\n\n Action['A_u_arctanh'](\n Evalu ate('function'='changeUnderstoodRules(arctanh, CMI_arctanh)')\n ), # \+ end A_u_arctanh\n\n Action['A_u_arccoth'](\n Evaluate('function'=' changeUnderstoodRules(arccoth, CMI_arccoth)')\n ), # end A_u_arccoth \n\n Action['A_u_arcsech'](\n Evaluate('function'='changeUnderstoo dRules(arcsech, CMI_arcsech)')\n ), # end A_u_arcsech\n\n Action['A_ u_arccsch'](\n Evaluate('function'='changeUnderstoodRules(arccsch, \+ CMI_arccsch)')\n ), # end A_u_arccsch\n\n Action['A']()\n\n) : # end maplet\n\nStudent:-Calculus1:-Understand(Diff,none):\nMaplets[Display ](maplet) :\n\nend use: # end use\nend proc: # end runDiffMaplet\n\n## ##########################################################\n\n\n###### ######################################################\nend module: # \+ end DiffMaplet()\nDiffMaplet:-runDiffMaplet();" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#)%\"xGF$" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#-%$expG6#*& %\"xG\"\"\"-%#lnG6#F'F(" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 " " }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 32 "Derivative Check (small exa mple)" }}{EXCHG {PARA 0 "" 0 "" {TEXT 284 36 "Click in red area and pr ess [Enter]." }{TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 1202 "# \+ Douglas Meade\nrestart:\ndiff_eval := proc( F, VAR )\n return diff( F , VAR)\nend proc:\nuse Maplets, Maplets:-Elements in\n\nDiffCheck:= Ma plet(\n\n################ window layout ################\n Window (\n 'title' = \"Derivative Evaluator\",\n [ # col\n \+ [ # row\n \"The derivative of \",\n TextField['f'](on change=SetOption('Df'=\"\")),\n \" with respect to \",\n \+ TextField['x'](width=5, onchange=SetOption('Df'=\"\"))\n ], \n [\n \"is \",\n TextField['Df'](editable=fals e)\n ],\n [ # row\n Button(\"Evaluate derivative \",\n 'onclick' = 'evaluate'\n ),\n \+ Button(\"Clear all fields\",\n 'onclick' = 'clear' \n ),\n Button(\"Close\",\n Shutd own()\n )\n ]\n ] ),\n\n################ ac tion definitions ################\n Action['clear'](\n \+ SetOption( 'x' = \"\" ),\n SetOption( 'f' = \"\" ),\n \+ SetOption( 'Df' = \"\" )\n ),\n \+ Action['evaluate'](\n Evaluate( 'Df' = 'diff_eval( f, x ) ' )\n )\n\n ):\nend use:\nMaplets:-Displa y(DiffCheck);" }}{PARA 6 "" 1 "" {TEXT -1 38 "Initializing Java runtim e environment." }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 14 "Linear Motion " }}{EXCHG {PARA 0 "" 0 "" {TEXT 285 36 "Click in red area and press \+ [Enter]." }{TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 9313 "# Doug las Meade\nrestart:\nLinMotionEval := proc( EXPR, S, V, A, t, T, old_s tr )\n local str, val1, val2;\n val1 := eval( EXPR, [ s=S, v=V, a=A \+ ] );\n val2 := eval( val1, t = T );\n str := sprintf( \"%a = %a, whe n %a = %a\", EXPR, val2, t, T );\n return str\nend proc:\nLinMotionSo lve := proc( EQN, S, V, A, t, old_str )\n local eqn, sol, str;\n eqn := eval( EQN, [ s=S, v=V, a=A ] );\n sol := solve( eqn, t );\n str \+ := sprintf( \"%a, for %a=%a\", EQN, t, \{sol\});\n return str\nend pr oc:\nLinMotionPlot := proc( S, V, A, t, T, Y, EXEC )\n local p_list, \+ c_list, s_list, ls_list, cmd;\n p_list := NULL;\n c_list := NULL;\n \+ s_list := NULL;\n ls_list := NULL;\n if S[2] then\n p_list := p_ list, S[1];\n c_list := c_list, S[3];\n if S[4]='POINT' then\n \+ s_list := s_list, S[4];\n ls_list := ls_list, 'SOLID';\n e lse\n s_list := s_list, 'LINE';\n ls_list := ls_list, S[4]; \n end if\n end if;\n if V[2] then\n p_list := p_list, V[1];\n c_list := c_list, V[3];\n if V[4]='POINT' then\n s_list := s_list, V[4];\n ls_list := ls_list, 'SOLID';\n else\n s_ list := s_list, 'LINE';\n ls_list := ls_list, V[4];\n end if\n end if;\n if A[2] then\n p_list := p_list, A[1];\n c_list := \+ c_list, A[3];\n if A[4]='POINT' then\n s_list := s_list, A[4]; \n ls_list := ls_list, 'SOLID';\n else\n s_list := s_list , 'LINE';\n ls_list := ls_list, A[4];\n end if\n end if;\n c md := sprintf( \"plot( %a, %a=%a, view=[%a,%a], color=%a, style=%a, li nestyle=%a )\",\n [p_list], t, T, T, Y, [c_list], [s _list], [ls_list] );\n if EXEC then\n return parse( cmd, statement )\n else\n return cmd\n end if\nend proc:\n_COLORS := ['blue', \+ 'cyan', 'brown', 'gold', 'green', 'khaki',\n 'mag enta', 'maroon', 'orange', 'pink', 'plum', 'red',\n ' sienna', 'tan', 'turquoise', 'violet', 'wheat', 'yellow']:\n_STYLE S := ['SOLID', 'POINT','DOT','DASHDOT']:\nuse Maplets, Maplets:-Elemen ts in\n\nLinMotion := Maplet(\n\n################ window layout ###### ##########\n Window(\n 'title' = \"Linear Motion Display and \+ Analysis\",\n BoxRow(\n 'hscroll' = as_needed,\n \+ 'vscroll' = as_needed,\n [ # c 1 - plot window and control \n [ # r 1\n Plotter['PL1']( 'height' = 500,\n \+ plot( undefined, t=0..10, view=[0..10,-10..10] \+ ) )\n ], # r 1\n [ # r 2\n GridLayout(\n \+ [ # c 1\n [ # r 1\n \"Horizonta l axis\",\n TextField['t0']( 'value' = 0, 'width' = 4 ), \n \" <= \",\n TextField['t']( 'value' = \"t \", 'width' = 4,\n 'onchange' = Action(Ev aluate('t2'='sprintf(\"%s =\",t)'),\n \+ Evaluate( 'v' = 'diff(s,t)' ),\n \+ Evaluate( 'a' = 'diff(v,t)' ) ) ),\n \+ \" <= \",\n TextField['t1']( 'value' = 10, 'widt h' = 4 )\n ], # r 1\n [ # r 2\n \+ \"Vertical axis\",\n TextField['y0']( 'value' =-10, 'widt h' = 4 ),\n \" <= \",\n TextField['y']( 'val ue' = \"y\", 'width' = 4, editable=false ),\n \" <= \",\n TextField['y1']( 'value' = 10, 'width' = 4 )\n \+ ] # r 2\n ] # c 1\n )\n ], # r 2 \n [ # r 3 - plot command\n BoxLayout( 'border' = true, 'caption' = \"Plot Commands\",\n [\n [\n TextBox['plot_cmds']( 6..30 )\n ],\n \+ [\n Button( \"Show plot command\",\n \+ 'onclick' = 'show_cmd'\n ),\n Bu tton( \"Clear plot commands\",\n 'onclick' = SetO ption( 'plot_cmds' = \" \" )\n )\n ]\n \+ ]\n )\n ], # r 3\n [ # r 4\n Button( \"Update plot\",\n 'onclick' =\n \+ Evaluate('PL1'\n = ' LinMotionPlot( [s,s_plot,s_color,s_style], [v,v_plot,v_color,v_style], [a,a_plot,a_color,a_style], t, t0..t1, y0..y1, true )')\n \+ ),\n Button( \"Reset all fields\",\n \+ 'onclick' = 'reset'\n ),\n Button( \"Close W indow\",\n Shutdown()\n )\n \+ ] # r 4\n ],\n [ # c 2 - pos, vel, acc\n [ # r 1 - position\n BoxLayout( 'border' = true, 'caption' = \"Position\",\n [\n [\n \"s :\", \n TextField['s']( 'value' = 'undefined',\n \+ 'onchange' = Action(Evaluate( 'v' = 'diff(s,t)' ),\n \+ Evaluate( 'a' = 'diff( v,t)' ) ),\n 'width' = 30 )\n \+ ],\n [\n CheckBox['s_plot']( 'value' = 'fals e', 'caption' = \"Include in plot\" ),\n \"Color:\",\n \+ ComboBox['s_color']( 'red', _COLORS ),\n \"Sty le:\",\n ComboBox['s_style']( 'SOLID', _STYLES )\n \+ ]\n ]\n )\n ], # r 1\n [ \+ # r 2 - velocity\n BoxLayout( 'border' = true, 'caption' = \+ \"Velocity\",\n [\n [\n \"v :\",\n TextField['v']( 'value' = 'undefined',\n \+ 'onchange' = Evaluate( 'a' = 'diff(v,t)' ),\n \+ 'width' = 30 )\n ],\n [\n \+ CheckBox['v_plot']( 'value' = 'false', 'caption' = \"Inclu de in plot\" ),\n \"Color:\",\n ComboBox['v_ color']( 'green', _COLORS ),\n \"Style:\",\n \+ ComboBox['v_style']( 'SOLID', _STYLES )\n ]\n \+ ]\n )\n ], # r 2\n [ # r 3 - acceleration \n BoxLayout( 'border' = true, 'caption' = \"Acceleration\", \n [\n [\n \"a :\",\n \+ TextField['a']( 'value' = 'undefined', 'width' = 30 )\n ] ,\n [\n CheckBox['a_plot']( 'value' = 'false' , 'caption' = \"Include in plot\" ),\n \"Color:\",\n \+ ComboBox['a_color']( 'blue', _COLORS ),\n \"Styl e:\",\n ComboBox['a_style']( 'SOLID', ['SOLID', 'POINT',' DOT','DASH','DASHDOT'] )\n ]\n ]\n ) \n ], # r 3\n [ # r 4 - evaluate or solve\n \+ BoxLayout( 'border' = true, 'caption' = \"Evaluate and Analyze\",\n [\n [\n \"Evaluate the expression (use s, v, a)\",\n TextField['expr']( 'value' = \"\", 'w idth' = 15 ),\n \"at \",\n TextField['t2']( \+ 'value' = \"t = \", width=3, editable=false ),\n TextFiel d['t_value']( 'value' = \"\", 'width' = 5 )\n ],\n \+ [\n \"Enter equation to be solved (use s, v, a):\", \n TextField['eqn']( 'value' = \"\", 'width' = 20 )\n \+ ],\n [\n TextBox['results']( 6..30, \+ \"\",\n 'editable' = false )#, 'quote dtext' = true )\n ],\n [\n Button ( \"Evaluate expression at given value\",\n 'oncl ick' = 'eval_expr'\n ),\n Button( \"At tempt to solve equation\",\n 'onclick' = 'solve_e qn'\n ),\n Button( \"Clear results\", \n 'onclick' = SetOption( 'results' = '\"\"' )\n \+ )\n ]\n ]\n )\n \+ ] # end r 4\n ] # end c 2\n )\n ),\n\n### ############# action definitions ################\n Action['rese t'](\n SetOption( 't0' = 0 ),\n SetOption( 't1' = 10 ), \n SetOption( 'y0' =-10 ),\n SetOption( 'y1' = 10 ),\n \+ SetOption( 's' = 'undefined' ),\n SetOption( 'v' = 'und efined' ),\n SetOption( 'a' = 'undefined' ),\n SetOptio n( 's_plot' = false ),\n SetOption( 'v_plot' = false ),\n \+ SetOption( 'a_plot' = false ),\n SetOption( 's_color' = \"red \" ),\n SetOption( 'v_color' = \"green\" ),\n SetOption( 'a_color' = \"blue\" ),\n SetOption( 's_style' = \"SOLID\" ), \n SetOption( 'v_style' = \"SOLID\" ),\n SetOption( 'a_s tyle' = \"SOLID\" ),\n SetOption( 'plot_cmds' = \" \" ),\n \+ SetOption( 'expr' = \"\" ),\n SetOption( 't_value' = \"\" ), \n SetOption( 'eqn' = \"\" ),\n SetOption( 'results' = \+ \"\" ),\n SetOption( 't' = \"t\" ),\n SetOption( 't2' = \+ \"t = \" ),\n NULL \n ),\n Action['s how_cmd'](\n Evaluate( 'plot_cmds'\n = 'LinM otionPlot( [s,s_plot,s_color,s_style],\n \+ [v,v_plot,v_color,v_style],\n \+ [a,a_plot,a_color,a_style],\n \+ t, t0..t1, y0..y1, false )' )\n ),\n A ction['eval_expr'](\n Evaluate( 'results'\n \+ = 'LinMotionEval( expr, s, v, a, t, t_value )' )\n \+ ),\n Action['solve_eqn'](\n Evaluate( 'results'\n \+ = 'LinMotionSolve( eqn, s, v, a, t )' )\n \+ )\n):\n\nend use:\nMaplets:-Display(LinMotion);\n" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 22 "Function Analyzer--Bug" }}{EXCHG {PARA 0 "" 0 "" {TEXT 269 36 "Click in red area and press [Enter]." }{TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 17248 "# FunctionAnalyzer Maplet \n# Copyright 2002 Douglas B. Meade\n# \n# The FunctionAnalyzer maplet provides a convenient user interface for the analysis necessary to pr epare the graph of a function. Of course, the plot can be obtained wit h the Maplet, the purpose is to provide support for gathering the info rmation needed to produce a sketch of the plot by hand.\n# \n# The use r enters a function (y) to be analyzed, the Maplet determines the firs t (Dy) and second derivative (D2y) of this function. Sign plots and or dinary plots for any combination of the function and its first two der ivatives can be produced. User-specified expressions involving y, Dy, \+ D2y, and the independent variable can be evaluated or solved.\n# \n# T o run this maplet, click the Execute (!!!) button in the context bar. \n# \nrestart;\n# #################################################### ########\n# \n# Supporting procedures for the Maplet\n# \n# ########## ##################################################\nFuncAnalEval := pr oc( EXPR, f, Df, D2f, t, T, cmd )\n local str, val1, val2;\n try\n \+ val1 := eval( EXPR, [ y=f, Dy=Df, D2y=D2f ] );\n val2 := eval( va l1, t = T );\n if nargs>6 then\n if cmd=\"simplify\" then val2 := simplify( val2 ) end if;\n if cmd=\"normal\" then val2 := n ormal( val2 ) end if;\n if cmd=\"expand\" then val2 := expand( \+ val2 ) end if;\n if cmd=\"evalf\" then val2 := evalf( val2 ) e nd if;\n end if;\n str := sprintf( \"%a = %a, when %a = %a\", EX PR, val2, t, T );\n catch:\n str := \"Error during evaluation, ple ase check and retry.\";\n end try;\n return str\nend proc:\nFuncAnal Solve := proc( EQN, f, Df, D2f, t, cmd )\n local eqn, sol, str;\n tr y\n eqn := eval( EQN, [ y=f, Dy=Df, D2y=D2f ] );\n sol := \{ sol ve( eqn, t ) \};\n if nargs>5 then\n if cmd=\"simplify\" then \+ sol := simplify( sol ) end if;\n if cmd=\"normal\" then sol := \+ normal( sol ) end if;\n if cmd=\"expand\" then sol := expand( s ol ) end if;\n if cmd=\"evalf\" then sol := evalf( sol ) end i f;\n end if;\n str := sprintf( \"%a, for %a=%a\", EQN, t, sol); \n catch:\n str := \"Error during solve, please check and retry.\" ;\n end try;\n return str\nend proc:\nSignPlot := proc( f, dom, desc , Y, C )\n local neg_part, pos_part, P1, P2, x, xhi, xlo;\n pos_part := proc( f, y )\n if nargs=1 then y := 1 end if;\n if type(f,nu meric) then\n return `if`(signum(f)=1,y,undefined)\n else\n \+ return 'procname'( 'args' )\n end if\n end proc:\n neg_part := proc( f, y )\n if nargs=1 then y := 1 end if;\n if type(f,numer ic) then\n return `if`(signum(f)=-1,y,undefined)\n else\n \+ return 'procname'( 'args' )\n end if\n end proc:\n x, xlo, xhi : = lhs(dom), op(evalf(rhs(dom)));\n P1 := plot( [pos_part(f,Y),neg_par t(f,Y)], dom, color=C, thickness=3 );\n P2 := plots[textplot]( [(xlo+ 39*xhi)/40, Y, desc], align=ABOVE );\n return plots[display]( [P1, P2 ] );\nend proc:\nFuncAnalPlot := proc( f, Df, D2f, t, T, Y, EXEC )\n \+ local p_list, c_list, s_list, ls_list, cmd, hi, lo, P_fns, P_Df_sign, \+ P_D2f_sign;\n p_list := NULL;\n c_list := NULL;\n s_list := NULL;\n ls_list := NULL;\n if f[2] then\n p_list := p_list, f[1];\n c _list := c_list, f[3];\n if f[4]='POINT' then\n s_list := s_li st, f[4];\n ls_list := ls_list, 'SOLID';\n else\n s_list \+ := s_list, 'LINE';\n ls_list := ls_list, f[4];\n end if\n end if;\n if Df[2] then\n p_list := p_list, Df[1];\n c_list := c_l ist, Df[3];\n if Df[4]='POINT' then\n s_list := s_list, Df[4]; \n ls_list := ls_list, 'SOLID';\n else\n s_list := s_list , 'LINE';\n ls_list := ls_list, Df[4];\n end if\n end if;\n \+ if D2f[2] then\n p_list := p_list, D2f[1];\n c_list := c_list, D 2f[3];\n if D2f[4]='POINT' then\n s_list := s_list, D2f[4];\n \+ ls_list := ls_list, 'SOLID';\n else\n s_list := s_list, ' LINE';\n ls_list := ls_list, D2f[4];\n end if\n end if;\n\n \+ try\n if p_list<>NULL then\n cmd := sprintf( \"plot( %a, %a=%a , view=[%a,%a], color=%a, style=%a, linestyle=%a )\",\n \+ [p_list], t, T, T, Y, [c_list], [s_list], [ls_list] );\n el se\n cmd := sprintf( \"plot( 'undefined', %a=%a, view=[%a,%a] )\" , t, T, T, Y );\n end if;\n P_fns := parse( cmd, statement );\n \+ lo,hi := op(Y);\n P_Df_sign := NULL;\n P_D2f_sign := NULL;\n \+ if Df[5] then\n P_Df_sign := SignPlot( Df[1], t=T, `y'`, lo+(h i-lo)/10, Df[6] )\n end if;\n if D2f[5] then\n P_D2f_sign : = SignPlot( D2f[1], t=T, `y''`, lo+(hi-lo)/20, D2f[6] )\n end if;\n return plots[display]( [P_fns, P_Df_sign, P_D2f_sign] )\n catch: \n return NULL\n end try;\nend proc:\n_COLORS := ['blue', 'cyan ', 'brown', 'gold', 'green', 'khaki',\n 'magenta', \+ 'maroon', 'orange', 'pink', 'plum', 'red',\n 'sienna' , 'tan', 'turquoise', 'violet', 'wheat', 'yellow']:\n_STYLES := [' SOLID', 'POINT','DOT','DASH','DASHDOT']:\n# ########################## ##################################\n# \n# Definition of the Maplet\n# \+ \n# ############################################################\nuse \+ Maplets, Maplets:-Elements in\n\nFunctionAnalyzer := Maplet(\n\n###### ########## window layout ################\n Window(\n 'title' = \"Graphical Function Analysis\",\n BoxRow(\n 'hscroll' = as_needed,\n 'vscroll' = as_needed,\n [ # c 1 - p lot window and control\n [ # r 1\n Plotter['PL1']( 'height' = 400,\n plot(undefined,x=-10..10, view=[-10..10,-10..10]) )\n ], # r 1\n [ # r 2 - pl ot command\n BoxLayout( 'border'=true, 'caption'=\"Evaluate \+ Expression\",\n [\n [\n \"Evaluate the expression (use y, Dy, D2y)\",\n TextField['expr']( \+ 'value'=\"\", 'width'=15 )\n ],\n [\n \+ \"when the independendent variable (\",\n TextField[ 'X2']( 'value'=\"x\",\n 'width'=3,\n \+ 'editable'=false ),\n \") has \+ the value\",\n TextField['x_value']( 'value'=\"\",\n \+ 'width'=5 )\n ],\n \+ [\n TextBox['result_eval']( 3..30,\n \+ \"\",\n 'pop upmenu' = 'PM_eval',\n 'editable' = false )\n ],\n [\n Button( \"E valuate expression at specified value\",\n 'oncli ck'='eval_expr'\n )\n ]\n ] \n )\n ], # r 2\n [ # r 3\n B utton( \"Update plot\",\n 'onclick' =\n \+ Evaluate('PL1'\n = 'FuncAnalPlot ( [y,y_plot,y_color,y_style], [Dy,Dy_plot,Dy_color,Dy_style,Dy_sign,[D y_pos,Dy_neg]], [D2y,D2y_plot,D2y_color,D2y_style,D2y_sign,[D2y_pos,D2 y_neg]], X, X0..X1, Y0..Y1, true )')\n ),\n \+ Button( \"Reset all fields\",\n 'onclick' = 'reset' \n ),\n Button( \"Close Window\",\n \+ Shutdown()\n )\n ] # r 3\n \+ ],\n [ # c 2 - y, Dy, D2y\n [ # r 1 - function\n \+ BoxLayout( 'border'=true, 'caption'=\"Function\",\n \+ [\n [\n \"y = \",\n TextField[ 'y']('value'='undefined',\n 'popupmenu'='P M_y',\n 'onchange'=Action(Evaluate( 'Dy' \+ = 'diff( y,X)' ),\n Eval uate( 'D2y' = 'diff(Dy,X)' ) ),\n 'width'= 30 )\n ],\n [\n CheckBox['y_plot' ]( 'value'=false, 'caption'=\"Include in plot\" ),\n \"Co lor:\",\n ComboBox['y_color']( 'magenta', _COLORS ),\n \+ \"Style:\",\n ComboBox['y_style']( 'SOLID', _S TYLES )\n ],\n [ # r 2\n GridLay out(\n [ # c 1\n [ # r 1\n \+ \"Horizontal axis\",\n TextField['X0']( 'value'=- 10, 'width'=4 ),\n \" <= \",\n TextFie ld['X']( 'value'=\"x\", 'width'=4,\n ' onchange'='new_indep_var' ),\n \" <= \", \n \+ TextField['X1']( 'value'=10, 'width'=4 ),\n# ], # \+ r 1\n# [ # r 2\n \" Vertical axi s\",\n TextField['Y0']( 'value'=-10, 'width'=4 ),\n \+ \" <= \",\n TextField['Y']( 'value'=\"y \", 'width'=4 ),\n \" <= \",\n TextFie ld['Y1']( 'value'= 10, 'width'=4 )\n ] # r 2\n \+ ] # c 1\n )\n ] # r 2\n \+ ]\n )\n ], # r 1\n [ # r 2 - 1st derivati ve\n BoxLayout( 'border'=true, 'caption'=\"First Derivative \",\n [\n [\n \"y' = Dy =\",\n \+ TextField['Dy']( 'value'='undefined',\n \+ 'popupmenu'='PM_Dy',\n 'onchan ge'=Action(Evaluate( 'y' = 'undefined' ),\n \+ Evaluate( 'D2y'='diff(Dy,X)' )\n \+ ),\n 'wi dth'=30 )\n ],\n [\n CheckBox['Dy _plot']( 'value'=false, 'caption'=\"Include in plot\" ),\n \+ \"Color:\",\n ComboBox['Dy_color']( 'gold', _COLORS ), \n \"Style:\",\n ComboBox['Dy_style']( 'SOLI D', _STYLES )\n ],\n [\n CheckBox ['Dy_sign']( 'value'=false, 'caption'=\"Show sign chart\" ),\n \+ \"Colors: increasing:\",\n ComboBox['Dy_pos']( 'red ', _COLORS ),\n \"decreasing:\",\n ComboBox[ 'Dy_neg']( 'blue', _COLORS )\n ]\n ]\n \+ )\n ], # r 2\n [ # r 3 - 2nd derivative\n \+ BoxLayout( 'border'=true, 'caption'=\"Second Derivative\",\n \+ [\n [\n \"y'' = D2y =\",\n \+ TextField['D2y']( 'value'='undefined',\n \+ 'popupmenu'='PM_D2y',\n 'width'=30 ) \n ],\n [\n CheckBox['D2y_plot']( 'value'=false, 'caption'=\"Include in plot\" ),\n \"Colo r:\",\n ComboBox['D2y_color']( 'cyan', _COLORS ),\n \+ \"Style:\",\n ComboBox['D2y_style']( 'SOLID', _ST YLES )\n ],\n [\n CheckBox['D2y_s ign']( 'value'=false,\n 'caption'= \"Show sign chart\" ),\n \"Colors: concave up:\",\n \+ ComboBox['D2y_pos']( 'green', _COLORS ),\n \"conc ave down:\",\n ComboBox['D2y_neg']( 'orange', _COLORS )\n ]\n ]\n )\n ], # r 3\n \+ [ # r 4 - evaluate or solve\n BoxLayout( 'border'=true ,\n 'caption'=\"Solve an Equation or Inequality\" ,\n [\n [\n \"Enter equation to be solved (use y, Dy, D2y):\",\n TextField['eqn']( 'value'= \"\", 'width'=20 )\n ],\n [\n Tex tBox['result_solve']( 3..30,\n \+ \"\",\n 'popupmenu' = 'PM_solve' ,\n 'editable'=false )#, 'quoted text' = true )\n ],\n [\n Button( \"Attempt to solve equation\",\n 'onclick'='solv e_eqn'\n )\n ]\n ]\n \+ )\n ] # r 4\n ]\n )\n ), # end Wind ow\n\n################ action definitions ################\n Act ion['reset'](\n SetOption( 'X0' =-10 ),\n SetOption( 'X1 ' = 10 ),\n SetOption( 'Y0' =-10 ),\n SetOption( 'Y1' = \+ 10 ),\n SetOption( 'Y' = \"y\" ),\n SetOption( 'y' = 'u ndefined' ),\n SetOption( 'Dy' = 'undefined' ),\n SetOp tion( 'D2y' = 'undefined' ),\n SetOption( 'y_plot' = false ), \n SetOption( 'Dy_plot' = false ),\n SetOption( 'D2y_plo t' = false ),\n SetOption( 'y_color' = \"magenta\" ),\n \+ SetOption( 'Dy_color' = \"gold\" ),\n SetOption( 'D2y_color' = \+ \"cyan\" ),\n SetOption( 'y_style' = \"SOLID\" ),\n SetO ption( 'Dy_style' = \"SOLID\" ),\n SetOption( 'D2y_style' = \"S OLID\" ),\n SetOption( 'Dy_sign' = false ),\n SetOption( 'D2y_sign' = false ),\n SetOption( 'Dy_neg' = blue ),\n \+ SetOption( 'D2y_neg' = orange ),\n SetOption( 'Dy_pos' = red ) ,\n SetOption( 'D2y_pos' = green ),\n SetOption( 'result _eval' = \" \" ),\n SetOption( 'expr' = \"\" ),\n SetOpt ion( 'x_value' = \"\" ),\n SetOption( 'eqn' = \"\" ),\n \+ SetOption( 'result_solve' = \"\" ),\n SetOption( 'X' = \"x\" ), \n SetOption( 'X2' = \"x = \" ),\n NULL \n \+ ),\n\n Action['show_cmd'](\n Evaluate( 'plot_cmds '\n = 'FuncAnalPlot(\n [y,y_p lot,y_color,y_style],\n [Dy,Dy_plot,Dy_color,Dy_ style,Dy_sign,\n [Dy_pos,Dy_neg]],\n \+ [D2y,D2y_plot,D2y_color,D2y_style,D2y_sign,\n \+ [D2y_pos,D2y_neg]],\n X, X0..X1, Y0 ..Y1, false )' )\n ),\n\n Action['eval_expr'](\n \+ Evaluate('result_eval'='FuncAnalEval( expr, y, Dy, D2y, X, x_va lue )')\n ),\n\n Action['solve_eqn'](\n Evaluate('result_solve'='FuncAnalSolve( eqn, y, Dy, D2y, X )') \n ),\n\n Action['new_indep_var'](\n# \+ Evaluate('X2'='sprintf(\"%s =\",X)'),\n Evaluate('X2' = ' X' ),\n Evaluate('Dy' = 'diff(y,X)' ),\n Evaluate('D2y' \+ = 'diff(y,X$2)' )\n ),\n\n############### # popup menu definitions ################\n PopupMenu['PM_y'](\n Menu(\"Manipulate\",\n MenuItem(\"simplify\",\n \+ Evaluate('y'='simplify(y)')),\n MenuItem(\"normal\" ,\n Evaluate('y'='normal(y)')),\n MenuItem(\" expand\",\n Evaluate('y'='expand(y)')),\n Men uItem(\"convert to floating-point\",\n Evaluate('y'=' map(evalf,y)')),\n NULL\n ),\n MenuSeparator(), \n MenuItem(\"Clear Field\",\n SetOption('y'=\" \"))\n ),\n\n PopupMenu['PM_Dy'](\n Menu(\"Manipul ate\",\n MenuItem(\"simplify\",\n Evaluate('D y'='simplify(Dy)')),\n MenuItem(\"normal\",\n \+ Evaluate('Dy'='normal(Dy)')),\n MenuItem(\"expand\",\n \+ Evaluate('Dy'='expand(Dy)')),\n MenuItem(\"convert \+ to floating-point\",\n Evaluate('Dy'='map(evalf,Dy)') ),\n NULL\n ),\n MenuSeparator(),\n Menu Item(\"Clear Field\",\n SetOption('Dy'=\"\"))\n \+ ),\n\n PopupMenu['PM_D2y'](\n Menu(\"Manipulate\",\n \+ MenuItem(\"simplify\",\n Evaluate('D2y'='simplif y(D2y)')),\n MenuItem(\"normal\",\n Evaluate( 'D2y'='normal(D2y)')),\n MenuItem(\"expand\",\n \+ Evaluate('D2y'='expand(D2y)')),\n MenuItem(\"convert to flo ating-point\",\n Evaluate('D2y'='map(evalf,D2y)')),\n NULL\n ),\n MenuSeparator(),\n MenuItem (\"Clear Field\",\n SetOption('D2y'=\"\"))\n ), \n\n PopupMenu['PM_eval'](\n Menu(\"Manipulate Results\",\n \+ MenuItem(\"simplify\",\n Evaluate( 'result_eval' \n = 'FuncAnalEval( expr, y, Dy, D2y, X, x_value, \"s implify\" )' )),\n MenuItem(\"normal\",\n Eva luate( 'result_eval'\n = 'FuncAnalEval( expr, y, Dy, \+ D2y, X, x_value, \"normal\" )' )),\n MenuItem(\"expand\",\n \+ Evaluate( 'result_eval'\n = 'FuncAnalE val( expr, y, Dy, D2y, X, x_value, \"expand\" )' )),\n MenuIte m(\"evalf\",\n Evaluate( 'result_eval'\n \+ = 'FuncAnalEval( expr, y, Dy, D2y, X, x_value, \"evalf\" )' ))\n \+ ),\n MenuSeparator(),\n MenuItem(\"Clear Field\",\n \+ SetOption( 'result_eval' = \"\" ))\n ),\n\n PopupMenu[' PM_solve'](\n Menu(\"Manipulate Results\",\n MenuItem(\"s implify\",\n Evaluate( 'result_solve'\n \+ = 'FuncAnalSolve( eqn, y, Dy, D2y, X, \"simplify\" )' )), \n MenuItem(\"normal\",\n Evaluate( 'result_s olve'\n = 'FuncAnalSolve( eqn, y, Dy, D2y, X , \"normal\" )' )),\n MenuItem(\"expand\",\n \+ Evaluate( 'result_solve'\n = 'FuncAnalSolve( eqn, y, Dy, D2y, X, \"expand\" )' )),\n MenuItem(\"evalf\",\n Evaluate( 'result_solve'\n \+ = 'FuncAnalSolve( eqn, y, Dy, D2y, X, \"evalf\" )' ))\n ),\n \+ MenuSeparator(),\n MenuItem(\"Clear Field\",\n Se tOption( 'result_solve' = \"\" ))\n )\n\n):\n\nend use:\n# ######### ###################################################\n# \n# Launch the \+ Maplet\n# \n# ######################################################## ####\nMaplets:-Display(FunctionAnalyzer):\n\n\n\n" }}{PARA 8 "" 1 "" {TEXT -1 122 "Error, (in Maplets:-Elements:-Maplet) reference plot_cmd s used as the 'target' attribute of a Evaluate element is missing\n" } }{PARA 8 "" 1 "" {TEXT -1 149 "Error, (in Maplets:-Display) invalid in put: Maplets:-Display expects its 1st argument, maplet, to be of type \+ function, but received FunctionAnalyzer\n" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 19 "Mean Valu e Theorem " }}{EXCHG {PARA 0 "" 0 "" {TEXT 270 36 "Click in red area a nd press [Enter]." }{TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 10244 "# Mean Value Theorem Maplet\n# Copyright 2002 Waterloo Maple In c.\n# \n# This maplet illustrates the Mean Value Theorem applied to sp ecific functions the user enters.\n# \n# The Mean Value Theorem states that if f is continuous on [a, b] and differentiable on (a, b), then \+ there is a number c in (a, b) such that f'(c) = (f(b)-f(a))/(b-a) .\n# \n# The user enters a differentiable function f(x) and a range [a, b] . The maplet computes all points c in (a,b) for which f'(c) = (f(b)-f( a))/(b-a). The graph of the function from a to b, the secant line from [a, f(a)] to [b, f(b)], and the tangent line(s) at all points [c, f(c )] are displayed in the plotter window. The algebraic and numerical va lues of each value of c are displayed in the text fields. \n# \n# To r un this maplet, click the Execute (!!!) button in the context bar.\n# \+ \nrestart;\nMeanValueMaplet := module()\n\n########################### #################################\n\nexport getMeanValuePlot, runMeanV alueMaplet:\nlocal helpStr, algStr, numStr, getAlgStr, getNumStr:\n\n# ###########################################################\n\n\n##### #######################################################\n\nhelpStr := \+ \n\"This maplet illustrates the Mean Value Theorem applied to specific functions you enter.\n\nThe Mean Value Theorem states that if f is co ntinuous on [a, b] and differentiable on (a, b), then there is a numbe r c in (a, b) such that f'(c) = (f(b)-f(a))/(b-a).\n\nEnter a differen tiable function f(x) and a range [a, b]. The maplet computes all point s c in (a,b) for which f'(c) = (f(b)-f(a))/(b-a). The graph of the fun ction from a to b, the secant line from [a, f(a)] to [b, f(b)], and th e tangent lines at all points [c, f(c)] are displayed in the plotter w indow. The algebraic and numerical values of each value of c are displ ayed in the text fields.\":\n\n####################################### #####################\n\ngetAlgStr:=proc()\nalgStr;\nend proc:\n\ngetN umStr:=proc()\nnumStr;\nend proc:\n################################### #########################\n\ngetMeanValuePlot := proc(boo1, boo2, boo3 , boo4, P_fun, P_a, P_b, P_x1, P_x2, P_y1, P_y2)\n\n local temp, temp 2, str, view:\n \n use Maplets:-Tools, Student:-Calculus1, StringTool s in\n\n str:=Trim(P_fun):\n if str=\"\" then \n error \"No function entered\":\n end if:\n\n temp:=Trim(P_a):\n temp2:= Trim(P_b):\n if temp=\"\" or temp2=\"\" then\n error \"No end \+ point entered\":\n end if:\n str:=cat(str, \", \", temp, \"..\", temp2):\n\n algStr := MeanValueTheorem(eval(parse(str)), output=po ints):\n numStr := evalf(MeanValueTheorem(eval(parse(str)), output= points, numeric=true),3):\n\n if not(boo1 or boo2 or boo3 or boo4) \+ then \n return plots[textplot]([1,1,\"Select function, secant lin e, points, or tangent lines\"]):\n end if: \n\n if not boo1 then str := cat(str, \", showfunction=false\") end if:\n if not boo2 th en str := cat(str, \", showline=false\") end if:\n if not boo3 then str := cat(str, \", showpoints=false\") end if:\n if not boo4 then str := cat(str, \", showtangents=false\") end if: \n\n view := [\" DEFAULT\",\"DEFAULT\"]:\n\n temp:=Trim(P_x1):\n temp2:=Trim(P_x2 ):\n if temp<>\"\" and temp2<>\"\" then\n view[1]:=cat(temp, \+ \"..\", temp2):\n end if: \n\n temp:=Trim(P_y1):\n temp2:=Tri m(P_y2):\n if temp<>\"\" and temp2<>\"\" then\n view[2]:=cat(t emp, \"..\", temp2):\n end if: \n\n temp:=cat(\", view=[\", view [1], \", \", view[2], \"]\"):\n str := cat(str, temp):\n\n MeanV alueTheorem(eval(parse(str)), output=plot, title=\" \"):\n\n end use: \n\nend proc:\n\n#################################################### ########\n\n\n######################################################## ####\n\nrunMeanValueMaplet := proc()\n\nlocal maplet:\nuse Maplets:-El ements in\n\n######################################################### ###\n\nmaplet := Maplet( \n 'onstartup'=RunWindow('mainWin'),\n\n#### ########################################################\n\n Font['F1 ']('family'=\"Default\", 'bold'='true', 'italic'='true'),\n Font['F2' ]('family'=\"Default\", 'bold'='true', 'size'=14),\n\n################ ############################################\n\n MenuBar['MB'](\n \+ Menu(\"File\", \n MenuItem(\"Plot\", \n 'onclick'='A_plot' ),\n MenuSeparator(),\n MenuItem(\"Close\", 'onclick'=Shutd own())\n ), # end Menu/File\n Menu(\"Help\", \n MenuItem(\" Using this Maplet\", 'onclick'=RunWindow('helpWin'))\n ) # end menu /Help\n ), # end MenuBar \n\n######################################## ####################\n\n Window['mainWin']('resizable'='false', 'widt h'=785, 'height'=555,\n 'title'=\"Calculus 1 - Mean Value Theorem\" ,\n 'menubar'='MB', 'defaultbutton'='B_plot', \n \n BoxColumn ('inset'=0, 'spacing'=0, 'background'=\"#DDFFFF\", \n\n BoxRow(' inset'=0, 'spacing'=0, 'background'=\"#DDFFFF\", \n 'border'= 'true', 'caption'=\"Enter a function and the end points\", \n \+ Label(\"Function \", 'font'='F2', 'background'=\"#DDFFFF\"), \n \+ TextField['TF_fun']('width'=20, 'background'=\"#EEFFFF\", \n \+ 'tooltip'=\"Continuous on [a,b], differentiable on (a,b)\",\n \+ 'value'=sin(x)),\n Label(\" a \", 'font'='F2', 'bac kground'=\"#DDFFFF\"), \n Label(\" = \", 'font'='F1', 'backgr ound'=\"#DDFFFF\"), \n TextField['TF_a']('value'=0, 'width'=2 , 'background'=\"#EEFFFF\", \n 'tooltip'=\"Lower end point \"),\n Label(\" b \", 'font'='F2', 'background'=\"#DDFFFF\"), \n Label(\" = \", 'font'='F1', 'background'=\"#DDFFFF\"), \n TextField['TF_b']('value'=7, 'width'=2, 'background'=\"#EEFF FF\", \n 'tooltip'=\"Upper end point\")\n ), # end Box Row \n \n BoxRow('inset'=0, 'spacing'=0, 'background'=\"#DDFFFF\" ,\n BoxColumn('inset'=0, 'spacing'=0, 'background'=\"#DDFFFF\", \+ \n 'border'='true', 'caption'=\"Plot Window\", \n Plotte r['P']('background'=\"#EEFFFF\", 'width'=300, 'height'=400)\n ), \+ #end BoxColumn\n\n BoxColumn('inset'=0, 'spacing'=0, 'background '=\"#DDFFFF\", \n BoxColumn('inset'=0, 'spacing'=0, 'ba ckground'=\"#DDFFFF\",\n 'border'='true', 'caption'=\"Values of c such that f'(c) = (f(b) - f(a)) / (b - a)\", \n BoxR ow('inset'=0, 'spacing'=0, 'background'=\"#DDFFFF\",\n Label( \"Algebraic: \"),\n TextBox['TF_alg']('width'=22, 'background '=\"#EEFFFF\", 'editable'=false, 'value'=\" \")),\n BoxRow('inset '=0, 'spacing'=0, 'background'=\"#DDFFFF\",\n Label(\"Numeric : \"),\n TextField['TF_num']('width'=22, 'background'=\"#EEFF FF\", 'editable'=false, 'value'=\" \")\n ) ), # end BoxRow\n\n \+ BoxColumn('inset'=0, 'spacing'=0, 'background'=\"#DDFFFF\", \n \+ 'border'='true', 'caption'=\"Display Options\", \n \n \+ BoxRow('inset'=0, 'spacing'=0, 'background'=\"#DDFFFF\", \n \+ CheckBox[CB1]('value'=true, 'background'=\"#DDFFFF\", \n \+ 'caption'=\"Show function\" \n ), # end CheckBox\n \+ CheckBox[CB2]('value'=true, 'background'=\"#DDFFFF\", \n \+ 'caption'=\"Show secant line\" \n ) # end CheckB ox \n ), # end Box Row\n BoxRow('inset'=0, 'spaci ng'=0, 'background'=\"#DDFFFF\", \n CheckBox[CB3]('value'=t rue, 'background'=\"#DDFFFF\", \n 'caption'=\"Show points \" \n ), # end CheckBox\n CheckBox[CB4]('valu e'=true, 'background'=\"#DDFFFF\", \n 'caption'=\"Show ta ngent line\" \n ) # end CheckBox\n ), # end Box \+ Row\n\n BoxRow('inset'=0, 'spacing'=0, 'background'=\"#DDFFFF\", \n Label(\"x\", 'font'='F2', 'background'=\"#DDFFFF\"), \n \+ Label(\" = \", 'font'='F1', 'background'=\"#DDFFFF\"),\n \+ TextField['x1'](2, 'background'=\"#EEFFFF\", 'value'=\" \"), \+ \n Label(\"..\", 'font'='F2', 'background'=\"#DDFFFF\"),\n \+ TextField['x2'](2, 'background'=\"#EEFFFF\", 'value'=\" \") ,\n Label(\" y\", 'font'='F2', 'background'=\"#DDFFFF\"), \+ \n Label(\" = \", 'font'='F1', 'background'=\"#DDFFFF\"),\n TextField['y1'](2, 'background'=\"#EEFFFF\", 'value'=\" \" ),\n Label(\"..\", 'font'='F2', 'background'=\"#DDFFFF\"), \n TextField['y2'](2, 'background'=\"#EEFFFF\", 'value'=\" \+ \") \n ) # end BoxRow\n), # end BoxRow \n\n BoxRow('in set'=0, 'spacing'=2, 'background'=\"#DDFFFF\",\n 'halign'=c enter, \n Button['B_plot'](\" Plot \", 'background'=\"#CC FFFF\", \n 'onclick'='A_plot' \n ), # end Butt on\n Button(\"Close\", 'background'=\"#CCFFFF\", Shutdown() ) \n ) # end BoxRow\n\n ) # end BoxColumn\n )) \n ), \+ # end Window\n\n###################################################### ######\n\n Window['helpWin']( 'resizable'='false',\n 'title'=\"Usi ng the Mean Value Theorem Maplet\",\n BoxColumn('border'='true', 'i nset'=0, 'spacing'=10,\n 'background'=\"#CCFFFF\",\n BoxCell (\n TextBox('height'=12, 'width'=28,\n 'background'=\" #DDFFFF\", 'foreground'=\"#333399\", \n 'editable'='false', ' font'='F2', \n 'value'=helpStr\n ) # end TextBox\n \+ ), # end BoxCell\n BoxRow('inset'=0, 'spacing'=0, 'background'= \"#CCFFFF\",\n Button(\"Close\", CloseWindow('helpWin '), \n 'background'=\"#DDFFFF\")\n ) # end BoxRow\n ) # end BoxColumn\n ), # end helpWin\n\n############################# ###############################\n Action['A_plot']\n ( Evaluate\n \+ ( 'waitforresult'='false', 'function'='getMeanValuePlot',\n 't arget'='P',\n Argument('CB1'),\n Argument('CB2'),\n \+ Argument('CB3'),\n Argument('CB4'),\n Argument('TF_fu n', quotedtext='true'),\n Argument('TF_a', quotedtext='true'), \n Argument('TF_b', quotedtext='true'),\n Argument('x1', quotedtext='true'),\n Argument('x2', quotedtext='true'),\n \+ Argument('y1', quotedtext='true'),\n Argument('y2', quotedt ext='true')\n ),\n\n Evaluate\n ( 'waitforresult'='false', ' function'='getNumStr',\n 'target'='TF_num'\n ),\n Evaluate \n ( 'waitforresult'='false', 'function'='getAlgStr',\n 'tar get'='TF_alg'\n ) \n \n )\n\n\n): # end Maplet\n\n################ ############################################\n\nMaplets:-Display(maple t):\n\nend use: # end use\nend proc: # end proc\n\n################### #########################################\n\nend module: # end MeanVal ueMaplet\nMeanValueMaplet:-runMeanValueMaplet();" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 15 "New ton's Method" }}{EXCHG {PARA 0 "" 0 "" {TEXT 271 36 "Click in red area and press [Enter]." }{TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 11257 "# Newton's Method Maplet\n# Copyright 2002 Waterloo Maple Inc. \n# \n# This maplet applies Newton's method for approximating a root o f a function. \n# \n# Instructions\n# \n# The user enters a function f (x), an initial approximation x[0] of a root of f(x) and the number of repetitions (default 5). When you click the 'Plot' button, the maple t applies Newton's method to improve the approximation by finding the \+ x-intercept x[i+1] of the line tangent to f(x) at [x[i], f(x[i])]: \n# f(x[i])\n# x[i+1] = x[i] - --------\n# \+ f'(x[i])\n# \n# The values of x[i] are shown numerically in th e display window and graphically in the plotter window.\n# \n# To run \+ this maplet, click the !!! button in the tool bar.\n# \nrestart;\nNewt onsMethodMaplet := module()\n\n####################################### #####################\n\nexport getNewtonsMethod, runNewtonsMethodMapl et, getSavedStr1, isUnwanted:\nlocal helpStr, savedStr1:\n\n########## ##################################################\n\n################ ############################################\n\nhelpStr := \n\"This ma plet applies Newton's method for approximating a root of a function. \+ \n\nInstructions\n\nThe user enters a function f(x), an initial approx imation x[0] of a root of f(x) and the number of repetitions (default \+ 5). When you click the 'Plot' button, the maplet applies Newton's met hod to improve the approximation by finding the x-intercept x[i+1] of \+ the line tangent to f(x) at [x[i], f(x[i])]: \n \n x[ i+1] = x[i] - f(x[i])/f'(x[i])\n \nThe values of x[i] are shown numer ically in the display window and graphically in the plotter window.\": \n\n############################################################\n\n## ##########################################################\n# This met hod takes in a char and returns true if it is \n# a | or ( or ) or ` o r \" symbol else returns false\n\nisUnwanted := proc(s)\nif s = \"|\" \+ or s= \"(\" or s=\")\" or s=\"`\" or s=\"\\\"\" then \nreturn true:\ne lse \nreturn false:\nend if:\nend proc:\n\n########################### #################################\n# This method takes index of an arr ay of strings and concat and \n# removes the unwanted strings\n\ngetSa vedStr1:= proc(n)\nlocal i, num, str, cleanStr:\nuse Maplets:-Tools,S tringTools in \nstr:=\"\":\nnum:=parse(n):\nfor i from 1 to num do \ns tr:= cat(str,savedStr1[i]):\nstr:= cat(str, ` `):\nend do:\nstr: =convert(str, string);\ncleanStr := Remove( isUnwanted, str ):\nsprint f(Trim(cleanStr));\nend use:\nend proc:\n\n\n######################### ###################################\n# pre: \n# post: \n\ngetNewtons Method := proc(boo1,boo2,boo3,boo4,boo5,P_fun, P_ini,P_n,P_x1,P_x2,P_y 1,P_y2)\n\n local temp, temp2, str, viewStr, list, i:\n\n use Maplet s:-Tools, Student:-Calculus1, StringTools in\n\n temp:=Trim(P_fun): \n if temp=\"\" then \n error \"No function or algebraic expre ssion input\":\n end if:\n\n if nops(Roots(parse(temp)))=0 and b oo5 then\n return plots[textplot]([1,1,\"No root can be found\"]) : \n end if:\n \n temp2:=Trim(P_ini):\n if temp2=\"\" then \n error \"No initial approximated value input\":\n end if:\n \n str := cat(temp, \", \", temp2): \n temp:=Trim(P_n):\n if temp<>\"\" and temp<>\"5\" then \n str := cat(str, \", iter ations=\", temp):\n end if:\n\n if not(boo1 or boo3 or boo4 or b oo2 or boo5) then \n return plots[textplot]([1,1,\"Select function, points, tangents, \n vertical lines or root(s)\"]):\n end if:\n \n if not boo1 then str := cat(str, \", showfunction=false\") end i f:\n if not boo2 then str := cat(str, \", showpoints=false\") end i f:\n if not boo3 then str := cat(str, \", showtangents=false\") end if: \n if not boo4 then str := cat(str, \", showverticallines=fals e\") end if: \n if boo5 then str := cat(str, \", showroot=true\") e nd if:\n\n viewStr := [\"DEFAULT\",\"DEFAULT\"]:\n\n temp:=Trim( P_x1):\n temp2:=Trim(P_x2):\n if temp<>\"\" and temp2<>\"\" then \n temp:=cat(temp, \"..\", temp2):\n viewStr[1]:=temp:\n \+ end if: \n\n temp:=Trim(P_y1):\n temp2:=Trim(P_y2):\n if temp <>\"\" and temp2<>\"\" then\n temp:=cat(temp, \"..\", temp2):\n \+ viewStr[2]:=temp:\n end if: \n\n if not (viewStr[1]=\"DEFAUL T\" and viewStr[2]=\"DEFAULT\") then \n temp:=cat(\", view=[\", \+ viewStr[1], \", \", viewStr[2], \"]\"):\n str := cat(str, temp): \n end if:\n\n list := [NewtonsMethod(parse(str), output=sequenc e)];\n savedStr1:= array(1..nops(list)):\n\n for i from 1 to no ps(list) do \n savedStr1[i]:=cat(convert(i-1,string), `, `, conve rt(list[i],string) ):\n end do:\n \n NewtonsMethod(parse(str), o utput=plot, title=\" \"): \n\n end use:\n\nend proc:\n\n########### #################################################\n\n\n############### #############################################\n\n# pre: null\n# post: \+ run Inverse Function Maplet\n\nrunNewtonsMethodMaplet := proc()\n\nloc al maplet:\nuse Maplets:-Elements in\n\n############################## ##############################\n\nmaplet := Maplet(\n 'onstartup'=Run Window('mainWin'),\n\n################################################ ############\n\n Font['F1']('family'=\"Default\", 'bold'='true', 'ita lic'='true'),\n Font['F2']('family'=\"Default\", 'bold'='true', 'size '=14),\n\n############################################################ \n\n MenuBar['MB'](\n Menu(\"File\",\n MenuItem(\"Plot\", 'on click'=A_plot),\n MenuSeparator(),\n MenuItem(\"Close\", 'on click'=Shutdown())\n ), # end Menu/File\n Menu(\"Help\", \n \+ MenuItem(\"About this maplet\", 'onclick'=RunWindow('helpWin'))\n \+ ) # end menu/Help\n ), # end MenuBar \n\n############################ ################################\n\n Window['mainWin']('resizable'='f alse', \n 'title'=\"Calculus 1 - Newton's Method\",\n 'menubar'= 'MB', 'defaultbutton'='B_plot', \n \n BoxColumn('inset'=0, 'sp acing'=0, 'background'=\"#DDFFFF\",\n\n BoxRow('inset'=0, 'spacin g'=2, 'background'=\"#DDFFFF\", \n 'border'='true', 'caption' =\"Enter a function\", \n Label(\"Function \", 'font'='F2', \+ 'background'=\"#DDFFFF\"), \n TextField['TF_fun']('width'=22, 'background'=\"#EEFFFF\", \n 'tooltip'=\"Enter any valid f unction or expression\", \n 'value'=\"x^2-2\"),\n \+ Label(\" Initial guess \", 'font'='F2', 'background'=\"#DDFFFF\"), \n TextField['TF_ini']('value'=3.000000000, 'width'=5, 'backgro und'=\"#EEFFFF\", \n 'tooltip'=\"Enter the initial approxim ated value\"),\n Label(\" Iterations \", 'font'='F2', 'backg round'=\"#DDFFFF\",\n 'tooltip'=\"default: n = 5\"),\n \+ TextField['TF_n'](5, 'background'=\"#EEFFFF\", \n \+ 'tooltip'=\"default: n = 5\", 'value'=5) \n\n ), # end BoxRow \+ \n\n BoxRow('inset'=0, 'spacing'=0, 'background'=\"#DDFFFF\",\n \+ \n BoxColumn('inset'=0, 'spacing'=0, 'background'=\"#DDFFFF\", \+ \n\n BoxRow('inset'=0, 'spacing'=0, 'background'=\"#DDFFFF\", \n 'border'='true', 'caption'=\"Plot Window\", \n \+ Plotter['P']('background'=\"#EEFFFF\", 'cyclic'=true, \n \+ 'continuous'=true, 'delay'=300)\n ), # end BoxRow\n \n BoxColumn('inset'=0, 'spacing'=3, 'background'=\"#DDFFFF\" , \n 'border'='true', 'caption'=\"Display Options\", \n \+ \n BoxRow('inset'=0, 'spacing'=0, 'background'=\"# DDFFFF\",\n CheckBox['TBh1'](\"Show function\", 'value'=t rue, \n 'background'=\"#DDFFFF\", 'tooltip'=\"Show the \+ Curve of Function\"),\n CheckBox['TBh2'](\"Show points\", 'value'=true, \n 'background'=\"#DDFFFF\", 'tooltip'= \"Show the Points\"),\n CheckBox['TBh3'](\"Show tangents \", 'value'=true, \n 'background'=\"#DDFFFF\", 'tooltip '=\"Show the Tangent Line(s)\")\n ), # end BoxRow\n\n \+ BoxRow('inset'=0, 'spacing'=0, 'background'=\"#DDFFFF\",\n \+ CheckBox['TBh4'](\"Show vertical lines\", 'value'=true, \n \+ 'background'=\"#DDFFFF\", 'tooltip'=\"Show the Vertical Li nes\"), \n CheckBox['TBh5'](\"Show root(s)\", 'value'=fal se, \n 'background'=\"#DDFFFF\", 'tooltip'=\"Show the R oot(s)\")\n ), # end BoxRow\n\n BoxRow('inset'=0, \+ 'spacing'=0, 'background'=\"#DDFFFF\",\n Label(\"x\", 'fo nt'='F2', 'background'=\"#DDFFFF\"), \n Label(\" = \", 'f ont'='F1', 'background'=\"#DDFFFF\"),\n TextField['x1'](3 , 'background'=\"#EEFFFF\", 'value'=\" \"), \n Label(\" . . \", 'font'='F2', 'background'=\"#DDFFFF\"),\n TextField ['x2'](3, 'background'=\"#EEFFFF\", 'value'=\" \"),\n Lab el(\" y\", 'font'='F2', 'background'=\"#DDFFFF\"), \n La bel(\" = \", 'font'='F1', 'background'=\"#DDFFFF\"),\n Te xtField['y1'](3, 'background'=\"#EEFFFF\", 'value'=\" \"),\n \+ Label(\" .. \", 'font'='F2', 'background'=\"#DDFFFF\"),\n \+ TextField['y2'](3, 'background'=\"#EEFFFF\", 'value'=\" \") \n \+ ) # end BoxRow\n ) # end BoxColumn \n ), # e nd Column\n\n BoxColumn('inset'=0, 'spacing'=0, 'background'=\" #DDFFFF\",\n\n BoxColumn('inset'=0, 'spacing'=0, 'background' =\"#DDFFFF\", \n 'border'='true', 'caption'=\"Approximate V alues\",\n TextBox['TB']('width'=18, 'height'=15, 'backgrou nd'=\"#EEFFFF\", \n 'editable'='false')\n ), # \+ end BoxColumn\n\n BoxRow('inset'=0, 'spacing'=8, 'background' =\"#DDFFFF\", \n Button['B_plot'](\"Plot\", 'background'= \"#CCFFFF\", \n 'onclick'='A_plot'),\n But ton(\"Close\", 'background'=\"#CCFFFF\", Shutdown())\n ) # en d BoxRow\n\n ) # end Column\n \n ) # end BoxRow\n \+ \n ) # end BoxColumn\n\n ), # end Window\n\n###################### ######################################\n\n Window['helpWin']( 'resiza ble'='false',\n 'title'=\"About the Newton's Method Maplet\",\n \+ BoxColumn('border'='true', 'inset'=0, 'spacing'=10,\n 'background '=\"#CCFFFF\",\n BoxCell(\n TextBox('height'=16, 'width'=3 6,\n 'background'=\"#EEFFFF\", 'foreground'=\"#333399\", \n \+ 'editable'='false', 'font'='F2', \n 'value'=helpStr\n ) # end TextBox\n ), # end BoxCell\n BoxRow('inset'= 0, 'spacing'=0, 'background'=\"#CCFFFF\",\n Button(\"Close\", \+ \n CloseWindow('helpWin'), \n 'background'=\"#DDFFF F\")\n ) # end BoxRow\n ) # end BoxColumn\n ), # end helpWin \n\n############################################################\nActi on['A_plot']\n( Evaluate\n ('waitforresult'='false','target'='P',\n 'function'='getNewtonsMethod',\n Argument(TBh1),\n Argument(TBh 2),\n Argument(TBh3),\n Argument(TBh4),\n Argument(TBh5),\n Ar gument('TF_fun', quotedtext='true'),\n Argument('TF_ini', quotedtext ='true'),\n Argument('TF_n', quotedtext='true'),\n Argument('x1', \+ quotedtext='true'),\n Argument('x2', quotedtext='true'),\n Argumen t('y1', quotedtext='true'),\n Argument('y2', quotedtext='true')\n ) ,# end A_plot\n\n Evaluate\n ('waitforresult'='false', 'target'='TB' ,\n 'function'='getSavedStr1',\n Argument('TF_n', quotedtext='true ')\n )\n) \n\n##################################################### #######\n\n): # end Maplet\n\n######################################## ####################\n\nMaplets:-Display(maplet):\n\nend use: # end us e\nend proc: # end proc\n\n########################################### #################\n\nend module: # end module\nNewtonsMethodMaplet:-ru nNewtonsMethodMaplet();" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 " " }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 13 "Related Rates" }}{EXCHG {PARA 0 "" 0 "" {TEXT 272 36 "Click in red area and press [Enter]." } {TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 11009 "#Douglas Meade\n CompImplDiff := proc( active_eqn, indep_var, dep_vars )\n local d_eq_ e, D_eq_e, D_eq_i, eq_e, to_D, to_e, to_i;\n to_D := map( (y,x)->D(y) (x)=D(y), dep_vars, indep_var );\n to_e := map( (y,x)->y=y(x), dep_va rs, indep_var );\n to_i := map( (y,x)->y(x)=y, dep_vars, indep_var ); \n eq_e := eval( active_eqn, to_e );\n d_eq_e := convert( diff( eq_e , indep_var ), D );\n D_eq_e := eval( d_eq_e, to_D );\n D_eq_i := ev al( D_eq_e, to_i );\n return D_eq_i\nend proc:\n\nSubsConst := proc( \+ active_eqn, val_const )\n local result;\n result := eval( active_eqn , val_const );\n return result\nend proc:\n\nSubsVar := proc( active_ eqn, val_var )\n local eq_safe_D, eq_subs, restore_D, to_safe_D, resu lt;\n to_safe_D := map( e->D(lhs(e))=nprintf(\"D_%a\",lhs(e)), val_va r );\n restore_D := map( e->rhs(e)=lhs(e), to_safe_D );\n eq_safe_D \+ := eval( active_eqn, to_safe_D );\n eq_subs := eval( eq_safe_D, val _var );\n result := eval( eq_subs, restore_D );\n return result\n end proc:\n\nSubsRate := proc( active_eqn, val_rate )\n local result, val_deriv;\n# val_deriv := seq( lhs(e)(indep_var) = rhs(e), e=val_ra te );\n val_deriv := val_rate;\n result := eval( active_eqn, val_rat e );\n return result\nend proc:\n\nSolveUnknown := proc( active_eqn, \+ unknown_val )\n local unknown_fn;\n# unknown_fn := unknown_val(indep _var);\n unknown_fn := unknown_val;\n return unknown_val = solve( ac tive_eqn, unknown_fn )\nend proc:\n\nuse Maplets, Maplets:-Elements in \n\nRelatedRates := Maplet(\n Window(\n 'title' = \"Related R ates and Implicit Differentiation Calculator\",\n [ # c 1\n BoxLayout( 'border'=true, 'caption'=\"Original Equation and \+ Functional Dependence\",\n [\n [\n \" Equation or Relationship\",\n TextField['eqn'](\"\", 'widt h'=20, 'popupmenu'='PM_eqn' )\n# ],\n# [\n# \+ \"Dependent Variable(s)\",\n# TextField['dep_var'] ( \" [ ]\", 'width'=10 ),\n# \"Independent Variable\", \n# TextField['indep_var']( \"\", 'width'=5 ),\n \+ ]\n ]\n ),\n BoxLayout( 'border'=true, ' caption'=\"Active Equation/Relationship\",\n [\n \+ TextBox['active_eqn'](\n 3..30,\n \+ \"\",\n \+ 'popupmenu' = 'PM_active'\n )\n \+ ]\n ),\n\n GridLayout( 'border' = true, 'captio n'=\"Operations on the Active Equation\",\n [ # c 1\n \+ [ # r 1\n \"Dependent Variable(s)\",\n \+ TextField['dep_var']( \" [ ]\", 'width'=20 ),\n GridL ayout([\n [\n \"Indep Var\",\n \+ TextField['indep_var']( \"\",\n \+ 'width'=4,\n 'onchange'=SetOpti on('B_diff'('enabled') = true)\n ) \n ],\n [\n Button['B_diff']( \+ \"Diff wrt indep var\",\n 'enabled' = \+ false,\n 'onclick' = 'do_impl_diff'\n \+ )\n ]\n ]),\n \+ TextBox['impl_diff']( \"\", 3..30, 'popupmenu'='PM_diff' ) \n ], # r 1\n [ # r 2\n \"Values of Constants\",\n TextField['val_const']( \" [ ]\", 'wid th'=20 ),\n Button( \"Subs constants\",\n \+ 'onclick' = 'do_subs_const'\n ),\n T extBox['subs_const']( \"\", 3..30, 'popupmenu'='PM_const' )\n \+ ], # r 2\n [ # r 3\n \"Values of Variables \",\n TextField['val_var']( \" [ ]\", 'width'=20 ),\n \+ Button( \"Subs variables\",\n 'onclick ' = 'do_subs_var'\n ),\n TextBox['subs_v ar']( \"\", 3..30, 'popupmenu'='PM_var' )\n ], # r 3\n \+ [ # r 4\n \"Values of Rates of Change\",\n \+ TextField['val_rate']( \" [ ]\", 'width'=20 ),\n \+ Button( \"Subs rates of change\",\n 'onclick' = 'd o_subs_rate'\n ),\n TextBox['subs_rate'] ( \"\", 3..30, 'popupmenu'='PM_rate' )\n ], # r 4\n \+ [ # r 5\n \"Quantity to be Determined\",\n \+ TextField['unknown_val']( \"\", 'width'=20 ),\n Button( \+ \"Solve for unknown quantity\",\n 'onclick' = 'do_ unknown'\n ),\n TextBox['solve_unknown'] ( \"\", 3..30, 'popupmenu'='PM_solve' )\n ] # r 5\n \+ ]\n ),\n [\n Button( \"Reset all field s\",\n 'onclick' = 'reset'\n ),\n \+ Button( \"Close window\",\n 'onclick' = Shut down()\n )\n ]\n ]\n ),\n\n \+ Action['do_impl_diff'](\n Evaluate( 'impl_diff' = 'CompImpl Diff( active_eqn, indep_var, dep_var )' )\n \+ ),\n\n Action['do_subs_const'](\n Evaluate( 'subs_const' \+ = 'SubsConst( active_eqn, val_const )' )\n ) ,\n\n Action['do_subs_var'](\n Evaluate( 'subs_var' = 'Su bsVar( active_eqn, val_var )' )\n ),\n\n \+ Action['do_subs_rate'](\n Evaluate( 'subs_rate' = 'SubsRate( active_eqn, val_rate )' )\n ),\n\n Ac tion['do_unknown'](\n Evaluate( 'solve_unknown' = 'SolveUnknown ( active_eqn, unknown_val )' )\n ),\n\n \+ Action['reset'](\n SetOption( 'eqn' = \"\" ),\n SetOpt ion( 'active_eqn' = \"\" ),\n SetOption( 'indep_var' = \"\" ) ,\n SetOption( 'dep_var' = \" [ ]\" ),\n SetOption( \+ 'B_diff'('enabled') = true ),\n SetOption( 'impl_diff' = \"\" \+ ),\n SetOption( 'val_const' = \" [ ]\" ),\n SetOptio n( 'subs_const' = \"\" ),\n SetOption( 'val_var' = \" [ ]\" ),\n SetOption( 'subs_var' = \"\" ),\n SetOption( 'val_ rate' = \"\" ),\n SetOption( 'subs_rate' = \" [ ]\" ),\n \+ SetOption( 'unknown_val' = \"\" ),\n SetOption( 'solve_unk nown' = \"\" ),\n NULL \n ),\n\n Pop upMenu['PM_eqn'](\n Menu(\"Manipulate\",\n MenuItem(\"m ove to LHS\",\n Evaluate('eqn'='lhs(eqn)-rhs(eqn)=0') ),\n MenuItem(\"simplify\",\n Evaluate('eqn'= 'map(simplify,eqn)')),\n MenuItem(\"expand\",\n \+ Evaluate('eqn'='map(expand,eqn)')),\n MenuItem(\"evalf\",\n Evaluate('eqn'='map(evalf,eqn)')),\n NULL\n \+ ),\n MenuSeparator(),\n MenuItem(\"Make Active\" ,\n Evaluate('active_eqn'='eqn')),\n MenuSepara tor(),\n MenuItem(\"Clear Field\",\n SetOption( 'eqn'='\"\"'))\n ),\n\n PopupMenu['PM_active'](\n \+ Menu(\"Manipulate\",\n MenuItem(\"move to LHS\",\n \+ Evaluate('active_eqn'='lhs(active_eqn)-rhs(active_eqn)=0')),\n \+ MenuItem(\"simplify\",\n Evaluate('active_eqn' ='map(simplify,active_eqn)')),\n MenuItem(\"expand\",\n \+ Evaluate('active_eqn'='map(expand,active_eqn)')),\n \+ MenuItem(\"evalf\",\n Evaluate('active_eqn'='map(eva lf,active_eqn)')),\n NULL\n ),\n MenuSeparator( ),\n MenuItem(\"Clear Field\",\n SetOption('act ive_eqn'='\"\"'))\n ),\n\n PopupMenu['PM_diff'](\n \+ Menu(\"Manipulate\",\n MenuItem(\"move to LHS\",\n \+ Evaluate('impl_diff'='lhs(impl_diff)-rhs(impl_diff)=0')),\n \+ MenuItem(\"simplify\",\n Evaluate('impl_diff'='m ap(simplify,impl_diff)')),\n MenuItem(\"expand\",\n \+ Evaluate('impl_diff'='map(expand,impl_diff)')),\n MenuI tem(\"evalf\",\n Evaluate('impl_diff'='map(evalf,impl _diff)')),\n NULL\n ),\n MenuSeparator(),\n \+ MenuItem(\"Make Active\",\n Evaluate('active_eqn'= 'impl_diff')),\n MenuSeparator(),\n MenuItem(\"Clear Fie ld\",\n SetOption('impl_diff'='\"\"'))\n ),\n\n PopupMenu['PM_const'](\n Menu(\"Manipulate\",\n \+ MenuItem(\"move to LHS\",\n Evaluate('subs_const'='lh s(subs_const)-rhs(subs_const)=0')),\n MenuItem(\"simplify\",\n Evaluate('subs_const'='map(simplify,subs_const)')), \n MenuItem(\"expand\",\n Evaluate('subs_cons t'='map(expand,subs_const)')),\n MenuItem(\"evalf\",\n \+ Evaluate('subs_const'='map(evalf,subs_const)')),\n N ULL\n ),\n MenuSeparator(),\n MenuItem(\"Make Ac tive\",\n Evaluate('active_eqn'='subs_const')),\n \+ MenuSeparator(),\n MenuItem(\"Clear Field\",\n \+ SetOption('subs_const'='\"\"'))\n ),\n \n PopupM enu['PM_var'](\n Menu(\"Manipulate\",\n MenuItem(\"move to LHS\",\n Evaluate('subs_var'='lhs(subs_var)-rhs(s ubs_var)=0')),\n MenuItem(\"simplify\",\n Eva luate('subs_var'='map(simplify,subs_var)')),\n MenuItem(\"expa nd\",\n Evaluate('subs_var'='map(expand,subs_var)')), \n MenuItem(\"evalf\",\n Evaluate('subs_var'= 'map(evalf,subs_var)')),\n NULL\n ),\n MenuSepa rator(),\n MenuItem(\"Make Active\",\n Evaluate ('active_eqn'='subs_var')),\n MenuSeparator(),\n MenuIte m(\"Clear Field\",\n SetOption('subs_var'='\"\"'))\n \+ ),\n\n PopupMenu['PM_rate'](\n Menu(\"Manipulate\", \n MenuItem(\"move to LHS\",\n Evaluate('subs _rate'='lhs(subs_rate)-rhs(subs_rate)=0')),\n MenuItem(\"simpl ify\",\n Evaluate('subs_rate'='map(simplify,subs_rate )')),\n MenuItem(\"expand\",\n Evaluate('subs _rate'='map(expand,subs_rate)')),\n MenuItem(\"evalf\",\n \+ Evaluate('subs_rate'='map(evalf,subs_rate)')),\n \+ NULL\n ),\n MenuSeparator(),\n MenuItem(\"Make A ctive\",\n Evaluate('active_eqn'='subs_rate')),\n \+ MenuSeparator(),\n MenuItem(\"Clear Field\",\n \+ Evaluate('subs_rate'='\"\"'))\n ),\n\n PopupMenu['PM_s olve'](\n Menu(\"Manipulate\",\n MenuItem(\"move to LHS \",\n Evaluate('solve_unknown'='lhs(solve_unknown)-rh s(solve_unknown)=0')),\n MenuItem(\"simplify\",\n \+ Evaluate('solve_unknown'='map(simplify,solve_unknown)')),\n \+ MenuItem(\"expand\",\n Evaluate('solve_unknown'='m ap(expand,solve_unknown)')),\n MenuItem(\"evalf\",\n \+ Evaluate('solve_unknown'='map(evalf,solve_unknown)')),\n \+ NULL\n ),\n MenuSeparator(),\n MenuItem(\"Mak e Active\",\n Evaluate('active_eqn'='solve_unknown')), \n MenuSeparator(),\n MenuItem(\"Clear Field\",\n \+ SetOption('solve_unknown'='\"\"'))\n ),\n\nNULL\n):\n \nend use:\n\nMaplets:-Display(RelatedRates);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 18 "Tangen t and Secant" }}{EXCHG {PARA 0 "" 0 "" {TEXT 273 36 "Click in red area and press [Enter]." }{TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 18043 "# Tangent and Secant Maplet\n# Copyright 2002 Waterloo Maple In c.\n# \n# The Tangent and Secant maplet motivates the study of derivat ives by showing how the secant line between two points on the graph of a function approaches a tangent line as one point approaches the othe r. For a differentiable function, these slopes approach the value f '( x[0]).\n# \n# The user enters a function f(x), a differentiable point \+ x[0], the initial difference h between the x-coordinates, and the numb er n of secant lines to show.\n# \n# The maplet plots a sequence of se cant lines. For each successive secant line, the distance between the \+ x-coordinates of the points decreases by h/n. The maplet also plots th e function f(x) and its tangent line at x[0].\n# \n# The maplet also displays an animation that shows the progression of the secant lines \+ as the distance between the points decreases.\n# \n# The maplet displa ys the slopes of the secant lines in order of decreasing distance betw een the points. \n# \n# To run this maplet, click the Execute (!!!) b utton in the context bar.\n# \nrestart;\nTangentSecantMaplet := module ()\n\n############################################################\n\n export getTangentSecant, runTangentSecantMaplet:\nlocal helpStr, saved Str1, savedStr2, savedStr3, getSavedStr1, getSavedStr2, getSavedStr3, \+ isUnwanted:\n\n####################################################### #####\n\n\n########################################################### #\n#initialize string to be the empty string\nsavedStr1:=\"\";\nsavedS tr2:=\"\"; \nsavedStr3:=\"\";\n\nhelpStr := \n\"The Tangent and Secant maplet motivates the study of derivatives by showing how the secant l ine between two points on the graph of a function approaches a tangent line as one point approaches the other.\n\nEnter a function f(x), a d ifferentiable point x[0], the initial difference h between the x-coord inates, and the number n of secant lines to show. For secant lines app roaching from the left side, enter a negative value for h. Entering a list of positive or negative values for h is not possible in this map let. \n\nTo plot the sequence of secant lines, click the 'Plot' button or select 'Plot' from the 'File' menu. For each successive secant lin e, the distance between the x-coordinates of the two points decreases \+ by h/n. The maplet also plots the function f(x) and its tangent line a t x[0]. To view a single secant line at x+h, enter n=1.\n \nTo displa y an animation that shows the progression of the secant lines as the d istance between the points decreases, click the 'Animate' button or se lect 'Animate' from the 'File' menu. For each successive secant line, \+ the distance between the x-coordinates of the two points decreases by \+ h/n. The maplet also plots the function f(x) and its tangent line at x [0]. \n\nBefore plotting or animating, the maplet calculates and displ ays the slopes of the secant lines in order of decreasing distance bet ween the points. For a differentiable function, these slopes approach \+ the value f'(x[0]).\":\n\n############################################ ################\n\n################################################## ##########\n# This method takes in a char and returns true if it is \n # a | or ( or ) or ` or \\ symbol else returns false\n\nisUnwanted := \+ proc(s)\nif s = \"|\" or s= \"(\" or s=\")\" or s=\"`\" or s=\"\\\"\" \+ then \nreturn true:\nelse \nreturn false:\nend if:\nend proc:\n\n##### #######################################################\n# This method returns the value stored in savedStr1\ngetSavedStr1:= proc()\nsavedSt r1;\nend proc:\n\n#################################################### ########\n# This method takes in an array of strings and concat and \n # removes the unwanted strings\ngetSavedStr2:= proc(n)\nlocal i, num, \+ str, cleanStr:\nuse Maplets:-Tools,StringTools in \nstr:=\"\":\nnum:= parse(n):\nfor i from 1 to num do \nstr:= cat(str,savedStr2[i]):\nend \+ do:\nstr:=convert(str, string);\ncleanStr := Remove( isUnwanted, str ) :\nTrim(cleanStr);\nend use:\nend proc:\n\n########################### #################################\n# This method returns the value sto red in savedStr3\ngetSavedStr3:= proc()\nsavedStr3;\nend proc:\n\n#### ########################################################\n# pre: \n# p ost: \n\ngetTangentSecant := proc(boo,boo1,boo2,boo3,boo4, P_fun, P_ at, P_h, P_n, P_x1, P_x2, P_y1, P_y2)\n\n local temp, temp2, str, mai nStr, expr, viewExpr,\n hf, c, n, h_list, i, slopes, strAnimate , exprAnimate:\n\n use Maplets:-Tools, Student:-Calculus1 , StringToo ls in\n\n temp:=Trim(P_fun):\n if temp=\"\" then \n error \+ \"No function or algebraic expression entered\":\n end if:\n \n \+ temp2:=Trim(P_at):\n temp2:=convert(evalf(convert(temp2, symbol) ), string);\n if temp2=\"\" then \n error \"No x value entered for the point of tangency\":\n end if:\n c := eval(parse(temp2) ):\n \n mainStr := cat(temp, \", \", temp2):\n str := mainStr :\n \n temp:=Trim(P_h):\n temp:=convert(evalf(convert(temp, sy mbol)), string);\n hf:=1:\n if temp<>\"\" then \n hf:=eval( parse(temp)):\n end if:\n\n temp:=Trim(P_n):\n n:=10:\n if temp<>\"\" then \n n:=eval(parse(temp)):\n end if:\n saved Str2:=array(1..n):\n temp:=Trim(P_x1):\n temp2:=Trim(P_x2):\n \+ if temp<>\"\" and temp2<>\"\" then\n temp:=cat(\", \", temp, \". .\", temp2):\n str := cat(str, temp):\n end if: \n\n strAn imate:=str:\n\n if not(boo1 or boo2 or boo3 or boo4) then \n r eturn plots[textplot]([1,1,\"Select function, tangent line, secant lin es, or points\"]):\n end if:\n\n if not boo1 then \n str : = cat(str, \", showfunction=false\") end if:\n if boo2 then \n \+ str := cat(str, \", showderivative=true\") end if:\n if not boo3 \+ then \n str := cat(str, \", showquotient=false\") end if: \n \+ if not boo4 then \n str := cat(str, \", showpoints=false\") end \+ if: \n\n viewExpr := [\"DEFAULT\",\"DEFAULT\"]:\n\n temp:=Trim(P _x1):\n temp2:=Trim(P_x2):\n if temp<>\"\" and temp2<>\"\" then \n temp:=cat(temp, \"..\", temp2):\n viewExpr[1]:=temp:\n \+ end if: \n\n temp:=Trim(P_y1):\n temp2:=Trim(P_y2):\n if tem p<>\"\" and temp2<>\"\" then\n temp:=cat(temp, \"..\", temp2):\n \+ viewExpr[2]:=temp:\n end if: \n\n if not (viewExpr[1]=\"DEF AULT\" and viewExpr[2]=\"DEFAULT\") then \n temp:=cat(\", view=[ \", viewExpr[1], \", \", viewExpr[2], \"]\"):\n str := cat(str, t emp):\n end if:\n\n if not (viewExpr[1]=\"DEFAULT\" and viewExpr [2]=\"DEFAULT\") then \n temp:=cat(\", view=[\", viewExpr[1], \" , \", viewExpr[2], \"]\"):\n strAnimate := cat(strAnimate, temp): \n end if:\n\n h_list:=ListTools[Reverse]([seq(hf*i/n,i=1..n)]): \n expr:=eval(parse(str)):\n exprAnimate:=eval(parse(strAnimate) ): \n \n slopes:=NewtonQuotient(expr, 'h'=h_list, output=value); \n \n savedStr1:=cat(\"as h changes from \", convert(hf+c, string ), \" to\" , \n convert(c,string), \" by \", convert(hf/n, string), \", slopes of secant are:\"):\n \n for i from 1 to n do\n s avedStr2[i]:=evalf(slopes[i]):\n end do:\n \n savedStr3:= eval f(Tangent(eval(parse(mainStr)),output=slope)):\n if boo then \n \+ NewtonQuotient(expr, 'h'=h_list, output=plot, title=\" \"):\n els e\n NewtonQuotient(exprAnimate, 'h'=h_list, output=animation, tit le=\" \"):\n end if:\n\n end use:\n\nend proc:\n\n################ ############################################\n\n\n#################### ########################################\n# pre: null\n# post: run Inv erse Function Maplet\n\nrunTangentSecantMaplet := proc()\n\nlocal mapl et:\nuse Maplets:-Elements in\n\n##################################### #######################\n\nmaplet := Maplet(\n 'onstartup'=RunWindow( 'mainWin'),\n\n####################################################### #####\n\n Font['F1']('family'=\"Default\", 'bold'='true', 'italic'='t rue'),\n Font['F2']('family'=\"Default\", 'bold'='true', 'size'=14), \n\n############################################################\n\n \+ MenuBar['MB'](\n Menu(\"File\",\n MenuItem(\"Plot\", 'onclick' =A_plot),\n MenuItem(\"Animate\", 'onclick'=A_animate),\n Me nuSeparator(),\n MenuItem(\"Close\", 'onclick'=Shutdown())\n ) , # end Menu/File\n Menu(\"Help\", \n MenuItem(\"Using this Ma plet\", 'onclick'=RunWindow('helpWin'))\n ) # end menu/Help\n ), # end MenuBar \n\n##################################################### #######\n\n Window['mainWin']('resizable'='false', \n 'title'=\"Ca lculus 1 - Tangent and Secant\",\n 'menubar'='MB', 'defaultbutton'= 'B_plot', \n \n BoxColumn('inset'=0, 'spacing'=0, 'background' =\"#DDFFFF\",\n\n BoxRow('inset'=0, 'spacing'=0, 'background'=\"# DDFFFF\", \n \n BoxRow('inset'=0, 'spacing'=0, 'background'=\" #DDFFFF\", \n 'border'='true', 'caption'=\"Enter a function a nd point of tangency\", \n Label(\"Function \", 'font'='F2', 'background'=\"#DDFFFF\"), \n TextField['TF_fun']('width'=23 , 'background'=\"#EEFFFF\", \n 'tooltip'=\"Enter any valid \+ function or expression\",\n 'value'=x^2-1),\n Labe l(\" at \", 'font'='F2', 'background'=\"#DDFFFF\"), \n TextFi eld['TF_at']('value'=1, 'width'=4, 'background'=\"#EEFFFF\", \n \+ 'tooltip'=\"Enter x-coordinate of the point of tangency\") \n \+ ), # end BoxColumn\n\n BoxRow('inset'=0, 'spacing'=0, 'bac kground'=\"#DDFFFF\", \n 'border'='true', 'caption'=\"Param eters\",\n Label(\"h\", 'font'='F2', 'background'=\"#DDFFF F\",\n 'tooltip'=\"Default: h = 1\"),\n Labe l(\" = \", 'font'='F1', 'background'=\"#DDFFFF\"),\n TextF ield['TF_h'](4, 'background'=\"#EEFFFF\", \n 'value'=1, \+ 'tooltip'=\"Default: h = 1\"), \n Label(\" n\", 'font'='F2 ', 'background'=\"#DDFFFF\",\n 'tooltip'=\"Default: n = \+ 10\"),\n Label(\" = \", 'font'='F1', 'background'=\"#DDFFF F\"),\n TextField['TF_n'](4, 'background'=\"#EEFFFF\", \n \+ 'value'=10, 'tooltip'=\"Default: n = 10\") \n ) # end BoxRow\n ), # end BoxRow\n \n BoxRow('inset'=0, 'spac ing'=0, 'background'=\"#DDFFFF\",\n \n BoxColumn('inset'=0, 'sp acing'=0, 'background'=\"#DDFFFF\", \n \n BoxRow('inset'=0, 's pacing'=0, 'background'=\"#DDFFFF\", \n 'border'='true', \+ 'caption'=\"Plot Window\", \n Plotter['P']('background'= \"#EEFFFF\", continuous=false)\n ), # end BoxRow\n\n BoxC olumn('inset'=0, 'spacing'=0, 'background'=\"#DDFFFF\", \n 'ca ption'=\"Display Options\", 'border'='true', \n\n BoxRow('inset '=0, 'spacing'=6, 'background'=\"#DDFFFF\", \n CheckBox[' TBh1']('caption'=\"Show function\", 'value'=true, \n 'b ackground'=\"#DDFFFF\"),\n CheckBox['TBh3']('caption'=\"S how secant lines\", 'value'=true, \n 'background'=\"#DD FFFF\")\n ), # end BoxRow of CheckBox\n\n BoxRow('in set'=0, 'spacing'=6, 'background'=\"#DDFFFF\", \n CheckBo x['TBh2']('caption'=\"Show tangent line\", 'value'=true, \n \+ 'background'=\"#DDFFFF\"),\n CheckBox['TBh4']('capti on'=\"Show points\", 'value'=true, \n 'background'=\"#D DFFFF\"),\n CheckBox['TBh5']('value'='true', visible='fal se'),\n CheckBox['TBh6']('value'='false', visible='false' )\n ), # end BoxRow of CheckBox\n\n BoxRow('inset'=0 , 'spacing'=0, 'background'=\"#DDFFFF\", \n \n \+ Label(\"x\", 'font'='F2', 'background'=\"#DDFFFF\"), \n \+ Label(\" = \", 'font'='F1', 'background'=\"#DDFFFF\"),\n \+ TextField['x1'](3, 'background'=\"#EEFFFF\",'value'=\" \"), \n \+ Label(\" .. \", 'font'='F2', 'background'=\"#DDFFFF\"),\n \+ TextField['x2'](3, 'background'=\"#EEFFFF\",'value'=\" \"),\n \+ Label(\" y\", 'font'='F2', 'background'=\"#DDFFFF\"), \n \+ Label(\" = \", 'font'='F1', 'background'=\"#DDFFFF\"),\n \+ TextField['y1'](3, 'background'=\"#EEFFFF\",'value'=\" \"),\n \+ Label(\" .. \", 'font'='F2', 'background'=\"#DDFFFF\"),\n \+ TextField['y2'](3, 'background'=\"#EEFFFF\",'value'=\" \") \+ \n ) # end BoxRow\n\n ) # end BoxRow of Display Opt ions\n\n ), # end BoxColumn for Plotter and Options\n\n \+ BoxColumn('inset'=0, 'spacing'=0, 'background'=\"#DDFFFF\",\n\n \+ BoxColumn('inset'=0, 'spacing'=0, 'background'=\"#DDFFFF\", \n \+ 'border'='true', 'caption'=\"Slopes of Secant Lines\",\n \+ TextBox['TB_display']('width'=4, 'height'=3, 'background'=\"#EEFF FF\", 'editable'='false'),\n TextBox['TB_sec']('width'=4, ' height'=12, 'background'=\"#EEFFFF\", \n 'editable'='fal se')),\n\n BoxColumn('inset'=0, 'spacing'=0, 'background'=\"# DDFFFF\", \n 'border'='true', 'caption'=\"Slope of Tangent \+ Line\",\n TextField['TF_tan']('width'=4, 'background'=\"#EE FFFF\", \n 'editable'='false')\n ), # end BoxCol umn\n\n BoxColumn('inset'=0, 'spacing'=0, 'background'=\"#DDF FFF\", \n 'border'='true', 'caption'=\"Animation Controller \", \n BoxRow('inset'=0, 'spacing'=6, 'background'=\"#DDFF FF\", \n Button[B1](\"Play\", 'background'=\"#CCFFFF\", 'en abled'=false, \n SetOption(P('play')=true)),\n \+ Button[B2](\"Stop\", 'background'=\"#CCFFFF\", 'enabled'=false, \n \+ SetOption(P('`stop`')=true)),\n Button[B3](\"Pa use\", 'background'=\"#CCFFFF\", 'enabled'=false, \n Set Option(P('pause')=true))\n ), # end BoxRow\n\n BoxR ow('inset'=0, 'spacing'=6, 'background'=\"#DDFFFF\", \n But ton[B6](\"Backward\", 'background'=\"#CCFFFF\", 'enabled'=false, \n \+ SetOption(P('frame_backwards')=true),'visible'='false'),\n Button[B7](\"Forward\", 'background'=\"#CCFFFF\", 'enabled '=false, \n SetOption(P('frame_forward')=true), 'visible '='false')\n ), # end BoxRow \n\n BoxRow('inset'=0, 'spacing'=0, 'background'=\"#DDFFFF\", \n CheckBox[CB1]( 'value'=false, 'background'=\"#DDFFFF\", \n 'caption'= \"Repeat animation\", 'enabled'=false,'visible'='false', \n \+ 'onchange'=SetOption(target=P, `option`='continuous', Argument( CB1) ) \n ) # end CheckBox\n ) # end BoxRow\n \+ ), # end BoxRow for Animation Features\n\n BoxRow('inset '=0, 'spacing'=6, 'background'=\"#DDFFFF\", \n Button['B_ plot'](\"Plot\", 'background'=\"#CCFFFF\", 'onclick'='A_plot'),\n \+ Button(\"Animate\",'background'=\"#CCFFFF\", 'onclick'='A_ani mate'),\n Button(\"Close\", 'background'=\"#CCFFFF\", Shu tdown())\n ) # end BoxRow\n\n ) # end Column\n \+ \n ) # end BoxRow\n \n ) # end BoxColumn\n\n ), # end Window \n\n############################################################\n\n \+ Window['helpWin']( 'resizable'='false',\n 'title'=\"Using the Tange nt and Secant Maplet\",\n BoxColumn('border'='true', 'inset'=0, 'sp acing'=10,\n 'background'=\"#CCFFFF\",\n BoxCell(\n T extBox('height'=25, 'width'=50,\n 'background'=\"#EEFFFF\", ' foreground'=\"#333399\", \n 'editable'='false', 'font'='F2', \+ \n 'value'=helpStr\n ) # end TextBox\n ), # end B oxCell\n BoxRow('inset'=0, 'spacing'=0, 'background'=\"#CCFFFF\", \n Button(\"Close\", \n CloseWindow('helpWin'), \n \+ 'background'=\"#DDFFFF\")\n ) # end BoxRow\n ) # end B oxColumn\n ), # end helpWin\n\n##################################### #######################\n\n Action['A_plot']\n (\n Evaluate\n \+ (waitforresult='false','target'='P', 'function'='getTangentSecant', \n Argument(TBh5),\n Argument(TBh1),\n \+ Argument(TBh2),\n Argument(TBh3),\n Argumen t(TBh4),\n Argument('TF_fun', quotedtext='true'), \n \+ Argument('TF_at', quotedtext='true'),\n Argument('T F_h', quotedtext='true'),\n Argument('TF_n', quotedtext='t rue'),\n Argument('x1', quotedtext='true'),\n \+ Argument('x2', quotedtext='true'),\n Argument('y1', quoted text='true'),\n Argument('y2', quotedtext='true')\n ), \n SetOption( 'B1'('enabled')='false'),\n SetOption( 'B2'('enabl ed')='false'),\n SetOption( 'B3'('enabled')='false'),\n SetOptio n( 'B6'('enabled')='false'),\n SetOption( 'B7'('enabled')='false'), \n SetOption( 'CB1'('enabled')='false'),\n Evaluate\n ('waitf orresult'='false', 'target'='TB_display', 'function'='getSavedStr1' \n ),\n Evaluate\n ('waitforresult'='false','target'='TB_sec',' function'='getSavedStr2', \n Argument('TF_n', quotedtext='true')\n ),\n Evaluate\n ('waitforresult'='false', 'target'='TF_tan', 'function'='getSavedStr3'\n )\n ), # end A_plot\n\n Action['A_an imate'](\n Evaluate\n ('waitforresult'='false','target'='P', 'fu nction'='getTangentSecant', \n Argument(TBh6),\n \+ Argument(TBh1),\n Argument(TBh2),\n Argumen t(TBh3),\n Argument(TBh4),\n Argument('TF_fun' , quotedtext='true'), \n Argument('TF_at', quotedtext='tru e'),\n Argument('TF_h', quotedtext='true'),\n \+ Argument('TF_n', quotedtext='true'),\n Argument('x1', quot edtext='true'),\n Argument('x2', quotedtext='true'),\n \+ Argument('y1', quotedtext='true'),\n Argument('y2 ', quotedtext='true')\n ),\n SetOption( 'B1'('enabled')='true'), \n SetOption( 'B2'('enabled')='true'),\n SetOption( 'B3'('enable d')='true'),\n SetOption( 'B6'('enabled')='true'),\n SetOption( \+ 'B7'('enabled')='true'),\n SetOption( 'CB1'('enabled')='true'),\n \+ Evaluate\n ('waitforresult'='false', 'target'='TB_display', 'func tion'='getSavedStr1' \n ),\n Evaluate\n ('waitforresult'='fal se','target'='TB_sec','function'='getSavedStr2',\n Argument('TF_n', quotedtext='true')\n ),\n Evaluate\n ('waitforresult'='false ', 'target'='TF_tan','function'='getSavedStr3'\n )\n ), # end A_an imate\n\n Action['A']()\n\n\n####################################### #####################\n\n): # end Maplet\n\n########################## ##################################\n\nMaplets:-Display(maplet):\n\nend use: # end use\nend proc: # end proc\n\n############################# ###############################\n\nend module: # end module\nTangentSe cantMaplet:-runTangentSecantMaplet();" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 17 "Tangent Lin e Plot" }}{EXCHG {PARA 0 "" 0 "" {TEXT 274 36 "Click in red area and p ress [Enter]." }{TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 9940 "# Tangent Line Plot Maplet\n# Copyright 2002 Waterloo Maple Inc.\n# \n# This maplet plots the tangent line to the graph of a function at a di fferentiable point in its domain and computes the equation of the tang ent line. \n# \n# The user enters a function f(x) and the x-coordinate , x[0], of the point of tangency. The maplet plots the tangent line an d the function, and displays the equation and slope of the tangent lin e at x[0].\n# \n# To run this maplet, click the Execute(!!!) button in the context bar.\n# \nrestart;\nTangentMaplet := module()\n\n###### ######################################################\n\nexport getTa ngent, runTangentMaplet:\nlocal helpStr:\n\n########################## ##################################\n\n\n############################## ##############################\n\nhelpStr := \n\"This maplet plots the tangent line to the graph of a function at a differentiable point in \+ its domain and computes the equation of the tangent line. \n\nEnter a \+ function and the x-coordinate, x[0], of the point of tangency. To plot the function and its tangent line at x[0], click the 'Plot' button or select 'Plot' from the 'File' menu. The maplet also displays the equa tion and slope of the tangent line.\":\n\n############################ ################################\n\n\n################################ ############################\n# pre: three boolean values are input to determine the appearances\n# of the curve of the function, the t angent line y=x and \n# the point of the tangency. They cannot al l be zero\n# post: Student:-Calculus1:-Tangent() returns \n\ngetTange nt := proc(boo1, boo2, boo3, out, P_fun, P_at, P_x1, P_x2, P_y1, P_y2) \n\n local temp, temp2, str, viewExpr:\n \n use Maplets:-Tools, Stri ngTools in\n\n temp:=Trim(P_fun):\n if temp=\"\" then \n er ror \"No function or algebraic expression entered\":\n end if:\n \+ \n temp2:=Trim(P_at):\n if temp2=\"\" then \n error \"No x -coordinate for the point of tangency entered\":\n end if:\n tem p2:=convert(evalf(convert(temp2, symbol)), string);\n str := cat(te mp, \", \", temp2, \", output=\", convert(out,string)):\n\n temp:=T rim(P_x1):\n temp2:=Trim(P_x2):\n if temp<>\"\" and temp2<>\"\" \+ then\n temp:=cat(\", \", temp, \"..\", temp2):\n str := cat( str, temp): \n end if: \n\n if not(boo1 or boo2 or boo3) then \n return plots[textplot]([1,1,\"Select curve, tangent line, or poi nt of tangency\"]):\n end if:\n\n if not boo1 then str := cat(st r, \", showfunction=false\") end if:\n if not boo2 then str := cat( str, \", showtangent=false\") end if:\n if not boo3 then str := cat (str, \", showpoint=false\") end if: \n\n viewExpr := [\"DEFAULT\", \"DEFAULT\"]:\n\n temp:=Trim(P_x1):\n temp2:=Trim(P_x2):\n if temp<>\"\" and temp2<>\"\" then\n viewExpr[1]:=cat(temp, \"..\", temp2):\n end if: \n\n temp:=Trim(P_y1):\n temp2:=Trim(P_y2) :\n if temp<>\"\" and temp2<>\"\" then\n viewExpr[2]:=cat(temp , \"..\", temp2):\n end if: \n\n temp:=cat(\", view=[\", viewExp r[1], \", \", viewExpr[2], \"]\"):\n str := cat(str, temp):\n St udent:-Calculus1:-Tangent(eval(parse(str)), pointoptions=[symbolsize=1 5], title=\" \"):\n\n end use: \n\nend proc:\n\n##################### #######################################\n\n########################### #################################\n# pre: null\n# post: run Inverse Fu nction Maplet\n\nrunTangentMaplet := proc()\nlocal maplet:\nuse Maplet s:-Elements in\n\n#################################################### ########\n\nmaplet := Maplet(\n 'onstartup'=RunWindow('mainWin'),\n\n ############################################################\n\n Font ['F1']('family'=\"Default\", 'bold'='true', 'italic'='true'),\n Font[ 'F2']('family'=\"Default\", 'bold'='true', 'size'=14),\n\n############ ################################################\n\n MenuBar['MB'](\n Menu(\"File\", \n MenuItem(\"Plot\", 'onclick'=A_Tangent),\n \+ MenuSeparator(),\n MenuItem(\"Close\", 'onclick'=Shutdown()) \n ), # end Menu/File\n Menu(\"Help\", \n MenuItem(\"Using \+ this Maplet\", 'onclick'=RunWindow('helpWin'))\n ) # end menu/Help \n ), # end MenuBar \n\n############################################# ###############\n\n Window['mainWin']('resizable'='false', \n 'tit le'=\"Calculus 1 - Tangent Line Plot\",\n 'menubar'='MB', \n \n BoxColumn('inset'=0, 'spacing'=0, 'background'=\"#DDFFFF\", \n\n \+ BoxRow('inset'=0, 'spacing'=4, 'background'=\"#DDFFFF\", \n \+ 'border'='true', 'caption'=\"Enter a function and its point of tange ncy\", \n Label(\"Function \", 'font'='F2', 'background'=\"#DD FFFF\"), \n TextField['TF_fun']('width'=22, 'background'=\"#EEF FFF\", \n 'tooltip'=\"Enter any valid function or expression \",\n 'value'=exp(x)),\n Label(\" at \", 'font'='F2', \+ 'background'=\"#DDFFFF\"), \n TextField['TF_at']('value'=0, 'wi dth'=6, 'background'=\"#EEFFFF\", \n 'tooltip'=\"Enter the x- coordinate of the point of tangency\")\n ), # end BoxRow \n \n \+ BoxRow('inset'=0, 'spacing'=0, 'background'=\"#DDFFFF\", \n \+ 'border'='true', 'caption'=\"Plot Window\", \n Plotter['P'](' background'=\"#EEFFFF\")\n ), # end BoxRow\n\n BoxRow('inset '=0, 'spacing'=0, 'background'=\"#DDFFFF\", \n 'border'='true', 'caption'=\"Tangent Line\",\n Label(\"Equation \", 'font'='F2' , 'background'=\"#DDFFFF\"), \n TextField['TF_eqn'](15 , 'background'=\"#EEFFFF\", 'editable'='false','value'=\" \"), \n \+ Label(\" Slope \", 'font'='F2', 'background'=\"#DDFFFF\"), \+ \n TextField['TF_slope'](6, 'background'=\"#EEFFFF\", 'editab le'='false','value'=\" \")\n ), # end BoxRow\n\n BoxRow('ins et'=0, 'spacing'=0, 'background'=\"#DDFFFF\", \n BoxColumn('ins et'=0, 'spacing'=6, 'background'=\"#DDFFFF\", \n 'border'='tr ue', 'caption'=\"Display Options\", \n BoxRow('inset'=0, 'spa cing'=4, 'background'=\"#DDFFFF\",\n CheckBox['TBh1'](\"Sho w function\", 'value'=true, \n 'background'=\"#DDFFFF\", \+ 'tooltip'=\"Show the graph of the function\"),\n CheckBox[' TBh2'](\"Show tangent line\", 'value'=true, \n 'backgroun d'=\"#DDFFFF\", 'tooltip'=\"Show the tangent line\"),\n Che ckBox['TBh3'](\"Show point\", 'value'=true, \n 'backgroun d'=\"#DDFFFF\", 'tooltip'=\"Show the point of tangency\")\n \+ \n ), # end BoxRow\n BoxRow('inset'=0, 'spacing'=2, 'background'=\"#DDFFFF\",\n Label(\"x =\", 'font'='F2', 'b ackground'=\"#DDFFFF\"),\n TextField['x1'](3, 'background'= \"#EEFFFF\",'value'=\" \"), \n Label(\" .. \", 'font'='F2', 'background'=\"#DDFFFF\"),\n TextField['x2'](3, 'backgroun d'=\"#EEFFFF\",'value'=\" \"),\n Label(\"y =\", 'font'='F2' , 'background'=\"#DDFFFF\"),\n TextField['y1'](3, 'backgrou nd'=\"#EEFFFF\",'value'=\" \"),\n Label(\" .. \", 'font'='F 2', 'background'=\"#DDFFFF\"),\n TextField['y2'](3, 'backgr ound'=\"#EEFFFF\",'value'=\" \"),\n TextField['TF_plot']('v alue'=\"plot\",visible='false'),\n TextField['TF_line']('va lue'=\"line\",visible='false'),\n TextField['TF_s']('value' =\"slope\",visible='false') \n ) # end BoxRow\n \+ ), # end Column\n \n BoxRow('inset'=0, 'spacing'=5, 'backgro und'=\"#DDFFFF\", \n Button(\"Plot \", 'background'=\"#CCFFF F\", \n 'onclick'=A_Tangent ),\n Button(\"Close \", Shutdown(), 'background'=\"#CCFFFF\") \n ) # end BoxRow\n \+ ) # end BoxRow \n\n ) # end BoxColumn\n\n ), # end Window\n\n ############################################################\n\n Wind ow['helpWin']( 'resizable'='false',\n 'title'=\"Using the Tangent L ine Plot Maplet\",\n BoxColumn('border'='true', 'inset'=0, 'spacing '=10,\n 'background'=\"#CCFFFF\",\n BoxCell(\n TextBo x('height'=10, 'width'=30,\n 'background'=\"#EEFFFF\", 'foreg round'=\"#333399\", \n 'editable'='false', 'font'='F2', \n \+ 'value'=helpStr\n ) # end TextBox\n ), # end BoxCel l\n BoxRow('inset'=0, 'spacing'=0, 'background'=\"#CCFFFF\",\n \+ Button(\"Close\", \n CloseWindow('helpWin'), \n \+ 'background'=\"#DDFFFF\")\n ) # end BoxRow\n ) # end BoxCol umn\n ), # end helpWin\n\n########################################## ##################\n\n Action['A_Tangent']\n ( Evaluate\n ( 'w aitforresult'='false','target'='P','function'='getTangent',\n A rgument(TBh1),\n Argument(TBh2),\n Argument(TBh3),\n \+ Argument('TF_plot',quotedtext='true'),\n Argument('TF_fun', quotedtext='true'),\n Argument('TF_at',quotedtext='true'),\n \+ Argument('x1',quotedtext='true'),\n Argument('x2',quotedte xt='true'),\n Argument('y1',quotedtext='true'),\n Argume nt('y2',quotedtext='true')\n ),\n Evaluate\n ( 'waitfor result'='false','target'='TF_eqn','function'='getTangent',\n Ar gument(TBh1),\n Argument(TBh2),\n Argument(TBh3),\n \+ Argument('TF_line',quotedtext='true'),\n Argument('TF_fun',q uotedtext='true'),\n Argument('TF_at',quotedtext='true'),\n \+ Argument('x1',quotedtext='true'),\n Argument('x2',quotedtex t='true'),\n Argument('y1',quotedtext='true'),\n Argumen t('y2',quotedtext='true')\n ),\n Evaluate\n ( 'waitforre sult'='false','target'='TF_slope','function'='getTangent',\n Ar gument(TBh1),\n Argument(TBh2),\n Argument(TBh3),\n \+ Argument('TF_s',quotedtext='true'),\n Argument('TF_fun',quot edtext='true'),\n Argument('TF_at',quotedtext='true'),\n \+ Argument('x1',quotedtext='true'),\n Argument('x2',quotedtext=' true'),\n Argument('y1',quotedtext='true'),\n Argument(' y2',quotedtext='true')\n ) \n\n ) # end A_Tangent\n\n######### ###################################################\n\n): # end Maplet \n\n############################################################\n\nMa plets:-Display(maplet):\n\nend use: # end use\nend proc: # end proc\n \n############################################################\n\nend \+ module: # end TangentMaplet\nTangentMaplet:-runTangentMaplet();# " }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 " " {TEXT -1 20 "Taylor Approximation" }}{EXCHG {PARA 0 "" 0 "" {TEXT 275 36 "Click in red area and press [Enter]." }{TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 15559 "# Taylor Approximation Maplet\n# Copyr ight 2002 Waterloo Maple\n# \n# The Taylor Approximation maplet calcul ates the Taylor polynomial and displays Taylor approximations graphica lly. \n# \n# The user enters a function, initial point a, and one or m ore orders. The maplet displays the Taylor approximations or an animat ion of the Taylor approximations of increasing orders. The user can al so request the Taylor polynomial of a specified degree. \n# \n# To run this maplet, click the Execute (!!!) button in the context bar.\n# \n restart;\nTaylorApproxMaplet := module()\n\n########################## ##################################\n\nexport checkBoxes, getTaylorAppr ox, getTaylorPoly, \n runTaylorApproxMaplet:\nlocal helpStr, inf oStr, infoStr2:\n\n################################################### #########\n\n\n####################################################### #####\n\nhelpStr := \n\"The Taylor Approximation maplet calculates the Taylor polynomial and displays Taylor approximations graphically. \n \nEnter a function and an initial point, a.\n\nTo display the function and one or more Taylor approximations of increasing orders at a, ente r one or more orders in the 'Order' text field, and then click the 'Pl ot' button or select 'Plot' from the 'File' menu.\n\nTo display an ani mation of the function and the Taylor approximations, enter one or mor e orders in the 'Order' text field, and then click the 'Animate' butto n or select 'Animate' from the 'File' menu. \n\nTo view a Taylor polyn omial, enter the order in the 'Enter the order' text field, and then c lick the 'Compute' button or select 'Compute' from the 'File' menu.\": \n\n############################################################\n\n\n ############################################################\n\ninfoSt r := \"Number of Frames = n\n\nwhere n is any positive integer\n\nThe \+ number of Taylor approximations displayed in an animation. The maplet \+ first displays the approximation of the order specified by 'order' opt ion, and then the n-1 approximations of consecutively higher orders. \+ \n\nThis option is ignored if the 'order' option is a range, a..b.\n\n The default value is 5.\" :\n\n####################################### #####################\n\n############################################# ###############\n\ninfoStr2:= \"Order = m or m .. n\n\nwhere m and n a re any positive integers\n\nThe orders of the Taylor approximations. I f a range of values is specified, all Taylor approximations in that ra nge are plotted.\n\nThere are two order fields. One controls which ap proximations are plotted. The other sets the order of the polynomial \+ approximations that are displayed. \n\nThe default value for both fie lds is 1.\":\n\n###################################################### ######\n\n############################################################ \n\n\ngetTaylorPoly := proc(P_fun, P_a, P_degree)\n\n local temp, tem p2, str:\n\n use Maplets:-Tools, StringTools in\n\n temp:=Trim(P_f un):\n if temp=\"\" then \n plots[textplot]([1,1,\"Enter a valid function\"]):\n return MathML:-Export(\"Enter a valid func tion\"):\n end if:\n\n temp2:=Trim(P_a):\n if temp2=\"\" then \n plots[textplot]([1,1,\"Enter an initial point\"]):\n ret urn MathML:-Export(\"Enter an initial point\"):\n end if: \n \n \+ str:=cat(temp, \", \", temp2):\n\n temp := Trim(P_degree): \n\n \+ if temp=\"\" then\n temp2 := cat(\", order=\", 1):\n else\n temp2 := cat(\", order=\", temp):\n end if:\n\n str := c at(str, temp2):\n \n if type(parse(temp), `..`) then\n MathM L:-Export([Student:-Calculus1:-TaylorApproximation(eval(parse(str)))]) :\n else \n MathML:-Export(Student:-Calculus1:-TaylorApproxi mation(eval(parse(str)))):\n end if;\n\n end use:\n\nend proc:\n\n ############################################################\n\n###### ######################################################\n\ngetTaylorApp rox := proc(boo1, boo2, boo3, boo4, P_fun, P_a, P_x1, P_x2, P_order, P _y1, P_y2, P_iterations)\n\n local temp, temp2, str, view:\n\n use M aplets:-Tools, Student:-Calculus1, StringTools in\n\n temp:=Trim(P_ fun):\n if temp=\"\" then \n \n return plots[textplot]([1 ,1,\"Enter a valid function\"]):\n end if:\n\n temp2:=Trim(P_a): \n if temp2=\"\" then \n return plots[textplot]([1,1,\"E nter an initial point\"]):\n end if: \n str:=cat(temp, \", \", t emp2):\n\n temp:=Trim(P_x1):\n temp2:=Trim(P_x2):\n if temp<> \"\" and temp2<>\"\" then \n str:=cat(str, \", \", temp, \"..\", \+ temp2):\n end if: \n\n temp := Trim(P_order): \n\n if temp=\" \" then\n temp2 := cat(\", order=\", 1):\n else\n temp2 : = cat(\", order=\", temp):\n end if:\n \n str := cat(str, tem p2):\n \n if not boo1 then str := cat(str, \", showfunction=false\" ) end if:\n if not boo2 then str := cat(str, \", showtaylor=false\" ) end if:\n if not boo3 then str := cat(str, \", showpoint=false\") end if:\n if not(boo1 or boo2 or boo3) then \n return plots[t extplot]([1,1,\"Select function, Taylor approximations, or initial poi nt\"]):\n end if: \n\n view := [\"DEFAULT\",\"DEFAULT\"]:\n\n \+ temp:=Trim(P_x1):\n temp2:=Trim(P_x2):\n if temp<>\"\" and temp 2<>\"\" then\n view[1]:=cat(temp, \"..\", temp2):\n end if: \n \n temp:=Trim(P_y1):\n temp2:=Trim(P_y2):\n if temp<>\"\" and temp2<>\"\" then\n view[2]:=cat(temp, \"..\", temp2):\n end i f: \n\n temp:=cat(\", view=[\", view[1], \", \", view[2], \"]\"):\n str := cat(str, temp):\n\n if not boo4 then \n TaylorAppro ximation(eval(parse(str)), output=plot, functionoptions=[thickness=2], title=\" \"):\n else\n temp := Trim(P_iterations): \n te mp2 := cat(\", iterations=\", temp):\n str := cat(str, temp2):\n \+ return TaylorApproximation\n (eval(parse(str)), outpu t=animation, functionoptions=[thickness=2], title=\" \"):\n end if: \n end use:\n\nend proc:\n\n######################################### ###################\n\n############################################### #############\n\nrunTaylorApproxMaplet := proc()\n\nlocal maplet, b, s , c, dc, lc:\n\nb := 'border'=true:\ns := 'inset'=0, 'spacing'=0:\nc : = 'background'=\"#DDFFFF\":\ndc := 'background'=\"#CCFFFF\":\nlc := 'b ackground'=\"#EEFFFF\": \n\nuse Maplets:-Elements in\n\n############## ##############################################\n\nmaplet := Maplet(\n \+ 'onstartup'=RunWindow('mainWin'),\n\n################################ ############################\n\n Font['F1']('family'=\"Default\", 'bo ld'='true', 'italic'='true'),\n Font['F2']('family'=\"Default\", 'bol d'='true', 'size'=14),\n\n############################################ ################\n\n MenuBar['MB'](\n Menu(\"File\",\n MenuIt em(\"Plot\", 'onclick'='A_plot'), \n MenuItem(\"Animate\", 'oncli ck'='A_animate'),\n MenuSeparator(),\n MenuItem(\"Compute\", 'onclick'='A_getTaylorPoly'),\n MenuSeparator(),\n MenuItem (\"Close\", 'onclick'=Shutdown())\n ), # end Menu/File\n Menu(\" Help\",\n MenuItem(\"Using Number of Frames\", 'onclick'=RunWindo w('infoWin')),\n MenuItem(\"Using Order Option\", 'onclick'=RunWi ndow('infoWin2')),\n MenuSeparator(), \n MenuItem(\"Using t his Maplet\", 'onclick'=RunWindow('helpWin'))\n ) # end menu/Help\n ), # end MenuBar \n\n############################################### #############\n\n Window['mainWin']('resizable'='false', \n 'title '=\"Calculus 1 - Taylor Approximation\",\n 'menubar'='MB', \n \+ \n \n BoxColumn(s, c, \n \n BoxRow(s,c,b,'caption'=\"Enter a function and initial point\", \n Label(\"Function \", ' font'='F2', c), \n TextField['TF_fun']('width'=14, lc, 'val ue'=exp(x)),\n Label(\" at \", 'font'='F2', c), \n \+ TextField['TF_a']('value'=0, 'width'=2, lc, 'tooltip'=\"Initial poi nt\")\n ), # end BoxRow \n\n BoxRow(s, c, \n\n \+ BoxColumn(s, c, b, 'caption'=\"Plot Window\", \n Plotter ['P'](lc, continuous=false)\n ), # end BoxColumn\n \+ \n BoxColumn(s, c, \n BoxColumn(s, c, b, 'caption'=\"T aylor Polynomial\",\n BoxRow(c, 'inset'=0, 'spacing'=2, \n \+ Label(\"Enter the order = \", c),\n TextFiel d['TF_degree'](2, 'value'=1, lc)\n ), # end BoxRow\n \+ BoxRow(s, c, \n MathMLViewer['ML']('height'=140, 'wi dth'=270, lc)\n ), # end BoxRow\n\nBoxRow(s, c, \n \+ Button(\"Compute\", dc, 'onclick'='A_getTaylorPoly' )\n \+ ) # end BoxRow\n\n ), # end BoxColumn\n\n BoxCo lumn(s, c, b, 'caption'=\"Animation Controller\", \n BoxRow( c, 'inset'=0, 'spacing'=2,\n Button[B_play](\"Play\", c, ' enabled'=false, \n SetOption(P('play')=true)),\n \+ Button[B_stop](\"Stop\", c, 'enabled'=false, \n \+ SetOption(P('`stop`')=true)),\n Button[B_pause](\"Pause \", c, 'enabled'=false, \n SetOption(P('pause')=true)) \n ), # end BoxRow \n \n BoxRow(c, 'inset'=0, \+ 'spacing'=2, \n Button[B_backward](\"Backward\", c, 'enab led'=false, \n SetOption(P('frame_backwards')=true), \+ \n 'tooltip'=\"Previous frame\",'visible'='false'),\n \+ Button[B_forward](\"Forward\", c, 'enabled'=false, \n \+ SetOption(P('frame_forward')=true), 'tooltip'=\"Next frame \", 'visible'='false') \n ), # end BoxRow \n\n Box Row(c, 'inset'=0, 'spacing'=2, \n Label(\"Number of frames: \", c),\n TextField['TF_iterations']('width'=2, lc, value= 5, \n 'tooltip'=\"Number of iterations\" ),\n \+ CheckBox[CB_repeat]('visible'='false','value'=false, c,\n \+ 'caption'=\"Continuous animation\", \n 'enabled'=f alse, onchange=SetOption(target=P, `option`='continuous', \n \+ Argument(CB_repeat) )\n ) # end CheckRow\n \+ ) # end BoxRow\n ) # end BoxColumn \n ) # end BoxColumn\n), # \+ end BoxRow \n\n BoxRow(s, c, \n\n BoxColumn(s, c, \+ b, 'caption'=\"Display Options\", \n \n BoxRo w('inset'=0, 'spacing'=0, c, \n CheckBox['CB1'](true, c , 'caption'=\"Show function\"), # end CheckBox\n CheckB ox['CB2'](true, c, 'caption'=\"Show Taylor approximations\"), #endChec kBox\n CheckBox['CB3'](true, c, 'caption'=\"Show initia l point\"), # end CheckBox\n CheckBox['CB4']('value'='t rue', 'visible'='false'),\n CheckBox['CB5']('value'='fa lse', 'visible'='false') \n ), # end BoxColumn\n \+ \n BoxRow(s, c,\n Label(\"x\", 'fo nt'='F2', c), \n Label(\" = \", 'font'='F1', c),\n \+ TextField['x1'](2, lc, 'value'=\" \"), \n La bel(\" .. \", 'font'='F2', c),\n TextField['x2'](2, lc, 'value'=\" \"),\n Label(\" y\", 'font'='F2', c), \n \+ Label(\" = \", 'font'='F1', c),\n TextFiel d['y1'](2, lc, 'value'=\" \"),\n Label(\" .. \", 'font' ='F2', c),\n TextField['y2'](2, lc, 'value'=\" \"),\n \+ Label(\" Plot Order\", 'font'='F2',c),\n \+ Label(\" = \", c),\n TextField['TF_order']('value'=1, ' width'=2, lc, \n 'tooltip'=\"Orders of the Taylor ap proximations\" ) \n ) # end BoxRow\n\n ), # end Bo xColumn\n \n BoxRow('inset'=0, 'spacing'=4, c, 'hali gn'=right, 'valign'=center, \n Button['B_plot'](\" Plot \+ \", dc, 'onclick' ='A_plot' \n ), # end Button Plot\n \+ Button['B_animate'](\"Animate\", dc, 'onclick' = 'A_animate '\n ), # end Button Animate\n Button(\"Close \", dc, Shutdown()) \n ) # end BoxColumn\n\n ) # end Column\n \n ) # end BoxRow\n \n ), # end Window\n\n# ###########################################################\n\n Windo w['infoWin']( 'resizable'='false',\n 'title'=\"Using the Number of \+ Frames Text Field\",\n BoxColumn(b, c, 'inset'=0, 'spacing'=5,\n \+ BoxCell(\n TextBox('height'=12, 'width'=36, lc, 'font'='F2', \n 'editable'='false', 'value'=infoStr, 'foreground'=\"#333 399\"\n ) # end TextBox\n ), # end BoxCell\n BoxRow(s , c, \n Button(\"Close\", dc, CloseWindow('infoWin') )\n ) # end BoxRow\n ) # end BoxColumn\n ), # end infoWin\n\n######### ###################################################\n\n Window['infoW in2']( 'resizable'='false',\n 'title'=\"Using the Order option\",\n BoxColumn(b, c, 'inset'=0, 'spacing'=5,\n BoxCell(\n T extBox('height'=9, 'width'=36, lc, 'font'='F2', \n 'editable' ='false', 'value'=infoStr2, 'foreground'=\"#333399\"\n ) # end \+ TextBox\n ), # end BoxCell\n BoxRow(s, c, \n Button( \"Close\", dc, CloseWindow('infoWin2') )\n ) # end BoxRow\n ) # end BoxColumn\n ), # end infoWin\n\n############################# ###############################\n\n Window['helpWin']( 'resizable'='f alse',\n 'title'=\"Using the Taylor Approximation Maplet\",\n Bo xColumn(b, c, 'inset'=0, 'spacing'=4,\n BoxRow(s, c, \n Te xtBox('height'=21, 'width'=36, c, 'font'='F2',\n 'editable'=' false', 'value'=helpStr, 'foreground'=\"#333399\"\n ) # end Tex tBox\n ), # end BoxRow\n BoxRow(s, c, \n Button(\"Clo se\", dc, CloseWindow('helpWin') )\n ) # end BoxRow\n ) # end \+ BoxColumn\n ), # end helpWin\n\n#################################### ########################\n\n Action['A'](),\n Action['A_plot']\n ( \+ Evaluate\n ( 'waitforresult'='false',\n 'target'='P', 'functio n'='getTaylorApprox',\n Argument('CB1'),\n Argument('CB2'), \n Argument('CB3'),\n Argument('CB5'),\n Argument('TF_f un', quotedtext='true'),\n Argument('TF_a', quotedtext='true'),\n Argument('x1', quotedtext='true'),\n Argument('x2', quotedt ext='true'),\n Argument('TF_order', quotedtext='true'),\n Ar gument('y1', quotedtext='true'),\n Argument('y2', quotedtext='tru e'),\n Argument('TF_iterations', quotedtext='true')\n ),\n \+ SetOption( 'B_play'('enabled')='false'),\n SetOption( 'B_stop'('ena bled')='false'),\n SetOption( 'B_forward'('enabled')='false'),\n \+ SetOption( 'B_backward'('enabled')='false'),\n SetOption( 'B_pause '('enabled')='false'),\n SetOption( 'CB_repeat'('enabled')='false') \n ),\n\n Action['A_animate']\n ( Evaluate\n ( 'waitforresult'='f alse',\n 'target'='P', 'function'='getTaylorApprox',\n Argum ent('CB1'),\n Argument('CB2'),\n Argument('CB3'),\n Arg ument('CB4'),\n Argument('TF_fun', quotedtext='true'),\n Arg ument('TF_a', quotedtext='true'),\n Argument('x1', quotedtext='tr ue'),\n Argument('x2', quotedtext='true'),\n Argument('TF_or der', quotedtext='true'),\n Argument('y1', quotedtext='true'),\n \+ Argument('y2', quotedtext='true'),\n Argument('TF_iterations ', quotedtext='true')\n ),\n SetOption( 'B_play'('enabled')='tru e'),\n SetOption( 'B_stop'('enabled')='true'),\n SetOption( 'B_f orward'('enabled')='true'),\n SetOption( 'B_backward'('enabled')='t rue'),\n SetOption( 'B_pause'('enabled')='true'),\n SetOption( ' CB_repeat'('enabled')='true')\n ),\n Action['A_getTaylorPoly']\n ( \+ Evaluate\n ( 'waitforresult'='false', 'target'='ML', 'function'=' getTaylorPoly',\n Argument('TF_fun', quotedtext='true'),\n \+ Argument('TF_a', quotedtext='true'),\n Argument('TF_degree', qu otedtext='true')\n )\n )\n####################################### #####################\n\n): # end Maplet\n\n########################## ##################################\n\nMaplets:-Display(maplet):\n\nend use: # end use\nend proc: # end proc\n\n############################# ###############################\n\nend module: # end module\nTaylorApp roxMaplet:-runTaylorApproxMaplet();" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 14 "Antiderivat ive" }}{EXCHG {PARA 0 "" 0 "" {TEXT 276 36 "Click in red area and pres s [Enter]." }{TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 10989 "# A ntiderivative Maplet\n# Copyright 2002 Waterloo Maple Inc.\n# \n# The \+ Antiderivative maplet graphically illustrates the concept of an antide rivative of a function. \n# \n# The user enters a function f(x) and a range on the x-axis [a,b]. If the user provides an initial value for \+ the antiderivative of f(x), the maplet plots the antiderivative that s atisfies the initial value condition.\n# \n# To run this maplet, click the Execute (!!!) button in the context bar.\n# \nrestart;\nAntideriv ativeMaplet := module()\n\n########################################### #################\n\nexport getAntiderivativePlot, runAntiderivativeMa plet:\nlocal helpStr, valueStr, defStr:\n\n########################### #################################\n\n\n############################### #############################\n\nhelpStr := \n\"The Antiderivative map let graphically illustrates the concept of an antiderivative of a func tion. \n\nEnter a function f(x) and a range on the x-axis [a,b]. Cli ck 'Plot'. Provide an initial value for the antiderivative of f(x). \+ The maplet plots the antiderivative that satisfies the initial value c ondition.\":\n\ndefStr:= \n\"\nAntiderivative\n \nAn antiderivative of the function f is a function F such that D iff(F(x), x) = f(x) wherever f(x) is defined.\nab1+xf< /mi>x2&InvisibleTim es;x\n\":\n:\n\nvalueStr := \n\"This algebraic value, vector, or list deter mines the primary antiderivative. Any algebraic value, vector, or lis t can be entered. If no initial value is entered, the primary antider ivative plotted is the one for which the value at the left end point ( a) is 0. \n\nAn algebraic value, such as 0 or Pi, for this option spe cifies the value of the antiderivative at the left end point of the ra nge. A 2-dimensional Vector or list, such as [0,0], specifies the val ue of the antiderivative at a point.\":\n\n########################### #################################\n\n\n############################### #############################\n\ngetAntiderivativePlot := proc(boo1, b oo2, boo3, P_fun, P_a, P_b, P_value, P_x1, P_x2, P_y1, P_y2)\n\n loca l temp, temp2, str, view:\n \n use Maplets:-Tools in\n\n str:=Stri ngTools:-Trim(P_fun):\n if str=\"\" then \n error \"No functio n entered in the text field: TF_fun\":\n end if:\n\n temp:=Strin gTools:-Trim(P_a):\n temp2:=StringTools:-Trim(P_b):\n if temp<> \"\" and temp2<>\"\" then\n str:=cat(str, \", \", temp, \"..\", t emp2):\n end if:\n\nif not(boo1 or boo2 or boo3) then \n retur n plots[textplot]([1,2,\"Select function, antiderivative, or class of \+ antiderivatives\"]):\n end if: \n if not boo1 then str := cat(st r, \", showfunction=false\") end if:\n if not boo2 then str := cat( str, \", showantiderivative=false\") end if:\n if boo3 then str := \+ cat(str, \", showclass=true\") end if:\n\n temp:=StringTools:-Trim( P_value):\n if temp<>\"\" then\n str := cat(str, \", value=\", temp):\n end if:\n\n view := [\"DEFAULT\",\"DEFAULT\"]:\n\n \+ temp:=StringTools:-Trim(P_x1):\n temp2:=StringTools:-Trim(P_x2):\n \+ if temp<>\"\" and temp2<>\"\" then\n view[1]:=cat(temp, \"..\" , temp2):\n end if: \n\n temp:=StringTools:-Trim(P_y1):\n tem p2:=StringTools:-Trim(P_y2):\n if temp<>\"\" and temp2<>\"\" then\n view[2]:=cat(temp, \"..\", temp2):\n end if: \n\n temp:=ca t(\", view=[\", view[1], \", \", view[2], \"]\"):\n str := cat(str, temp):\n\n Student:-Calculus1:-AntiderivativePlot(eval(parse(str)) ):\n\n end use: \n\nend proc:\n\n#################################### ########################\n\n\n######################################## ####################\nrunAntiderivativeMaplet := proc()\n\nlocal maple t:\nuse Maplets:-Elements in\n\n###################################### ######################\n\nmaplet := Maplet( \n 'onstartup'=RunWindow( 'mainWin'),\n\n####################################################### #####\n\n Font['F1']('family'=\"Default\", 'bold'='true', 'italic'='t rue'),\n Font['F2']('family'=\"Default\", 'bold'='true', 'size'=14), \n\n############################################################\n\n \+ MenuBar['MB'](\n Menu(\"File\", \n MenuItem(\"Plot\",'onclick' ='A_plot'),\n MenuSeparator(),\n MenuItem(\"Close\", 'onclic k'=Shutdown())\n ), # end Menu/File\n Menu(\"Help\", \n Men uItem(\"Using this Maplet\", 'onclick'=RunWindow('helpWin'))\n ) # \+ end menu/Help\n ), # end MenuBar \n\n################################ ############################\n\n Window['mainWin']('resizable'='true' , \n 'title'=\"Calculus 1 - Antiderivative\",\n 'menubar'='MB', \+ 'defaultbutton'='B_plot', \n \n BoxRow('inset'=0, 'spacing'=0, ' background'=\"#DDFFFF\", \n\n BoxColumn('inset'=0, 'spacing'=0, \+ 'background'=\"#DDFFFF\", \n 'border'='true', 'caption'=\"Plot \+ Window\", \n Plotter['P']('background'=\"#EEFFFF\")\n ), # end BoxRow\n \n BoxColumn('inset'=0, 'spacing'=0, 'background'=\" #DDFFFF\", 'border'='false',\n\n BoxRow('inset'=0, 'spacing'=0 , 'background'=\"#DDFFFF\", \n 'border'='true', 'caption'=\"E nter a function and the plot range (optional)\", \n Label(\" Function \", 'font'='F2', 'background'=\"#DDFFFF\"), \n TextF ield['TF_fun']('width'=15, 'background'=\"#EEFFFF\", \n 'to oltip'=\"Continuous on [a,b], differentiable on (a,b)\",\n \+ 'value'=3*x^2),\n Label(\" a \", 'font'='F2', 'background'=\" #DDFFFF\"), \n Label(\" = \", 'font'='F1', 'background'=\"#DD FFFF\"), \n TextField['TF_a']('value'=-2, 'width'=3, 'backgro und'=\"#EEFFFF\", \n 'tooltip'=\"Lower end point\"),\n \+ Label(\" b \", 'font'='F2', 'background'=\"#DDFFFF\"), \n \+ Label(\" = \", 'font'='F1', 'background'=\"#DDFFFF\"), \n T extField['TF_b']('value'=2, 'width'=3, 'background'=\"#EEFFFF\", \n \+ 'tooltip'=\"Upper end point\")\n ), # end BoxRow \n \n \+ BoxRow('inset'=0, 'spacing'=2, 'background'=\"#DDFFFF\", \n \+ 'border'='true', \n 'caption'=\"Initial Value of the Primary A ntiderivative\", \n Label(\" Value\", 'font'='F2', 'backgroun d'=\"#DDFFFF\"), \n TextField['TF_value']('width'=15, \n \+ 'background'=\"#EEFFFF\", 'value'=0),\n Button(\"What is this?\", 'background'=\"#DDFFFF\", \n 'onclick'=RunWin dow(valueWin))\n ), # end BoxRow\n\n BoxRow('inset'=0, 'spac ing'=0, 'background'=\"#DDFFFF\", \n \n BoxColumn('inset'=0, 's pacing'=0, 'background'=\"#DDFFFF\", \n 'border'='true', 'cap tion'=\"Display Options\", \n \nBoxRow('inset'=0, 'spacing'= 0, 'background'=\"#DDFFFF\",\n CheckBox[CB1]('value'=true, \+ 'background'=\"#DDFFFF\", \n 'caption'=\"Show the functio n\" \n ), # end CheckBox\n CheckBox[CB2]('val ue'=true, 'background'=\"#DDFFFF\", \n 'caption'=\"Show a n antiderivative\" \n\n ) # end CheckBox\n), # end BoxRo w\n\n BoxRow('inset'=0, 'spacing'=0, 'background'=\"#DDFFFF\", \+ CheckBox[CB3]('value'=false, 'background'=\"#DDFFFF\", \n \+ 'caption'=\"Show class of antiderivatives\" \n \+ ) # end CheckBox \n ), # end BoxRow\n\n BoxRow('inset'=0, 's pacing'=0, 'background'=\"#DDFFFF\",\n Label(\"x\", 'font'= 'F2', 'background'=\"#DDFFFF\"), \n Label(\" = \", 'font'=' F1', 'background'=\"#DDFFFF\"),\n TextField['x1'](2, 'backg round'=\"#EEFFFF\", 'value'=\" \"), \n Label(\"..\", 'font' ='F2', 'background'=\"#DDFFFF\"),\n TextField['x2'](2, 'bac kground'=\"#EEFFFF\", 'value'=\" \"),\n Label(\" y\", 'font '='F2', 'background'=\"#DDFFFF\"), \n Label(\" = \", 'font' ='F1', 'background'=\"#DDFFFF\"),\n TextField['y1'](2, 'bac kground'=\"#EEFFFF\", value=\" \"),\n Label(\"..\", 'font'= 'F2', 'background'=\"#DDFFFF\"),\n TextField['y2'](2, 'back ground'=\"#EEFFFF\", value=\" \") \n ) # end BoxRow\n \+ \n )), # end BoxColumn\n\n BoxRow('inset '=0, 'spacing'=4, 'background'=\"#DDFFFF\",\n 'halign'=cent er, \n Button['B_plot'](\" Plot \", 'background'=\"#EEFFF F\", \n 'onclick'='A_plot' \n ), # end Button \n Button(\"Close\", 'background'=\"#EEFFFF\", Shutdown()) \+ \n ) # end BoxColumn\n\n ) # end BoxRow\n \n ) # e nd BoxColumn\n\n ), # end Window\n\n################################# ###########################\n\n Window['helpWin']( 'resizable'='false ',\n 'title'=\"Using the Antiderivative Maplet\",\n BoxColumn('b order'='true', 'inset'=0, 'spacing'=5,\n 'background'=\"#CCFFFF\" ,\n BoxCell(\n TextBox('height'=9, 'width'=26,\n \+ 'background'=\"#DDFFFF\", 'foreground'=\"#333399\", \n 'edita ble'='false', 'font'='F2', \n 'value'=helpStr\n ) # en d TextBox\n ), # end BoxCell\n BoxRow('inset'=0, 'spacing'=0 , 'background'=\"#CCFFFF\",\n Button(\"Close\", CloseW indow('helpWin'), \n 'background'=\"#DDFFFF\")\n ) # end BoxRow\n ) # end BoxColumn\n ), # end helpWin\n\n############### #############################################\n\n Window['valueWin']( 'resizable'='false',\n 'title'=\"The Initial Value of the Primary \+ Antiderivative\",\n BoxColumn('border'='true', 'inset'=0, 'spacing' =5,\n 'background'=\"#CCFFFF\",\n BoxCell(\n TextBox ['ML_def']('height'=15, 'width'=26, 'value'=valueStr, 'height'=15, 'wi dth'=26, 'background'=\"#CCFFFF\", 'foreground'=\"#333399\", 'font'='F 2', 'editable'='false')\n ), # end BoxRow\n BoxRow(' background'=\"#CCFFFF\", 'inset'=0, 'spacing'=0, 'background'=\"#CCFFF F\",\n Button(\"Close\", 'font'='F2', CloseWindow('valueWin'), \+ \n 'background'=\"#DDFFFF\", 'foreground'=\"#333399\")\n \+ ) # end BoxRow\n ) # end BoxColumn\n ), # end valueWin\n\n###### ######################################################\n\n Action['A' ](),\n Action['A_plot']\n ( Evaluate\n ( 'waitforresult'='false ', 'function'='getAntiderivativePlot', 'target'='P',\n Argument( 'CB1'),\n Argument('CB2'),\n Argument('CB3'),\n Argu ment('TF_fun', quotedtext='true'),\n Argument('TF_a', quotedtext ='true'),\n Argument('TF_b', quotedtext='true'),\n Argumen t('TF_value', quotedtext='true'),\n Argument('x1', quotedtext='t rue'),\n Argument('x2', quotedtext='true'),\n Argument('y1 ', quotedtext='true'),\n Argument('y2', quotedtext='true')\n \+ )\n )\n\n########################################################### #\n\n): # end Maplet\n\n############################################## ##############\n\nMaplets:-Display(maplet):\n\nend use: # end use\nend proc: # end proc\n################################################### #########\n\n\nend module: # end AntiderivativeMaplet\nAntiderivativeM aplet:-runAntiderivativeMaplet();" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 23 "Approximate Integration" }}{EXCHG {PARA 0 "" 0 "" {TEXT 277 36 "Click in red area and press [Enter]." }{TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 35264 "# Approximate Integration Maplet\n# Copyright 2002 Waterloo Map le Inc.\n# \n# The Approximate Integration maplet computes, plots, and animates approximated definite integrals of a given function f(x) ove r a given interval [a, b] using any of the following methods.\n# Riema nn sums using left, right, upper, lower, midpoint, or random points\n# Trapezoidal rule\n# Simpson's rule or Simpson's 3/8 rule\n# Bode's ru le\n# Newton-Cotes' formula \n# \n# It also provides a comparison of t he above approximations for a given function, range, and number of par titions. \n# \n# The user enters a function, and the upper and lower \+ limits (a and b) of the definite integral to approximate. \n# \n# The user selects a method for approximation and sets the number of partit ions by moving the slider.\n# \n# When the user clicks the Plot button , the definite integral of the input function from a to b is approxima ted and displayed in the plotter window. \n# \n# An animation showing how the approximation improves as the number of partitions increases \+ can be generated by setting various options and then clicking the Anim ate button. \n# \n# The user can control how an interval is subdivide d. The halve option indicates that the interval is to be subdivided in to two equal subintervals. The random option indicates that the inter val is to be randomly subdivided. \n# \n# The user can control which \+ intervals are to be subpartitioned with each iteration. The all optio n indicates that every interval is subpartitioned. The width option in dicates that the interval with greatest width is subpartitioned. If th ere is more than one interval with largest width, the leftmost is subp artitioned. The area option indicates that the interval with greatest \+ area is subpartitioned. If there is more than one interval with larges t area, the leftmost is subpartitioned. \n# \n# When the user clicks t he Compare button, a comparison of the values computed by all methods \+ is displayed.\n# \n# To run this maplet, click the Execute (!!!) butto n in the context bar.\n# \nrestart; \nApproxIntegralMaplet := module ()\n\n\n############################################################\n \nexport getApproxIntegral, runApproxIntegralMaplet, \n getPlotO ptions, getAnimationOptions, getMethod, \n getMainExpr, getParti tionExpr, getSavedStr, getupStr, getlowStr, getleftStr, getmidStr, get rightStr, gettrapStr, getsimpStr, getsimp38Str, getbodeStr, getorder5S tr, getorder6Str, getorder7Str, getorder8Str:\nlocal helpStr, savedStr , upStr, lowStr, leftStr, midStr , rightStr, trapStr, simpStr, simp38S tr, bodeStr, order5Str, order6Str,order7Str,order8Str:\n\n############ ################################################\n\n################## ##########################################\n\nhelpStr := \n\"The Appro ximate Integration maplet computes, plots, and animates approximated d efinite integrals of a given function f(x) over a given interval [a, b ] using any of the following methods.\n\267\011Riemann sums using left , right, upper, lower, midpoint, or random points\n\267\011Trapezoidal rule\n\267\011Simpson's rule or Simpson's 3/8 rule\n\267\011Bode's ru le\n. Newton-Cotes' formula \n\nIt also provides a comparison of the \+ above approximations for a given function, range, and number of partit ions. \n\nEnter a function, and the upper and lower limits (a and b) \+ of the definite integral to approximate. \nSelect a method for approx imation and set the number of partitions by moving the slider.\n\nClic k the 'Plot' button. The definite integral of the function from a to \+ b is approximated and displayed in the plotter window. \n\nTo display an animation of how the approximation improves as the number of parti tions increases, set various options and click the 'Animate' button. \+ \n\nTo control how an interval is subdivided, select 'halve' or 'rando m'. The 'halve' option indicates that the interval is to be subdivided into two equal subintervals. The 'random' option indicates that the i nterval is to be randomly subdivided. \n\nTo control which intervals \+ are to be subpartitioned with each iteration, select 'all', 'width', o r 'area'. The 'all' option indicates that every interval is subpartit ioned. The 'width' option indicates that the interval with greatest wi dth is subpartitioned. If there is more than one interval with largest width, the leftmost is subpartitioned. The 'area' option indicates th at the interval with greatest area is subpartitioned. If there is more than one interval with largest area, the leftmost is subpartitioned. \+ \n\nTo compare the values computed by all methods, click the 'Compare' button.\n \n\":\n\n################################################# ###########\n\n####################################################### #####\n\ngetSavedStr:= proc()\n savedStr;\nend:\n\ngetupStr:=proc()\n \+ upStr;\nend:\n \ngetlowStr:=proc()\n lowStr;\nend:\n\ngetleftStr:=proc ()\n leftStr;\nend:\n\ngetmidStr:=proc()\n midStr;\nend:\n\ngetrightSt r:=proc()\n rightStr;\nend:\n\ngettrapStr:=proc()\n trapStr;\nend:\n\n getsimpStr:=proc()\n simpStr;\nend:\n\ngetsimp38Str:=proc()\n simp38St r;\nend:\n\ngetbodeStr:=proc()\n bodeStr;\nend:\n\ngetorder5Str:=proc( )\n order5Str;\nend:\n\ngetorder6Str:=proc()\n order6Str;\nend:\n\nget order7Str:=proc()\n order7Str;\nend:\n\ngetorder8Str:=proc()\n order8S tr;\nend:\n\n######################################################### ###\ngetMainExpr := proc(P_fun, P_a, P_b)\n\n local temp, temp2, str, view:\n \n use Maplets:-Tools, StringTools in\n\n temp:=Trim(P_f un):\n if temp=\"\" then \n error \"No function or algebraic e xpression entered\":\n end if:\n str := temp:\n \n temp: =Trim(P_a):\n \n if temp=\"\" then \n error \"No lower limit e ntered: a = ?\":\n end if:\n \n temp2:=Trim(P_b):\n \n if temp2=\"\" then \n error \"No upper limit entered: b = ?\" :\n end if:\n str := cat(str, \", \", temp, \"..\", temp2):\n \+ \n return str:\n\n end use:\n\nend proc: # end getMainExpr\n\n#### ########################################################\n\n########## ##################################################\n\ngetPartitionExpr := proc(P_partition,P_fun, P_a, P_b)\n local str, numPartition:\n u se Maplets:-Tools, StringTools in\n numPartition:=parse(P_partition ): \n return cat(getMainExpr(P_fun, P_a, P_b), \", \", \"partition =\", numPartition ):\n end use:\nend proc: # end getPartitionExpr\n\n ############################################################\n\n###### ######################################################\n\ngetPlotOptio ns := proc(isOutline, isShowArea, isShowFunction, isShowPoints,P_x1, P _x2, P_y1, P_y2,P_partition,P_fun, P_a, P_b)\n\n local temp, temp2, s tr, view:\n \n use Maplets:-Tools, StringTools in\n\n str := getP artitionExpr(P_partition,P_fun, P_a, P_b):\n\n if isOutline=true th en\n str := cat(str, \", outline=true\"):\n end if:\n\n if \+ isShowArea=false then\n str := cat(str, \", showarea=false\"):\n \+ end if:\n\n if isShowFunction=false then\n str := cat(str, \+ \", showfunction=false\"):\n end if:\n\n if isShowPoints=false t hen\n str := cat(str, \", showpoints=false\"):\n end if: \n\n \+ view := [\"DEFAULT\",\"DEFAULT\"]:\n\n temp:=Trim(P_x1):\n te mp2:=Trim(P_x2):\n if temp<>\"\" and temp2<>\"\" then\n temp:= cat(temp, \"..\", temp2):\n view[1]:=temp:\n end if: \n\n t emp:=Trim(P_y1):\n temp2:=Trim(P_y2):\n if temp<>\"\" and temp2< >\"\" then\n temp:=cat(temp, \"..\", temp2):\n view[2]:=temp :\n end if: \n\n if not (view[1]=\"DEFAULT\" and view[2]=\"DEFAU LT\") then \n temp:=cat(\", view=[\", view[1], \", \", view[2], \+ \"]\"):\n str := cat(str, temp):\n end if:\n \n return s tr:\n\n end use:\n\nend proc: # end getPlotOptions\n\n############### #############################################\n\n##################### #######################################\n\ngetAnimationOptions := proc (P_iterations, isRandomly, isWidth,isArea)\n\n local temp, list, i, s tr:\n \n use Maplets:-Tools, StringTools in\n\n temp:=Trim(P_iter ations):\n if temp<>\"\" then \n list := [cat(\"iterations=\", temp)]:\n end if: \n\n if isRandomly=true then\n list := [o p(list), \"refinement=random\"]:\n end if:\n\n if isWidth=true t hen\n list := [op(list), \"subpartition=width\"]:\n elif isAre a=true then\n list := [op(list), \"subpartition=area\"]:\n end if:\n\n if nops(list)=0 then \n return NULL:\n else \n \+ str := \"\":\n for i from 1 to nops(list) do\n str := ca t(str, \", \", list[i]):\n end do:\n return str:\n end if : \n\n end use:\n\nend proc: # end getAnimationOptions\n\n########### #################################################\n\n################# ###########################################\n\ngetMethod := proc(way, \+ isLeft, isRight, isUp, isLow, isRandom, isTrap, isSimp, isSimp38, isBo de, isNewton,P_order)\n \n local method:\n \n use Maplets:-Tools i n \n\n if isLeft = true then\n method := \"left\":\n\n elif isRight = true then \n method := \"right\":\n\n elif isUp = t rue then \n method := \"upper\":\n\n elif isLow = true then \n method := \"lower\":\n\n elif isRandom = true then \n me thod := \"random\":\n\n elif isTrap = true then \n method := \+ \"trapezoid\":\n\n elif isSimp = true then \n method := \"simp son\":\n\n elif isSimp38 = true then \n method := \"simpson[3/ 8]\":\n\n elif isBode = true then \n method := \"bode\":\n\n \+ elif isNewton = true then \n method := StringTools:-Trim(P_orde r):\n if method=\"\" then\n error \"Enter the order of New ton-Cotes' method\":\n end if:\n method := cat(\"newtoncotes [\", method, \"]\"):\n\n else \n return NULL:\n\n end if:\n \n return cat(\", method=\", method):\n \n end use: \n\nend proc : # end ApproxIntegral\n\n############################################ ################\n\n################################################## ##########\n \ngetApproxIntegral := proc(way,P_fun, P_a, P_b,isLeft, i sRight, isUp, isLow, isRandom, isTrap, isSimp, isSimp38, isBode, isNew ton,P_order,isOutline, isShowArea, isShowFunction, isShowPoints,P_x1, \+ P_x2, P_y1, P_y2,P_iterations, isRandomly, isWidth,isArea,P_partition) \n \n local str, temp,method:\n \n use Student:-Calculus1, Maplets :-Tools, StringTools in \n \n method:= parse(way):\n if method=plo t then\n str := getPlotOptions(isOutline, isShowArea, isShowFunct ion, isShowPoints,P_x1, P_x2,\n P_y1,P_y2,P _partition,P_fun, P_a, P_b):\n str := cat(str, \n \+ getMethod(way, isLeft, isRight, isUp, isLow, isRandom, isTrap, isSimp ,\n isSimp38, isBode, isNewton,P_order)\n \+ ): \n savedStr:=evalf(ApproximateInt(parse (str))): \n ApproximateInt(parse(str), title=\" \",output=plot): \n\n elif method=animation then\n str := getPlotOptions(isOutl ine, isShowArea, isShowFunction, isShowPoints,P_x1, P_x2,\n \+ P_y1, P_y2,P_partition,P_fun, P_a, P_b):\n str : = cat\n (str, \n getMethod(way, isLeft, isRight , isUp, isLow, isRandom, isTrap, isSimp, isSimp38,\n \+ isBode, isNewton,P_order), \n getAnimationOptions(P_i terations, isRandomly, isWidth,isArea)\n ): \n \n \+ savedStr:=ApproximateInt(parse(str)): \n ApproximateInt(parse(s tr),title=\" \", output=animation):\n \n elif method=list then\n \+ str := getPartitionExpr(P_partition,P_fun, P_a, P_b):\n temp: = cat(str,\",method=upper\"):\n upStr := evalf(ApproximateInt(par se(temp)), 22): \n temp:= cat(str,\",method=lower\"):\n low Str := evalf(ApproximateInt(parse(temp)), 22): \n temp:= cat(str ,\",method=left\"):\n leftStr := evalf(ApproximateInt(parse(temp)) , 22): \n temp:= cat(str,\",method=midpoint\"):\n midStr := evalf(ApproximateInt(parse(temp)), 22): \n temp:= cat(str,\",me thod=right\"):\n rightStr:= evalf(ApproximateInt(parse(temp)), 22 ): \n temp:= cat(str,\",method=trapezoid\"):\n trapStr := e valf(ApproximateInt(parse(temp)), 22): \n temp:= cat(str,\",meth od=simpson\"):\n simpStr:= evalf(ApproximateInt(parse(temp)), 22) : \n temp:= cat(str,\",method=simpson[3/8]\"):\n simp38Str \+ := evalf(ApproximateInt(parse(temp)), 22): \n temp:= cat(str,\", method=bode\"):\n bodeStr := evalf(ApproximateInt(parse(temp)), 2 2): \n temp:= cat(str,\",method=newtoncotes[5]\"):\n order5 Str:= evalf(ApproximateInt(parse(temp)), 22): \n temp:= cat( str,\",method=newtoncotes[6]\"):\n order6Str := evalf(Approximate Int(parse(temp)), 22): \n temp:= cat(str,\",method=newtoncot es[7]\"):\n order7Str := evalf(ApproximateInt(parse(temp)), 22): \+ \n temp:= cat(str,\",method=newtoncotes[8]\"):\n order8 Str := evalf(ApproximateInt(parse(temp)), 22):\n \n\n else \n \+ ApproximateInt(parse(str)): \n\n end if:\n \n end use: \n\ne nd proc: # end getApproxIntegral\n\n################################## ##########################\n\n\n###################################### ######################\n\n# pre: null\n# post: run Inverse Function Ma plet\nrunApproxIntegralMaplet := proc()\n\nlocal maplet:\nuse Maplets: -Elements, MathML in\n\n############################################## ##############\n\nmaplet := Maplet(\n 'onstartup'=RunWindow('mainWin' ),\n\n############################################################\n\n Font['F1']('family'=\"Default\", 'bold'='true', 'italic'='true'),\n \+ Font['F2']('family'=\"Default\", 'bold'='true', 'size'=14),\n\n###### ######################################################\n\n MenuBar['M B'](\n Menu(\"File\",\n MenuItem(\"Plot\", 'onclick'='A_plot') , \n MenuItem(\"Animate\", 'onclick'='A_animate'), \n MenuSe parator(),\n MenuItem(\"Close\", 'onclick'=Shutdown())\n ), # \+ end Menu/File\n Menu(\"Compare\", \n MenuItem(\"Compare Method s\", 'onclick'=A_compare)\n ), # end menu/Compare\n Menu(\"Help \", \n MenuItem(\"Using this Maplet\", 'onclick'=RunWindow('helpW in'))\n ) # end menu/Help\n ), # end MenuBar \n\n################# ###########################################\n\n Window['mainWin']('re sizable'='false', \n 'title'=\"Calculus 1 - Approximate Integration \",\n 'menubar'='MB', 'defaultbutton'='B_plot', \n \n BoxCo lumn('inset'=0, 'spacing'=0, 'background'=\"#DDFFFF\",\n\n BoxRow ('inset'=0, 'spacing'=2, 'background'=\"#DDFFFF\", \n\n BoxRow( 'inset'=0, 'spacing'=0, 'background'=\"#DDFFFF\", \n 'border' ='true', 'caption'=\"Enter a function and interval\", \n Lab el(\"Function \", 'font'='F2', 'background'=\"#DDFFFF\"), \n \+ TextField['TF_fun']('width'=20, 'background'=\"#EEFFFF\", \n \+ 'tooltip'=\"Enter any valid function or algebraic expression\",\n \+ 'value'=sin(x)),\n Label(\" a \", 'font'='F2', 'back ground'=\"#DDFFFF\"), \n Label(\" = \", 'font'='F1', 'backgro und'=\"#DDFFFF\"), \n TextField['TF_a']('value'=0, 'width'=2, 'background'=\"#EEFFFF\", \n 'tooltip'=\"Enter the lower l imit of approximated integral\"),\n Label(\" b \", 'font'='F2 ', 'background'=\"#DDFFFF\"), \n Label(\" = \", 'font'='F1', \+ 'background'=\"#DDFFFF\"), \n TextField['TF_b']('value'=\"Pi \", 'width'=2, 'background'=\"#EEFFFF\", \n 'tooltip'=\"Ent er the upper limit of approximated integral\")\n ) # end BoxRow \n\n ), # end BoxRow \n\n BoxRow('inset'=0, 'spacing'= 0, 'background'=\"#DDFFFF\",\n \n BoxColumn('inset'=0, 'spacing '=0, 'background'=\"#DDFFFF\", \n\n BoxRow('inset'=0, 'spacin g'=0, 'background'=\"#DDFFFF\", \n 'border'='true', 'capt ion'=\"Plot Window\", \n Plotter['P']('background'=\"#EEF FFF\", 'cyclic'=true, \n 'continuous'=true, 'delay'=300 )\n ), # end BoxRow\n\n BoxColumn('inset'=0, 'spacin g'=5, 'background'=\"#DDFFFF\",\n 'border'='true', 'caption '=\"Display Options\",\n \n BoxRow('inset'=0, 'sp acing'=6, 'background'=\"#DDFFFF\",\n CheckBox[CB_showare a]('value'=true, 'background'=\"#DDFFFF\", \n 'caption' =\"Show the value of the area\" \n ), # end CheckBox\n CheckBox[CB_showfunction]('value'=true, 'background'=\"# DDFFFF\", \n 'caption'=\"Show function\" \n \+ ) # end CheckBox\n ), # BoxRow \n\n BoxRow( 'inset'=0, 'spacing'=4, 'background'=\"#DDFFFF\",\n Check Box[CB_outline]('value'=false, 'background'=\"#DDFFFF\", \n \+ 'caption'=\"Outline the boxes as a whole\" \n ), \+ # end CheckBox\n CheckBox[CB_showpoints]('value'=true, 'b ackground'=\"#DDFFFF\", \n 'caption'=\"Show points\" \+ \n ) # end CheckBox\n ), # BoxRow\n\n \+ BoxRow('inset'=0, 'spacing'=0, 'background'=\"#DDFFFF\", \n \+ Label(\"x\", 'font'='F2', 'background'=\"#DDFFFF\"), \n \+ Label(\" = \", 'font'='F1', 'background'=\"#DDFFFF\"),\n \+ TextField['x1'](2, 'background'=\"#EEFFFF\",'value'=\" \"), \+ \n Label(\" .. \", 'font'='F2', 'background'=\"#DDFFFF\") ,\n TextField['x2'](2, 'background'=\"#EEFFFF\",'value'= \" \"),\n Label(\" y\", 'font'='F2', 'background'=\"#DDFF FF\"), \n Label(\" = \", 'font'='F1', 'background'=\"#DDF FFF\"),\n TextField['y1'](2, 'background'=\"#EEFFFF\",'va lue'=\" \"),\n Label(\" .. \", 'font'='F2', 'background'= \"#DDFFFF\"),\n TextField['y2'](2, 'background'=\"#EEFFFF \",'value'=\" \") \n ) # end BoxRow \n ) \+ # end BoxColumn\n\n ), # end BoxColumn\n\n BoxColumn('ins et'=0, 'spacing'=0, 'background'=\"#DDFFFF\",\n\n BoxColumn(' inset'=0, 'spacing'=0, 'background'=\"#DDFFFF\", \n 'border '='true', 'caption'=\"Riemann Sums\", \n BoxRow('inset'=0 , 'spacing'=0, 'background'=\"#DDFFFF\", \n RadioButton ['RB_up']('caption'=\"upper\", 'group'='BG_methods', \n \+ 'background'=\"#DDFFFF\",\n 'tooltip'=\"Upper Riem ann sum\"),\n RadioButton['RB_low']('caption'=\"lower\" , 'group'='BG_methods', \n 'background'=\"#DDFFFF\", \n 'tooltip'=\"Lower Riemann sum\"),\n \+ RadioButton['RB_random']('caption'=\"random\", 'group'='BG_methods', \+ \n 'background'=\"#DDFFFF\",\n 'tool tip'=\"Random selection of point\")\n ), # end BoxRow\n \+ \n BoxRow('inset'=0, 'spacing'=0, 'background'=\"#DDFF FF\", \n RadioButton['RB_left']('caption'=\"left\", 'gr oup'='BG_methods', \n 'background'=\"#DDFFFF\",\n \+ 'tooltip'=\"Left Riemann sum\"),\n RadioB utton['RB_mid']('caption'=\"midpoint\", 'group'='BG_methods', \n \+ 'background'=\"#DDFFFF\",\n 'tooltip'=\"M idpoint Riemann sum\", 'value'=true),\n RadioButton['RB _right']('caption'=\"right\", 'group'='BG_methods', \n \+ 'background'=\"#DDFFFF\",\n 'tooltip'=\"Right Riema nn sum\")\n ) # end BoxRow\n ), # end BoxColumn \n\n BoxColumn('inset'=0, 'spacing'=0, 'background'=\"#DDFFFF \", \n 'border'='true', 'caption'=\"Newton-Cotes' Formulae \",\n BoxRow('inset'=0, 'spacing'=0, 'background'=\"#DDFFFF \", \n RadioButton['RB_trap']('group'='BG_methods',\n \+ 'caption'=\"Trapezoidal Rule\", \n \+ 'background'=\"#DDFFFF\"),\n RadioButton['RB_sim p']('group'='BG_methods',\n 'caption'=\"Simpson's Rule \", \n 'background'=\"#DDFFFF\")\n \+ ), # end BoxRow\n \n BoxRow('inset'=0, 'spacing' =0, 'background'=\"#DDFFFF\", \n RadioButton['RB_simp38'] ('group'='BG_methods',\n 'caption'=\"Simpson's 3/8 Rule \", \n 'background'=\"#DDFFFF\"),\n \+ RadioButton['RB_bode']('group'='BG_methods',\n \+ 'caption'=\"Bode's Rule\", \n 'back ground'=\"#DDFFFF\")\n ), # end BoxRow \n \n \+ BoxRow('inset'=0, 'spacing'=0, 'background'=\"#DDFFFF\", \n \+ RadioButton['RB_newton']('group'='BG_methods',\n 'c aption'=\"Newton-Cotes' Formula\", \n \+ 'background'=\"#DDFFFF\"),\n Label(\"with order = \", 'ba ckground'=\"#DDFFFF\"), \n TextField['TF_order'](2, 'valu e'=5, \n 'background'=\"#EEFFFF\")\n ) # end BoxRow\n ), # end BoxColumn\n\n BoxColumn('inset'=0 , 'spacing'=0, 'background'=\"#DDFFFF\", \n 'border'='true' , 'caption'=\"Number of Partition\",\n Slider['SL_partition ']('lower'=1, 'upper'=46,\n 'background'=\"#DDFFFF\", 'fo reground'=\"#CCFFFF\", \n 'majorticks'=9, 'minorticks'=1, 'value'=10, \n 'tooltip'=\"Initial number of equally spa ced subintervals\" \n ) # end Slider\n ), # end B oxColumn\n\n BoxRow('inset'=0, 'spacing'=0, 'background'=\"#D DFFFF\", \n 'border'='true', 'caption'=\"Approximated Area \", \n Label(\"Area\", 'font'='F2', 'background'=\"#DDFFFF \"), \n Label(\" = \", 'font'='F1', 'background'=\"#DDFFFF \"), \n TextField['TF_area']('width'=18, 'background'=\"#EE FFFF\", \n 'editable'=false, 'tooltip'=\"Approximated int egral sum\",'value'=\" \"),\n TextField['way_plot']('value' =\"plot\",'visible'='false'), \n TextField['way_ animate']('value'=\"animation\",'visible'='false'),\n TextF ield['way_list']('value'=\"list\",'visible'='false') \n \+ ), # end BoxRow\n\n BoxColumn('inset'=0, 'spacing'=0, ' background'=\"#DDFFFF\", \n 'border'='true', 'caption'=\"An imation Options\",\n BoxRow('inset'=0, 'spacing'=4, 'backgr ound'=\"#DDFFFF\", \n Button[B_play](\"Play\", 'backgroun d'=\"#EEFFFF\", 'enabled'=false, \n SetOption(P('play' )=true)),\n Button[B_stop](\"Stop\", 'background'=\"#EEFF FF\", 'enabled'=false, \n SetOption(P('`stop`')=true)), \n Button[B_pause](\"Pause\", 'background'=\"#EEFFFF\", ' enabled'=false, \n SetOption(P('pause')=true))\n \+ ), # end BoxRow\n BoxRow('inset'=0, 'spacing'=4, ' background'=\"#DDFFFF\", \n Button[B_backward](\"Backward \", 'background'=\"#EEFFFF\", 'enabled'=false, \+ SetOption(P('frame_backwards')=true), ' tooltip'=\"Previous frame\", 'visible'='false'),\n Button [B_forward](\"Forward\", 'background'=\"#EEFFFF\", 'enabled'=false, \+ \n SetOption(P('frame_forward')=true), 'tooltip'=\"Next frame\", 'visible'='false') \n ), # end BoxRow\n \n \+ BoxRow('inset'=0, 'spacing'=0, 'background'=\"#DDFFFF\",\n \+ Label(\"Number of Frames: \", 'background'=\"#DDFFFF\"),\n \+ TextField['TF_iterations']('value'=4, 'width'=3, \n \+ 'background'=\"#EEFFFF\"), \n Label(\" \"), \+ \n CheckBox[CB_repeat]('value'=true, 'background'=\"#DDFF FF\", \n 'caption'=\"Repeat animation\", 'enabled'=fals e, \n 'onchange'=SetOption(target=P, `option`='contin uous', Argument(CB_repeat) )\n ) # end CheckBox \n \+ ), # end BoxRow\n \n BoxRow('inset'=0, 'spacing'=0, \+ 'background'=\"#DDFFFF\",\n Label(\"Subdivide Interval: \+ \", 'background'=\"#DDFFFF\"),\n RadioButton['RB_halve']( 'group'='BG_refinement',\n 'caption'=\"halve\", 'value' =true, \n 'background'=\"#DDFFFF\",\n 'tooltip'=\"Halve each interval\" ),\n Ra dioButton['RB_randomly']('group'='BG_refinement',\n 'ca ption'=\"random\", \n 'background'=\"# DDFFFF\",\n 'tooltip'=\"Randomly divide each interval\" )\n ), # end BoxRow\n \n BoxRow('inset'=0, 'spa cing'=0, 'background'=\"#DDFFFF\",\n Label(\"Subpartition : \", 'background'=\"#DDFFFF\"),\n RadioButton['RB_all']( 'group'='BG_subpartition',\n 'caption'=\"all \", 'value '=true, \n 'background'=\"#DDFFFF\", \n 'tooltip'=\"Divide all partitions\" ),\n \+ RadioButton['RB_width']('group'='BG_subpartition',\n \+ 'caption'=\"width\", \n 'background' =\"#DDFFFF\",\n 'tooltip'=\"Divide partition with the l ongest width\" ),\n RadioButton['RB_area']('group'='BG_su bpartition',\n 'caption'=\"area\", \n \+ 'background'=\"#DDFFFF\",\n 'tooltip'=\" Divide partition with the largest area\" )\n ) # end BoxRow \n ), # end BoxColumn \n\n BoxRow('inset'=0, 'spacin g'=1, 'background'=\"#DDFFFF\", \n Button['B_plot'](\"Plot \", 'background'=\"#EEFFFF\", \n 'onclick'='A_plot'),\n \+ Button(\"Animate\", 'background'=\"#EEFFFF\", \n \+ 'onclick'='A_animate'),\n Button(\"Compare\", 'background '=\"#EEFFFF\", 'onclick'='A_compare',\n 'tooltip'=\"Compa re values of each method\"),\n Button(\"Close\", 'onclick'= Shutdown(), 'background'=\"#EEFFFF\")\n ) # end BoxRow\n\n \+ ) # end Column\n \n ) # end BoxRow\n \n ) # end Bo xColumn\n\n ), # end Window\n\n###################################### ######################\n\n Window['helpWin']( 'resizable'='false',\n \+ 'title'=\"Using the Approximate Integration Maplet\",\n BoxColum n('border'='true', 'inset'=0, 'spacing'=10,\n 'background'=\"#CCF FFF\",\n BoxCell(\n TextBox('height'=20, 'width'=36,\n \+ 'background'=\"#EEFFFF\", 'foreground'=\"#333399\", \n \+ 'editable'='false', 'font'='F2', \n 'value'=helpStr\n \+ ) # end TextBox\n ), # end BoxCell\n BoxRow('inset'=0, 'spac ing'=0, 'background'=\"#CCFFFF\",\n Button(\"Close\", \n \+ CloseWindow('helpWin'), \n 'background'=\"#DDFFFF\")\n \+ ) # end BoxRow\n ) # end BoxColumn\n ), # end helpWin\n\n##### #######################################################\n\n Window['c ompWin']( 'resizable'='false',\n 'title'=\" Comparison of Approxima ted Values\",\n BoxColumn('inset'=0, 'spacing'=10, 'background'=\"# DDFFFF\",\n \n GridLayout('background'=\"#DDFFFF\", 'inset'= 0,\n 'border'=true, 'caption'=\"Riemann Sums\", \n Grid Row('halign'=left, \n GridCell(Label(\"Method \", 'font'='F 2')),\n GridCell(Label(\"Approximated Integral Value\", 'font '='F2'))\n ), # GridRow\n GridRow('halign'=left, \n \+ GridCell(\" Upper Sum \", 'halign'=l eft),\n GridCell(TextField['TF_up']('background'=\"#DDFFFF\", 'value'=\" \"))\n ), # GridRow\n GridRow('halign'=left , \n GridCell(\" Lower Sum \"), \n GridCell(TextField['TF_low']('background'=\"#DDFFFF\", 'va lue'=\" \"))\n ), # GridRow\n GridRow('halign'=left, \n GridCell(\" Left Sum \"),\n GridCell(TextField['TF_left']('background'=\"#DDFFFF\", 'val ue'=\" \"))\n ), # GridRow\n GridRow('halign'=left, \n \+ GridCell(\" Midpoint \"),\n \+ GridCell(TextField['TF_mid']('background'=\"#DDFFFF\", 'value' =\" \"))\n ), # GridRow\n GridRow('halign'=left, \n \+ GridCell(\" Right Sum \"),\n \+ GridCell(TextField['TF_right']('background'=\"#DDFFFF\", 'value'= \" \"))\n ) # GridRow\n ), # end GridLayout\n\n Grid Layout('background'=\"#DDFFFF\", 'inset'=0,\n 'border'=true, 'c aption'=\"Newton-Cotes' Formulae\", \n GridRow('halign'=left, \+ \n GridCell(Label(\"Order\", 'font'='F2')), \n GridC ell(Label(\"Method \", 'font'='F2')), \n GridCell(Label( \"Approximated Integral Value\", 'font'='F2')) \n ), # GridRow \n GridRow('halign'=left, \n GridCell(\"1\"), \n \+ GridCell(\"Trapezoidal Rule \"),\n GridCell(TextFiel d['TF_trap']('background'=\"#DDFFFF\", 'value'=\" \"))\n ), # G ridRow\n GridRow('halign'=left, \n GridCell(\"2\"), \+ \n GridCell(\"Simpson's Rule \"),\n GridCell( TextField['TF_simp']('background'=\"#DDFFFF\", 'value'=\" \"))\n \+ ), # GridRow\n GridRow('halign'=left, \n GridCell( \"3\"), \n GridCell(\"Simpson's 3/8 Rule \"),\n Grid Cell(TextField['TF_simp38']('background'=\"#DDFFFF\", 'value'=\" \")) \n ), # GridRow\n GridRow('halign'=left, \n Gr idCell(\"4\"), \n GridCell(\"Bode's Rule \"),\n \+ GridCell(TextField['TF_bode']('background'=\"#DDFFFF\", 'valu e'=\" \"))\n ), # GridRow\n GridRow('halign'=left, \n \+ GridCell(\"5\"), \n\n GridCell(\"\"),\n GridC ell(TextField['TF_order5']('background'=\"#DDFFFF\", 'value'=\" \"))\n ), # GridRow\n GridRow('halign'=left, \n GridC ell(\"6\"), \n GridCell(\"\"),\n GridCell(TextField[ 'TF_order6']('background'=\"#DDFFFF\", 'value'=\" \"))\n ), # G ridRow\n GridRow('halign'=left, \n GridCell(\"7\"), \n GridCell(\"\"),\n GridCell(TextField['TF_order7'](' background'=\"#DDFFFF\", 'value'=\" \"))\n ), # GridRow\n \+ GridRow('halign'=left, \n GridCell(\"8\"), \n Grid Cell(\"\"),\n GridCell(TextField['TF_order8']('background'=\" #DDFFFF\", 'value'=\" \"))\n ) # GridRow\n ), # end GridL ayout\n \n BoxRow('inset'=0, 'spacing'=0, 'background'=\"#D DFFFF\",\n Button(\"Close\", \n CloseWindow('compWin '), \n 'background'=\"#DDFFFF\", 'foreground'=\"#333399\")\n \+ ) # end BoxRow\n\n ) # end BoxColumn\n ), # end sumWin\n\n## ##########################################################\n\n Button Group['BG_methods'](),\n ButtonGroup['BG_refinement'](),\n ButtonGro up['BG_subpartition'](),\n\n########################################## ##################\n\n Action['A_compare']\n ( \n Evaluate\n \+ ( 'waitforresult'='false','function'='getApproxIntegral',\n Ar gument('way_list'),\n Argument('TF_fun',quotedtext='true'),\n \+ Argument('TF_a',quotedtext='true'),\n Argument('TF_b',quo tedtext='true'),\n Argument(RB_left),\n Argument(RB_righ t),\n Argument(RB_up),\n Argument(RB_low),\n Argu ment(RB_random),\n Argument(RB_trap),\n Argument(RB_simp ),\n Argument(RB_simp38),\n Argument(RB_bode),\n \+ Argument(RB_newton),\n Argument('TF_order',quotedtext='true'), \n Argument(CB_outline),\n Argument(CB_showarea),\n \+ Argument(CB_showfunction),\n Argument(CB_showpoints),\n \+ Argument('x1',quotedtext='true'),\n Argument('x2',quotedtext ='true'),\n Argument('y1',quotedtext='true'),\n Argument ('y2',quotedtext='true'),\n Argument('TF_iterations',quotedtext ='true'),\n Argument(RB_randomly),\n Argument(RB_width), \n Argument(RB_area),\n Argument('SL_partition',quotedte xt='true')\n ), \n Evaluate\n ('waitforresult'='false','targe t'='TF_up','function'='getupStr'\n ),\n Evaluate\n ('waitforr esult'='false','target'='TF_low','function'='getlowStr'\n ), \n \+ Evaluate\n ('waitforresult'='false','target'='TF_left','function'=' getleftStr'\n ), \n Evaluate\n ('waitforresult'='false','targ et'='TF_mid','function'=' getmidStr'\n ), \n Evaluate\n ('wai tforresult'='false','target'='TF_right','function'='getrightStr'\n \+ ), \n Evaluate\n ('waitforresult'='false','target'='TF_trap','fu nction'='gettrapStr'\n ), \n Evaluate\n ('waitforresult'='fal se','target'='TF_simp','function'=' getsimpStr'\n ), \n Evaluate \n ('waitforresult'='false','target'='TF_simp38','function'='getsim p38Str'\n ), \n Evaluate\n ('waitforresult'='false','target'= 'TF_bode','function'=' getbodeStr'\n ), \n Evaluate\n ('waitf orresult'='false','target'='TF_order5','function'='getorder5Str'\n \+ ), \n Evaluate\n ('waitforresult'='false','target'='TF_order6',' function'='getorder6Str'\n ), \n Evaluate\n ('waitforresult'= 'false','target'='TF_order7','function'='getorder7Str'\n ), \n E valuate\n ('waitforresult'='false','target'='TF_order8','function'= 'getorder8Str'\n ), \n RunWindow('compWin') \n ), # end A_comp \n\n\nAction['A_plot']\n ( Evaluate\n ( 'waitforresult'='false' ,'target'='P','function'='getApproxIntegral',\n Argument('way_p lot',quotedtext='true'),\n Argument('TF_fun',quotedtext='true') ,\n Argument('TF_a',quotedtext='true'),\n Argument('TF_b ',quotedtext='true'),\n Argument(RB_left),\n Argument(RB _right),\n Argument(RB_up),\n Argument(RB_low),\n \+ Argument(RB_random),\n Argument(RB_trap),\n Argument(RB _simp),\n Argument(RB_simp38),\n Argument(RB_bode),\n \+ Argument(RB_newton),\n Argument('TF_order',quotedtext='tru e'),\n Argument(CB_outline),\n Argument(CB_showarea),\n \+ Argument(CB_showfunction),\n Argument(CB_showpoints),\n \+ Argument('x1',quotedtext='true'),\n Argument('x2',quoted text='true'),\n Argument('y1',quotedtext='true'),\n Argu ment('y2',quotedtext='true'),\n Argument('TF_iterations',quoted text='true'),\n Argument(RB_randomly),\n Argument(RB_wid th),\n Argument(RB_area),\n Argument('SL_partition',quot edtext='true')\n ),\n\n Evaluate\n ('waitforresult'='fals e','target'='TF_area', 'function'='getSavedStr'\n ),\n SetOpti on( 'B_play'('enabled')='false'),\n SetOption( 'B_stop'('enabled') ='false'),\n SetOption( 'B_pause'('enabled')='false'),\n SetOp tion( 'B_backward'('enabled')='false'),\n SetOption( 'B_forward'(' enabled')='false'),\n SetOption( 'CB_repeat'('enabled')='false') \+ \n ),\n \n Action['A_animate']\n ( Evaluate\n ( 'wai tforresult'='false','target'='P','function'='getApproxIntegral',\n \+ Argument('way_animate'),\n Argument('TF_fun',quotedtext='tr ue'),\n Argument('TF_a',quotedtext='true'),\n Argument(' TF_b',quotedtext='true'),\n Argument(RB_left),\n Argumen t(RB_right),\n Argument(RB_up),\n Argument(RB_low),\n \+ Argument(RB_random),\n Argument(RB_trap),\n Argumen t(RB_simp),\n Argument(RB_simp38),\n Argument(RB_bode), \n Argument(RB_newton),\n Argument('TF_order',quotedtext ='true'),\n Argument(CB_outline),\n Argument(CB_showarea ),\n Argument(CB_showfunction),\n Argument(CB_showpoints ),\n Argument('x1',quotedtext='true'),\n Argument('x2',q uotedtext='true'),\n Argument('y1',quotedtext='true'),\n \+ Argument('y2',quotedtext='true'),\n Argument('TF_iterations',q uotedtext='true'),\n Argument(RB_randomly),\n Argument(R B_width),\n Argument(RB_area),\n Argument('SL_partition' ,quotedtext='true')\n ),\n SetOption( 'B_play'('enabled')='t rue'),\n SetOption( 'B_stop'('enabled')='true'),\n SetOption ( 'B_pause'('enabled')='true'),\n SetOption( 'B_backward'('enable d')='true'),\n SetOption( 'B_forward'('enabled')='true'),\n \+ SetOption( 'CB_repeat'('enabled')='true') \n ),\n\n Action[ 'A']()\n\n############################################################ \n\n): # end Maplet\n\n############################################### #############\n\nMaplets:-Display(maplet):\n\nend use: # end use\nend \+ proc: # end proc\n\n################################################## ##########\n\nend module: # end module\nApproxIntegralMaplet:-runAppro xIntegralMaplet();" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}} {SECT 1 {PARA 3 "" 0 "" {TEXT -1 10 "Arc Length" }}{EXCHG {PARA 0 "" 0 "" {TEXT 278 36 "Click in red area and press [Enter]." }{TEXT -1 0 " " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 9654 "# Arc Length Maplet\n# Copyri ght 2002 Waterloo Maple Inc.\n# \n# The Arc Length maplet computes and graphically displays the arc length\n# of a function f(x) over an int erval [a, b].\n# The arc length of the curve y = f(x) from x = a to x \+ = b is given by \n# Int(sqrt(1+Diff(f(x),x)^2),x = a .. b);. \n# \n# \n# The user enters the function f(x) and the range [a, b]. The mapl et\n# displays the arc length of f(x) over [a, b], and plots the graph s of\n# f(x), g(x) = sqrt(1+diff(f(x),x)^2), and\n# Int(g(t),t = a \+ .. b);\n# \n# To run this maplet, click the Execute (!!!) button in th e context bar.\n# \nrestart;\nArcLengthMaplet := module()\n\n######### ###################################################\n\nexport iniMathM L, addMathML, checkBoxes, \n getArcLength, runArcLengthMaplet:\n local helpStr, defStr:\n\n############################################ ################\n\n################################################## ##########\n\nhelpStr := \n\"The Arc Length maplet computes and graphi cally displays the arc length of a function f(x) over an interval [a, \+ b].\n\nEnter the function f(x) and the range [a,b]. Click the 'Plot' b utton. The arc length of f(x) over [a, b] is displayed, and the graphs of f(x), g(x) = sqrt(1+diff(f(x),x)^2) and Int( g(t), t = a..b) are p lotted.\":\n\n######################################################## ####\n\n############################################################\n \ndefStr := \n\"\nArc L ength\n \nThe arc le ngth s of the curve y = f(x) from x=a to x=b is given by \nab1+&Diff erentialD;x fx< /mrow>2& InvisibleTimes;x\n< /mrow>\":\n\n################################################## ##########\n\n######################################################## ####\n\n# pre: iniEqn :: algebraic expression\n# post: returns the Pre sentation MathML of iniEqn\niniMathML := proc(iniEqn)\n local mathhea d, mathtail, iniStr:\n mathhead := \"\":\n mathtail \+ := \"\":\n iniStr := substring(MathML:-ExportPresenta tion(iniEqn),50..-8):\n cat(mathhead,iniStr,mathtail):\nend proc : \+ # end iniMathML\n\n################################################### #########\n\n######################################################### ###\n\n# pre: mathMLStr :: string, in form of Presentation MathML\n# \+ addEqn :: algebraic expression \naddMathML := proc(mathMLStr,addEq n)\n local startStr, inter_tag, addStr, mltail:\n startStr := subs tring(mathMLStr,1..-15):\n inter_tag := \" < mo>=\":\n addStr := substring(MathML:-ExportPresentation(addEq n),50..-8):\n mltail := \"\":\n cat(startStr,inter _tag,addStr,mltail):\nend proc : # end addMathML\n\n################## ##########################################\n\ngetArcLength := proc(boo 1, boo2, boo3)\n\n local temp, temp2, str, view, value:\n\n use Mapl ets:-Tools, Student:-Calculus1, StringTools in\n\n str:=Trim(Get('T F_fun')):\n if str=\"\" then \n Set('ML'=\"\"):\n return \+ plots[textplot]([1,1,\"Input a valid function\"]):\n end if:\n\n \+ temp:=Trim(Get('TF_a')):\n temp2:=Trim(Get('TF_b')):\n if temp= \"\" or temp2=\"\" then \n Set('ML'=\"\"):\n return plots[te xtplot]([1,1,\"Input end points/domain\"]):\n end if: \n str:=ca t(str, \", \", temp, \"..\", temp2):\n\n temp := iniMathML( ArcLeng th(parse(str), output=integral) ):\n value := ArcLength(parse(str)) :\n temp := addMathML( addMathML(temp,value), Re(evalf(value)) ): \+ \n Set('ML' = temp): \n\n if not boo1 then str := cat(str, \", s howfunction=false\") end if:\n if not boo2 then str := cat(str, \", showintegral=false\") end if:\n if not boo3 then str := cat(str, \+ \", showintegrand=false\") end if:\n if not(boo1 or boo2 or boo3) t hen \n return plots[textplot]([1,1,\"Select function, integral, o r integrand\"]):\n end if: \n\n view := [\"DEFAULT\",\"DEFAULT\" ]:\n\n temp:=Trim(Get('x1')):\n temp2:=Trim(Get('x2')):\n if \+ temp<>\"\" and temp2<>\"\" then\n view[1]:=cat(temp, \"..\", temp 2):\n end if: \n\n temp:=Trim(Get('y1')):\n temp2:=Trim(Get(' y2')):\n if temp<>\"\" and temp2<>\"\" then\n view[2]:=cat(tem p, \"..\", temp2):\n end if: \n\n temp:=cat(\", view=[\", view[1 ], \", \", view[2], \"]\"):\n str := cat(str, temp):\n\n ArcLeng th(parse(str), output=plot, functionoptions=[thickness=3]):\n\n end u se:\n\nend proc:\n\n################################################## ##########\n\n######################################################## ####\n\nrunArcLengthMaplet := proc()\n\nlocal maplet, b, s, c, dc, lc: \n\nb := 'border'=true:\ns := 'inset'=0, 'spacing'=0:\nc := 'backgroun d'=\"#DDFFFF\":\ndc := 'background'=\"#CCFFFF\":\nlc := 'background'= \"#EEFFFF\": \n\nuse Maplets:-Elements in\n\n######################### ###################################\n\nmaplet := Maplet(\n 'onstartup '=RunWindow('mainWin'),\n\n########################################### #################\n\n Font['F1']('family'=\"Default\", 'bold'='true', 'italic'='true'),\n Font['F2']('family'=\"Default\", 'bold'='true', \+ 'size'=14),\n\n####################################################### #####\n\n MenuBar['MB'](\n Menu(\"File\",\n MenuItem(\"Plot\" , 'onclick'=Evaluate('P'='getArcLength(CB1,CB2,CB3)')), \n MenuSe parator(),\n MenuItem(\"Close\", 'onclick'=Shutdown())\n ), # \+ end Menu/File\n Menu(\"Help\", \n MenuItem(\"Arc Length Defini tion\", 'onclick'=RunWindow('defWin')),\n MenuSeparator(),\n \+ MenuItem(\"Using this Maplet\", 'onclick'=RunWindow('helpWin'))\n \+ ) # end menu/Help\n ), # end MenuBar \n\n############################ ################################\n\n Window['mainWin']('resizable'='f alse', \n 'title'=\"Calculus 1 - Arc Length\",\n 'menubar'='MB', \n \n BoxRow(s, c, \n \n BoxColumn(s, c, b, 'caption' =\"Plot Window\", \n Plotter['P'](lc)\n ), # end B oxColumn\n\n BoxColumn(s, c, \n\n BoxRow(s,c,b,'captio n'=\"Enter a function and the end points of the curve\", \n \+ Label(\"Function \", 'font'='F2', c), \n TextField['TF_fu n']('width'=10, lc, 'value'=1-x^2, \n 'tooltip'=\"enter \+ a function\"),\n Label(\" a \", 'font'='F2', c), \n \+ Label(\" = \", 'font'='F1', c), \n TextField['TF_a']('v alue'=-1, 'width'=2, lc),\n Label(\" b \", 'font'='F2', c), \n Label(\" = \", 'font'='F1', c), \n TextField ['TF_b']('value'=1, 'width'=2, lc)\n ), # end BoxRow \n\n \+ BoxRow(s, c, b, 'caption'=\"Arc Length\",\n MathMLV iewer['ML']('height'=240, 'width'=320, lc)\n ), # end BoxRow \+ for MathMLViewer\n\n BoxRow(s, c, \n \n BoxColumn( s, c, b, 'caption'=\"Display Options\", \n \n \+ BoxRow(s, c, b, 'border'='false',\n CheckBox['CB1'](tru e, c, 'caption'=\"Show function\"), # end CheckBox\n Chec kBox['CB2'](true, c, 'caption'=\"Show integral\"), # end CheckBox\n \+ CheckBox['CB3'](true, c, 'caption'=\"Show integrand\") # en d CheckBox \n ), # end BoxRow\n\n Box Row(s, c,\n Label(\"x\", 'font'='F2', c), \n \+ Label(\" = \", 'font'='F1', c),\n TextField['x1']( 2, lc), \n Label(\" .. \", 'font'='F2', c),\n \+ TextField['x2'](2, lc),\n Label(\" y\", 'font'='F 2', c), \n Label(\" = \", 'font'='F1', c),\n \+ TextField['y1'](2, lc),\n Label(\" .. \", 'font'=' F2', c),\n TextField['y2'](2, lc) \n ) # e nd BoxRow\n \n ), # end BoxColumn of Op tions\n\n\n BoxColumn('inset'=0, 'spacing'=4, c, 'halign'=r ight, 'valign'=center, \n Button['B_plot'](\" Plot \", \+ dc, 'onclick' = Evaluate( \n 'P' = 'getArcLength(CB1,CB 2,CB3)' ) \n ), # end Button\n Button(\"Clo se\", dc, Shutdown()) \n ) # end BoxColumn for Buttons \n\n) ) # end BoxRow for Buttons and Options\n) ), # e nd Window\n\n######################################################### ###\n\n Window['defWin']( 'resizable'='false',\n 'title'=\"Arc Len gth Definition\", \n BoxColumn(b, 'inset'=0, 'spacing'=4, c, \n \+ BoxRow(s, c,\n MathMLViewer['ML_def']('height'=200, 'width'=3 20, 'value'=defStr, lc)\n ), # end BoxRow\n BoxRow(s, c,\n \+ Button(\"Close\", dc, CloseWindow('defWin'))\n ) # end BoxR ow\n ) # end BoxColumn\n ), # end defWin\n\n##################### #######################################\n\n Window['helpWin']( 'resiz able'='false',\n 'title'=\"Using the Arc Length Maplet\",\n BoxC olumn(b, c, 'inset'=0, 'spacing'=4,\n BoxRow(s, c, \n Text Box('height'=7, 'width'=36, c, 'font'='F2',\n 'editable'='fal se', 'value'=helpStr, 'foreground'=\"#333399\"\n ) # end TextBo x\n ), # end BoxRow\n BoxRow(s, c, \n Button(\"Close \", dc, CloseWindow('helpWin') )\n ) # end BoxRow\n ) # end Bo xColumn\n ), # end helpWin\n\n###################################### ######################\n\n Action['A']()\n\n######################### ###################################\n\n): # end Maplet\n\n############ ################################################\n\nMaplets:-Display(m aplet):\n\nend use: # end use\nend proc: # end proc\n\n############### #############################################\n\nend module: # end mod ule\nArcLengthMaplet:-runArcLengthMaplet();" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 22 "Function Average Value" }}{EXCHG {PARA 0 "" 0 "" {TEXT 279 36 "Click in red ar ea and press [Enter]." }{TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 9690 "# Function Average Maplet\n# Copyright 2002 Waterloo Maple Inc .\n# \n# The Function Average maplet computes and plots the average of a function over an interval [a,b]. \n# \n# If f is integrable on [a, b], then the average value or mean value of f on [a,b] is \n1/(b-a)*I nt(f(x),x = a .. b);\n# \n# The user enters a function. The maplet dis plays a plot of the function and its average. It also displays the cal culation of the average, including its numeric value.\n# \n# To run t his maplet, click the Execute (!!!) button in the context bar.\n# \nre start;\nFunctionAverageMaplet := module()\n\n\n####################### #####################################\n\nexport iniMathML, addMathML, \+ getFunctionAverage, runFunctionAverageMaplet:\nlocal helpStr, defStr, \+ savedStr, getLastMath:\n\n############################################ ################\n\nsavedStr:= \"\";\n\n#### ########################################################\n\nhelpStr := \n\"The Function Average maplet computes and plots the average of a f unction over an interval [a,b]. \n\nEnter a function and click the 'P lot' button. The maplet displays a plot of the function and its averag e. It also displays the calculation of the average, including its nume ric value.\":\n\n##################################################### #######\n\n\n######################################################### ###\n\ndefStr := \n\"\n \n Average value of a function\n \n If a function f is integrable on [a,b], then the average value of f on [a,b] is \n\n \n \n \n \n \n a\n b\n \n \n \n \+ f\n \n \n \+ x\n \n \n \n \+ \n \n \n \n \+ \n x\n \n \n \n \n b\n -\n a\n \n\n \n\n\":\n\n############# ###############################################\n\n\n################# ###########################################\n\n# pre: iniEqn :: algebr aic expression\n# post: returns the Presentation MathML of iniEqn\nini MathML := proc(iniEqn)\n MathML:-ExportPresentation(iniEqn);\nend pro c:\n\n############################################################\n\n \n############################################################\n\n# pr e: mathMLStr :: string, in form of Presentation MathML\n# addEqn \+ :: algebraic expression \naddMathML := proc(mathMLStr, addEqn)\n loca l tree, cmc, child, children, nl, eqnSign;\n use XMLTools in\n tre e := FromString(mathMLStr);\n cmc := ContentModelCount(tree);\n \+ child := FromString(MathML:-ExportPresentation(addEqn));\n children := ContentModel(child);\n nl := FromString(\" \");\n eqnSign := Element(\"mo\",\"=\");\n tree := AddChild(t ree,nl,cmc);\n tree := AddChild(tree,eqnSign,cmc+1);\n for child in children do \n cmc := ContentModelCount(tree);\n tree := AddChild(tree,child,cmc);\n end do:\n tree := MakeElement(\"mro w\", [], ContentModel(tree) ):\n tree := Element(\"math\", tree):\n ToString(tree):\n end use:\nend proc:\n\n######################## ####################################\ngetLastMath:=proc()\n savedStr; \nend proc:\n\n####################################################### #####\n\ngetFunctionAverage := proc(boo1, boo2,P_fun, P_x1, P_x2, P_y1 , P_y2)\n\n local temp, temp2, str, view, value:\n\n use Maplets:-To ols, Student:-Calculus1, StringTools in\n\n str:=Trim(P_fun):\n \+ if str=\"\" then \n return plots[textplot]([1,1,\"Input a v alid function\"]):\n end if:\n\n temp:=Trim(P_x1):\n temp2:=T rim(P_x2):\n if temp=\"\" or temp2=\"\" then \n \n return plots[textplot]([1,1,\"Input end points of the interval\"]):\n end if: \n str:=cat(str, \", \", temp, \"..\", temp2):\n\n temp := \+ iniMathML( FunctionAverage(parse(str), output=integral) ):\n value \+ := FunctionAverage(parse(str)):\n temp := addMathML( addMathML(temp ,value), evalf(value) ): \n savedStr:=Trim(temp): \n\n if not bo o1 then str := cat(str, \", showfunction=false\") end if:\n if not \+ boo2 then str := cat(str, \", showaverage=false\") end if:\n if not (boo1 or boo2) then \n return plots[textplot]([1,1,\"Select funct ion or average\"]):\n end if: \n\n view := [\"DEFAULT\",\"DEFAUL T\"]:\n\n temp:=Trim(P_x1):\n temp2:=Trim(P_x2):\n if temp<> \"\" and temp2<>\"\" then\n view[1]:=cat(temp, \"..\", temp2):\n \+ end if: \n\n temp:=Trim(P_y1):\n temp2:=Trim(P_y2):\n if t emp<>\"\" and temp2<>\"\" then\n view[2]:=cat(temp, \"..\", temp2 ):\n end if: \n\n temp:=cat(\", view=[\", view[1], \", \", view[ 2], \"]\"):\n str := cat(str, temp):\n\n FunctionAverage(parse(s tr), output=plot, title=\" \"):\n\n end use:\n\nend proc:\n\n######## ####################################################\n\n\n############ ################################################\n\nrunFunctionAverage Maplet := proc()\n\nlocal maplet, b, s, c, dc, lc:\n\nb := 'border'=tr ue:\ns := 'inset'=0, 'spacing'=0:\nc := 'background'=\"#DDFFFF\":\ndc \+ := 'background'=\"#CCFFFF\":\nlc := 'background'=\"#EEFFFF\": \n\nuse \+ Maplets:-Elements in\n\n############################################## ##############\n\nmaplet := Maplet(\n 'onstartup'=RunWindow('mainWin' ),\n\n############################################################\n\n Font['F1']('family'=\"Default\", 'bold'='true', 'italic'='true'),\n \+ Font['F2']('family'=\"Default\", 'bold'='true', 'size'=14),\n\n###### ######################################################\n\n MenuBar['M B'](\n Menu(\"File\",\n MenuItem(\"Plot\", 'onclick'='A_plot') , \n MenuSeparator(),\n MenuItem(\"Close\", 'onclick'=Shutdo wn())\n ), # end Menu/File\n Menu(\"Help\", \n MenuItem(\"F unction Average Definition\", 'onclick'=RunWindow('defWin')),\n M enuSeparator(),\n MenuItem(\"Using this Maplet\", 'onclick'=RunWi ndow('helpWin'))\n ) # end menu/Help\n ), # end MenuBar \n\n###### ######################################################\n\n Window['ma inWin']('resizable'='false', \n 'title'=\"Calculus 1 - Function Ave rage\",\n 'menubar'='MB', \n \n BoxRow(s, c, \n \n \+ BoxColumn(s, c, b, 'caption'=\"Plot Window\", \n Plotter['P '](lc)\n ), # end BoxColumn\n\n BoxColumn(s, c, \n\n \+ BoxRow(s,c,b,'caption'=\"Enter a function\", \n Labe l(\"Function \", 'font'='F2', c), \n TextField['TF_fun'](16 , lc, 'value'=exp(x), 'tooltip'=\"Enter a function\")\n ), # \+ end BoxRow \n\n BoxRow(s, c, b, 'caption'=\"Domain and Range \", \n Label(\"Domain\", 'font'='F2', c), \n La bel(\" = \", 'font'='F1', c),\n TextField['x1'](2, lc, 'val ue'=-2), \n Label(\" .. \", 'font'='F2', c),\n T extField['x2'](2, lc, 'value'=2),\n Label(\" Range\", 'fon t'='F2', c), \n Label(\" = \", 'font'='F1', c),\n \+ TextField['y1'](2, lc, value=\" \"),\n Label(\" .. \", 'f ont'='F2', c),\n TextField['y2'](2, lc,value=\" \") \n \+ ), # end BoxRow \n\n BoxRow(s, c, b, 'caption'=\"Funct ion Average\",\n MathMLViewer['ML']('height'=220, 'width' =240, lc)\n ), # end BoxRow\n \n BoxRow('inset'=0, ' spacing'=0, c, \n BoxRow(s, c, b, \n 'caption '=\"Display Options\", \n CheckBox['CB1']('caption'=\"Sho w function\", 'value'=true, c ), \n CheckBox['CB2']('capt ion'=\"Show average\", 'value'=true, c )\n ), # end BoxRow \n Button(\"Plot\", dc, 'tooltip'=\"Plot\", \n \+ 'onclick'='A_plot' ), \n Button(\"Close\", Shutdown(), \+ dc)\n ) # end BoxRow\n\n ) # end Column\n \n \+ ) # end BoxRow\n \n ), # end Window\n\n########################### #################################\n\n Window['defWin']( 'resizable'=' false',\n 'title'=\"Function Average Definition\", \n BoxColumn( b, 'inset'=0, 'spacing'=4, c, \n BoxRow(s, c,\n MathMLView er['ML_def']('height'=200, 'width'=300, 'value'=defStr, lc)\n ), \+ # end BoxRow\n BoxRow(s, c,\n Button(\"Close\", dc, CloseW indow('defWin'))\n ) # end BoxRow\n ) # end BoxColumn\n ), # end defWin\n\n####################################################### #####\n\n Window['helpWin']( 'resizable'='false',\n 'title'=\"Usin g the Function Average Maplet\",\n BoxColumn(b, c, 'inset'=0, 'spac ing'=4,\n BoxRow(s, c, \n TextBox('height'=9, 'width'=25, \+ c, 'font'='F2','foreground'=\"#333399\", \n 'editable'='false ', 'value'=helpStr\n ) # end TextBox\n ), # end BoxRow\n \+ BoxRow(s, c, \n Button(\"Close\", dc, CloseWindow('helpWin ') )\n ) # end BoxRow\n ) # end BoxColumn\n ), # end helpWin \n\n############################################################\n\n \+ Action['A'](),\n Action['A_plot']\n ( Evaluate\n ( 'waitforresu lt'='false','target'='P','function'='getFunctionAverage',\n Argu ment('CB1'),\n Argument('CB2'),\n Argument('TF_fun',quoted text='true'),\n Argument('x1',quotedtext='true'),\n Argume nt('x2',quotedtext='true'),\n Argument('y1',quotedtext='true'), \n Argument('y2',quotedtext='true')\n ),\n Evaluate\n \+ ('waitforresult'='false','target'='ML', 'function'='getLastMath'\n \+ )\n )\n\n######################################################### ###\n\n): # end Maplet\n\n############################################ ################\n\nMaplets:-Display(maplet):\n\nend use: # end use\ne nd proc: # end proc\n\n############################################### #############\n\nend module: # end module\nFunctionAverageMaplet:-runF unctionAverageMaplet();" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,$-%$IntG6$ -%\"fG6#%\"xG/F*;%\"aG%\"bG*$,&F.\"\"\"F-!\"\"F2" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 11 "Int egration" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 125 "This maplet guides th e user through an integration problem. The user can apply integration \+ rules one at a time to a function " }{TEXT 259 1 "f" }{TEXT -1 40 " an d view the resulting expression. The " }{TEXT 260 8 "Messages" }{TEXT -1 37 " box displays the status information." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 100 "The user enters a function wit h its independent variable. Various integration rules can be applied. \n" }}{PARA 0 "" 0 "" {TEXT -1 86 "At any time, the user can request a hint for the next step, and then apply the hint. " }}{PARA 0 "" 0 " " {TEXT -1 128 "The user can also specify that a set of rules are unde rstood, in which case those rules are automatically applied when possi ble." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }{TEXT 258 0 "" }}{PARA 0 "" 0 " " {TEXT -1 99 "At any time, the user can display all solution steps in the solution or display the final answer. " }}{PARA 0 "" 0 "" {TEXT 280 36 "Click in red area and press [Enter]." }{TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 63126 "restart:\nIntMaplet := module()\n\n### #########################################################\n\n######### ###################################################\n\nexport iniMathM L, addMathML, addMathML2, addMathML3,\n runIntMaplet, \n s tartRule, applyRule, applyOtherRule,\n applyMathFuncRule, getHin t, applyHint, \n getFinalAnswer, showAllSteps, clearSteps,\n \+ applyRuleParts, applyRuleSplit,\n applyRuleRewrite, applyRule Change,\n changeUnderstoodRules, forgetUnderstoodRule,\n a boutRule, aboutDefRule, undoLastStep, \n helpStr, partsStr, rewr iteStr, changeStr:\nlocal steps, mlSteps, iniMlStr:\nsteps:=[]: mlStep s:=[]:\niniMlStr := \"\":\n\n######################################### ###################\n\n############################################### #############\n\nhelpStr := \n\"This maplet guides you through an inte gration problem. You can apply integration rules one at a time to a fu nction f and view the resulting expression. The 'Messages' box display s the status information.\n\nEnter a function with its independent var iable. Click the 'Start' button. This clears the problem history and s tarts a new one.\n\nTo apply integration rules, click the correspondin g buttons or select rules from the 'Apply the Rule' menu.\nWhen you ap ply a rule, the display of the problem is updated with the result of t he applied rule.\nIf you understand a rule, you can select the rule fr om the 'Understood Rules' menu. The maplet then applies that rule when possible.\n\nTo show all steps in the solution, click the 'All Steps' button. \n\nTo request a hint, click the 'Obtain a Hint' button or se lect 'Receive a Hint' from the 'File' menu. To apply the hint, click t he 'Apply the Hint' button or select 'Apply the Hint' from the 'File' \+ menu.\n\nTo clear the problem history, click the 'Clear' button.\n\nTo display the final answer, click the 'Final Ans' button or select 'Get the Final Answer' from the 'File' menu.\": # end helpStr\n\n\n####### #####################################################\n\n############# ###############################################\n\npartsStr := \n\"par ts - Integrate By Parts \nsolve - Solve the Integral \n\nThe parts rul e implements integration by parts: \nInt(f(x)*g'(x),x) = f(x)*g(x) - I nt(g(x)*f'(x),x). \n\nTo apply the rule, you must specify the two func tions f(x) and g(x): \n [parts, f(x), g(x)]\n\nThat is, the first par ameter (f(x)) is the term to be differentiated, and the second paramet er (g(x)) is the integral of the term to be integrated when applying t he rule. \n\nOften after multiple applications of integration by parts , the same integral appears more than once on both sides of the equati on. You can use the 'solve' rule to solve the integral algebraically. \": # end partsStr\n\n################################################ ############\n\n###################################################### ######\n\nrewriteStr := \n\"rewrite - Rewrite the form of expression\n \n\nThe rewrite rule changes the form of the integrand when the integr ation variable is not changed. \n\nThis rule has the general form: [re write, f1(x) = g1(x), f2(x) = g2(x), ...],\n\nwhere parameters of rewr ite rule are input in the text box beside the rewrite rule button, sep arated by commas.\n\nThe effect of applying the rewrite rule is to per form each substitution listed as a parameter to the rule, where occurr ences of the left-hand side of each substitution are replaced by the c orresponding right-hand side. \": # end rewriteStr\n\n################ ############################################\n\n###################### ######################################\n\nchangeStr := \n\"change - Ch ange Integral Variable\nrevert - Revert Integral Variable\n\nThe chang e rule changes the integration variable. \n\nIt can take the following forms. \n [change, F(x,u) = G(x,u), u]\n [change, F(x,u) = G(x, u), u = H(x)]\n\nwhere parameters of rewrite rule are input in the tex t box beside the rewrite rule button, separated by commas.\n\nThe firs t parameter (F(x,u) = G(x,u)) defines the relationship between the old variable (x) and the new variable (u). This most commonly takes the f orm x = G(u) or u = F(x), but can be much more general, provided it ca n be solved for x. \n\nNote: The name of the new variable (u in the p receding paragraph) must be previously unused in the problem to which \+ you are applying this change of variables rule.\nIf you use a name whi ch has already appeared, the system creates a new name.\nOnce the inte gration has been completed, you can use the revert rule to revert to t he original variable, if necessary.\": # end revertStr\n\n############ ################################################\n\n################## ##########################################\n# pre: iniEqn :: algebraic expression\n# post: returns the Presentation MathML of iniEqn\n\niniM athML := proc(iniEqn)\n MathML:-ExportPresentation(iniEqn);\nend proc :\n\n############################################################\n\n# ###########################################################\n# pre: ma thMLStr :: string, in form of Presentation MathML\n# addEqn :: al gebraic expression\n# post: addEqn appends to the next line of mathMLS tr,\n# returns the updated mathMLStr \n\naddMathML := proc(math MLStr, addEqn)\n local tree, cmc, child, children, nl, eqnSign;\n us e XMLTools in\n tree := FromString(mathMLStr);\n cmc := ContentM odelCount(tree);\n child := FromString(MathML:-ExportPresentation(a ddEqn));\n children := ContentModel(child);\n nl := FromString( \" \");\n eqnSign := Element(\"mo\",\"=\"); \n tree := AddChild(tree,nl,cmc);\n tree := AddChild(tree,eqnSig n,cmc+1);\n for child in children do \n cmc := ContentModelCou nt(tree);\n tree := AddChild(tree,child,cmc);\n end do:\n t ree := MakeElement(\"mrow\", [], ContentModel(tree) ):\n tree := El ement(\"math\", tree):\n ToString(tree):\n end use:\nend proc:\n\n ############################################################\n\n###### ######################################################\n# pre: mathMLS tr :: string, in form of Presentation MathML\n# addEqn :: algebra ic expression\n# post: addEqn appends to the next line of mathMLStr,\n # returns the updated mathMLStr \n\naddMathML2 := proc(mathMLSt r, addEqn, rule)\n local tree, cmc, child, children, ruleName, nl, eq nSign;\n use XMLTools in\n tree := FromString(mathMLStr);\n cmc := ContentModelCount(tree);\n child := FromString(MathML:-ExportPr esentation(addEqn));\n children := ContentModel(child);\n nl := \+ FromString(\" \");\n eqnSign := Element(\"mo \",\"=\");\n ruleName := Element(\"mtext\",convert(rule,string));\n tree := AddChild(tree,nl,cmc);\n tree := AddChild(tree,eqnSign, cmc+1);\n for child in children do \n cmc := ContentModelCount (tree);\n tree := AddChild(tree,child,cmc);\n end do:\n cmc := ContentModelCount(tree);\n tree := AddChild(tree,ruleName,cmc); \n tree := MakeElement(\"mrow\", [], ContentModel(tree) ):\n tre e := Element(\"math\", tree):\n ToString(tree):\n end use:\nend pr oc:\n\n############################################################\n \n############################################################\n# pre: mathMLStr :: string, in form of Presentation MathML\n# addEqn :: algebraic expression\n# post: addEqn appends to the next line of math MLStr,\n# returns the updated mathMLStr \n\naddMathML3 := proc( mathMLStr, addEqn, rule)\n local tree, cmc, child, children, ruleName , nl, eqnSign;\n use XMLTools in\n tree := FromString(mathMLStr); \n cmc := ContentModelCount(tree);\n child := FromString(MathML: -ExportPresentation(addEqn));\n children := ContentModel(child);\n \+ nl := FromString(\" \");\n eqnSign := Ele ment(\"mo\",\"=\");\n ruleName := Element(\"mtext\",convert(rule,st ring));\n tree := AddChild(tree,nl,cmc);\n tree := AddChild(tree ,ruleName,cmc+1);\n tree := AddChild(tree,eqnSign,cmc+2);\n for \+ child in children do \n cmc := ContentModelCount(tree);\n tr ee := AddChild(tree,child,cmc);\n end do:\n tree := MakeElement( \"mrow\", [], ContentModel(tree) ):\n tree := Element(\"math\", tre e):\n ToString(tree):\n end use:\nend proc:\n\n################### #########################################\n\n######################### ###################################\n# pre: null \n# post: initializes the Integration problem solving process\n# if input is correct, integration equation is added to steps\n# understood rule(s) ap ply if capable\n# MathML Viewer updates too\n# else error \+ message shows\n\nstartRule := proc()\n local funStr, varStr, lowerStr , upperStr, intStr, \n infoStr, mlStr, intExpr, intEqn, hints, \+ \n i, uRules, uAppliedRules, rulesStr:\n use Student:-Calculus 1, Maplets:-Tools in\n \n clearSteps():\n funStr := Get('TF_f un'):\n if funStr = \"\" then \n infoStr := \"Enter a valid in tegration expression\":\n Set('info'=infoStr):\n error \"No \+ integration expression in TextField TF_fun\":\n end if: \n\n var Str := Get('TF_var'):\n if varStr = \"\" then \n infoStr := \" Enter the variable expression\":\n Set('info'=infoStr):\n er ror \"No integration var in TextField TF_var\":\n end if: \n\n l owerStr := Get('TF_lower'):\n upperStr := Get('TF_upper'):\n\n i f lowerStr<>\"\" and upperStr<>\"\" then \n intStr := cat(\"Int( \", funStr, \", \", varStr, \"=\", lowerStr, \"..\", upperStr, \")\"): \n else \n intStr := cat(\"Int(\", funStr, \", \", varStr, \") \"):\n end if: \n\n intExpr := parse(intStr):\n hints := [Hin t(intExpr)][1]:\n\n mlStr := iniMathML(GetProblem(`internal`)):\n \+ iniMlStr := mlStr:\n infoStr := \"Initializing ...\":\n Set('i nfo'=infoStr):\n \n if nops(hints)>0 then\n uRules := rhs(U nderstand(Int)):\n uAppliedRules := []:\n\n if nops(uRules) \+ > 0 then\n for i from 1 to nops(hints) do \n if member (hints[i],uRules) = true then\n uAppliedRules := [op(uAppli edRules),hints[i]]:\n end if:\n end do:\n\n int Eqn := Rule[](GetProblem(`internal`)): \n steps := [op(steps),i ntEqn]:\n\n if nops(uAppliedRules) > 0 then\n if nops( uRules) = 1 then \n rulesStr := convert(uRules,string):\n \+ infoStr := cat(\"understood rule \", rulesStr,\n \+ \" is automatically applied.\"):\n else \n \+ rulesStr := convert(uRules,string):\n infoStr := c at(\"understood rules \", rulesStr, \n \" ar e automatically applied.\"):\n end if: # end if nops(uRules)= >1\n Set('info'=infoStr):\n mlStr := addMathML(mlStr ,rhs(intEqn)):\n end if: # end if nops(uAppliedRules)>0\n \+ \n else \n intEqn := Rule[](GetProblem(`internal`)):\n \+ steps := [op(steps),intEqn]: \n \n end if: # end if nops(uR ules) > 0\n \n Set('ML'=mlStr):\n mlSteps := [op(mlStep s), mlStr]:\n infoStr := \"Apply any rule below\":\n Set('in fo'=infoStr):\n \n else \n intEqn := Rule[](GetProblem(`intern al`)): \n steps := [op(steps),intEqn]:\n Set('ML'=mlStr):\n \+ mlSteps := [op(mlSteps), mlStr]:\n infoStr := \"no hint is g iven\":\n Set('info'=infoStr):\n end if : # end if nops(hints) >0\n end use:\nend proc:\n\n######################################### ###################\n\n############################################### #############\n# pre: null \n# post: if aRule is a valid integration r ule and applicable\n# new step is stored in steps, updates MathM LViewer \n# else message shows the rule is not applied\n\napplyR ule := proc(aRule)\n local mlStr, infoStr, intEqn, oldEqn:\n use Stu dent:-Calculus1, Maplets:-Tools in\n \n if nops(steps)=0 then\n \+ startRule():\n end if:\n\n mlStr := Get('ML'):\n oldEqn \+ := steps[nops(steps)]:\n if type(aRule,list)=true then\n intEq n := Rule[op(aRule)](steps[nops(steps)]):\n else \n intEqn := \+ Rule[aRule](steps[nops(steps)]):\n end if: \n\n if (GetMessage() =NULL) or (not evalb(intEqn=oldEqn)) then\n infoStr := convert(aR ule,string):\n infoStr := cat(infoStr, \" rule is being applied\" ):\n Set('info'=infoStr):\n\n steps := [op(steps),intEqn]:\n if nops(steps)=2 then Set(undomenu(enabled)=true) end if:\n\n \+ if type(aRule,list)=true then \n if Get('RMI_single2')=true \+ then\n mlStr := addMathML2(mlStr,rhs(intEqn),aRule):\n \+ elif Get('RMI_single3')=true then\n mlStr := addMathML3(mlSt r,rhs(intEqn),aRule):\n else\n mlStr := addMathML(mlSt r,rhs(intEqn)):\n end if:\n else\n if Get('RMI_sing le2')=true then\n mlStr := addMathML2(mlStr,rhs(intEqn),[aRul e]):\n elif Get('RMI_single3')=true then\n mlStr := ad dMathML3(mlStr,rhs(intEqn),[aRule]):\n else\n mlStr := addMathML(mlStr,rhs(intEqn)):\n end if:\n end if:\n\n \+ Set('ML'=mlStr):\n mlSteps := [op(mlSteps), mlStr]:\n\n in foStr := convert(aRule,string): \n infoStr := cat(infoStr, \" rul e has been applied\"):\n Set('info'=infoStr):\n else\n in foStr := convert(aRule,string):\n infoStr := cat(infoStr, \" rule is not applicable\"):\n Set('info'=infoStr):\n end if: # end \+ if GetMessage()=NULL\n\n end use:\nend proc: # end applyRule()\n\n### #########################################################\n\n######### ###################################################\n# pre: null\n# po st: apply the integrating by parts\n# Int(f(x)*Diff(g(x),x),x) = f(x)*g(x) - Int(g(x)*Diff(f(x),x),x)\n# argument f(x) is entere d in TF_parts_fx, and arguments g(x) is \n# entered in TF_parts_ gx\n\napplyRuleParts := proc()\n local fx, gx:\n use Student:-Calcul us1, Maplets:-Tools, Maplets:-Elements in\n \n fx := Get('TF_pa rts_f'):\n gx := Get('TF_parts_g'):\n\n if fx = \"\" or gx=\"\" then \n Maplets:-Display(Maplet(\n MessageDialog(\"You m ust specify f(x) and g(x).\"))): \n else\n applyRule([parts, \+ parse(fx), parse(gx)]):\n\n end if:\n\n end use:\nend proc: # end \+ applyRuleParts\n\n#################################################### ########\n\n########################################################## ##\n# pre: null\n# post: apply the rewrite rule\n# rewrite equat ions are listed in TB_args seperated\n# by commas, the left-hand side of each substitution\n# is replaced by the corresponding r ight-hand side\n\napplyRuleRewrite := proc()\n local str:\n use Stud ent:-Calculus1, Maplets:-Tools, Maplets:-Elements in\n \n str := Get('TB_args'):\n if str = \"\" then \n Maplets:-Display(Mapl et(\n MessageDialog(\"You must specify a rewrite equation\"))) : \n \n else\n str := cat(\"rewrite, \", str):\n appl yRule([parse(str)]):\n end if:\n\n end use:\nend proc: # end apply RuleWithArgs\n\n###################################################### ######\n\n############################################################ \n# pre: null\n# post: apply the change rule, which changes the integr ation \n# variable, arguments are listed in TB_args\n\napplyRule Change := proc()\n local str:\n use Student:-Calculus1, Maplets:-Too ls, Maplets:-Elements in\n \n str := Get('TB_args'):\n if str = \"\" then \n Maplets:-Display(Maplet(\n MessageDialog( \"You must specify a change-of-variables equation\"))): \n else\n \+ str := cat(\"change, \", str):\n applyRule([parse(str)]):\n \+ end if:\n\n end use:\nend proc: # end applyRuleWithArgs\n\n####### #####################################################\n\n############# ###############################################\n# pre: null\n# post: \+ apply the definite integration rule split\n# require argument fr om TF_c\n\napplyRuleSplit := proc()\n local param:\n use Student:-Ca lculus1, Maplets:-Tools, Maplets:-Elements in\n \n param := Get( 'TF_c'):\n if ruleArgs = \"\" then \n error cat(\"no split par ameter in 'TF_c'\"): \n end if:\n applyRule([split, parse(param) ]):\n\n end use:\nend proc: # end applyRuleSplit\n################### #########################################\n\n######################### ###################################\n# pre: null \n# post: read the in tegration rule from TF_other, and apply it\n# if TF_other is emp ty, error message shows\n\napplyOtherRule := proc()\n local aRule:\n \+ use Maplets:-Tools, Maplets:-Elements in\n aRule := Get('TF_other' ):\n if aRule = \"\" then\n Maplets:-Display(Maplet(\n \+ MessageDialog(\"No rule has been entered\"))): \n else \n ap plyRule(parse(aRule)):\n end if:\n end use:\nend proc: # end apply OtherRule\n\n######################################################### ###\n\n############################################################\n# pre: null \n# post: read the integration rule from TF_mathfunc, and a pply it\n# if TF_mathfunc is empty, error message shows\n\napply MathFuncRule := proc()\n local aRule:\n use Maplets:-Tools in\n a Rule := Get('TF_mathfunc'):\n if aRule = \"\" then\n Maplets:- Display(Maplet(\n MessageDialog(\"No rule has been entered\")) ): \n else \n applyRule(parse(aRule)):\n end if:\n end us e:\nend proc: # end applyOtherRule\n\n################################ ############################\n\n###################################### ######################\n# pre: null\n# post: hint for the current inte gration problem is shown \n# in the message TextField, info\n\ng etHint := proc()\n local intEqn, hint, hints, infoStr, i:\n use Stud ent:-Calculus1, Maplets:-Tools in\n\n if nops(steps)=0 then\n \+ startRule():\n end if:\n \n intEqn := steps[nops(steps)]:\n \+ hints := [Hint(intEqn)]:\n hint := hints[1]:\n \n if nops(h int)=0 then\n infoStr:=\"No hint can be given, or the problem is \+ done\":\n Set('info'=infoStr):\n else\n infoStr:=convert( hint,string);\n if nops(hints)>1 then \n for i in hints[2. .-1] do\n infoStr := cat(infoStr, \", \", convert(i,string)); \n end do;\n end if:\n infoStr:=cat(infoStr, \" could be applied.\"):\n Set('info'=infoStr):\n end if:\n\n hint: # return value used in applyHint\n\n end use:\nend proc: # end getHi nt()\n\n############################################################\n \n############################################################\n# pre: null\n# post: hint for the current integration problem is applied \n \napplyHint := proc()\n local mlStr, infoStr, oriEqn, intEqn, hint:\n use Student:-Calculus1, Maplets:-Tools in\n\n hint := getHint(): \n if nops(hint)>0 then \n applyRule(hint):\n end if: \n\n \+ end use:\nend proc: # end applyHint\n################################ ############################\n\n###################################### ######################\n# pre: null \n# post: final answer for the cu rrent problem is shown\n\ngetFinalAnswer := proc()\n local intEqn, hi nt, mlStr, infoStr:\n use Student:-Calculus1, Maplets:-Tools in\n\n \+ if nops(steps)=0 then\n startRule():\n end if:\n\n intEqn := steps[nops(steps)]:\n hint := [Hint(intEqn)][1]: \n\n if nop s(hint)=0 then\n infoStr := \"No rule could be applied, or the qu estion is done\":\n Set('info'=infoStr):\n \n else \n m lStr := Get('ML'): \n while nops(hint)>0 do\n infoStr := \+ cat(convert(hint,string),\" is being applied.\"):\n Set('info'= infoStr):\n intEqn := Rule[hint](intEqn):\n hint := [Hin t(intEqn)][1]: \n end do:\n steps := [op(steps),intEqn]:\n \+ if nops(steps)=2 then Set(undomenu(enabled)=true) end if:\n i nfoStr := \"Exporting final answer ...\":\n mlStr := addMathML(ml Str,rhs(intEqn)):\n Set('ML'=mlStr):\n mlSteps := [op(mlStep s), mlStr]:\n infoStr := \"The final answer is displayed\":\n \+ Set('info'=infoStr):\n\n end if: # end if nops(hint)=0\n\n end u se:\nend proc: # end getFinalAnswer\n\n############################### #############################\n\n##################################### #######################\n# pre: null\n# post: a complete solution for \+ the current problem is shown\n\nundoLastStep := proc()\n local i, inf oStr, mlStr:\n use Student:-Calculus1, Maplets:-Tools in\n\n if (n ops(steps) > 1) and (not evalb(iniMlStr=\"\")) then\n steps:=[seq (steps[i], i=1..nops(steps)-1)]:\n mlSteps:=[seq(mlSteps[i], i=1. .nops(mlSteps)-1)]:\n\n Set('ML'=mlSteps[nops(mlSteps)]):\n \+ infoStr := \"Undo last step\":\n Set('info'=infoStr):\n if n ops(steps)=1 then Set(undomenu(enabled)=false) end if:\n else \n \+ infoStr := \"Undo is not available\":\n Set('info'=infoStr):\n end if : # end if nops(steps)\n\n end use:\nend proc: # end undoL astStep\n\n########################################################### #\n\n##################################################\n# pre: null\n # post: a complete solution for the current problem is shown\n\nshowAl lSteps := proc(boo1, boo2)\n local intEqn, hint, mlStr, infoStr:\n u se Student:-Calculus1, Maplets:-Tools in\n\n if nops(steps)=0 then \n startRule():\n end if:\n \n intEqn := steps[nops(step s)]:\n hint := [Hint(intEqn)][1]:\n\n if nops(hint)=0 then\n \+ infoStr := \"No rule could be applied, or the question is done\":\n \+ Set('info'=infoStr):\n \n else \n mlStr := Get('ML'):\n \n while nops(hint)>0 do\n infoStr := cat(convert(hint,str ing),\" is being applied.\"):\n Set('info'=infoStr):\n i ntEqn := Rule[hint](intEqn):\n if boo1 then\n mlStr := addMathML2(mlStr,rhs(intEqn),hint):\n elif boo2 then\n \+ mlStr := addMathML3(mlStr,rhs(intEqn),hint):\n else\n \+ mlStr := addMathML(mlStr,rhs(intEqn)):\n end if:\n ste ps := [op(steps),intEqn]:\n if nops(steps)=2 then Set(undomenu( enabled)=true) end if:\n mlSteps := [op(mlSteps),mlStr]:\n \+ hint := [Hint(intEqn)][1]: \n end do:\n \n infoStr := \+ \"Exporting the full solution ...\":\n Set('info'=infoStr):\n \+ Set('ML'=mlStr):\n infoStr := \"A complete solution is displaye d\":\n Set('info'=infoStr): \n\n end if: # end if nops(hint)= 0\n \n \n end use:\nend proc: # showAllSteps\n\n############# ###############################################\n\n################### #########################################\n# pre: name is a valid inte gration rule \n# fun is in a valid algebraic expression or functi on \n# post: pop up a Window with the description of the rule 'name'\n \naboutRule := proc(name,fun)\n local eqn, intEqn, understoodRules:\n use Student:-Calculus1, Maplets:-Tools in\n\n understoodRules := \+ rhs(Understand(Int)):\n Understand(Int,'none'):\n \n intEqn : = Int(fun,x): \n eqn := intEqn=rhs(Rule[name](intEqn)): \n\nif f un <> x^n then\n Set('ruleWin(title)'=cat(convert(name,string),\" r ule\")):\n Set('ML_rule'=MathML:-ExportPresentation(eqn)):\n\nelse \n Set('ruleWin(title)'=cat(convert(name,string),\" rule\")):\n \+ Set('ML_rule'=\n\"\n \n \n \+ \n \n x\n n\n \+ \n \n \n\n \n \n x\n \n\n \+ = \n \n\n \n x\n \n \n n\n +\n \+ 1\n \n \n\n \n\n \n n\n +\n 1\n \n\n\nif n \n \n< mtext fontsize=16 fontweight=bold> -1\n\n \"): \n\nend if;\n\n Understand(Int, op(understoodRules)): \n \n end use: \nend proc: # end aboutRule\n################################### #########################\n\n######################################### ###################\n# pre: name is a valid definite integration rule \+ \n# post: pop up a Window with the description of the rule 'name'\n\na boutDefRule := proc(name)\n local eqn, intEqn, understoodRules:\n us e Student:-Calculus1, Maplets:-Tools in\n\n understoodRules := rhs( Understand(Int)):\n Understand(Int,'none'):\n \n if name=flip t hen\n intEqn := Int(f(x),x=a..b): \n eqn := intEqn=rhs(Rule[ flip](intEqn)): \n elif name=join then\n intEqn := Int(f(x),x =a..c)+Int(f(x),x=c..b):\n eqn := intEqn=rhs(Rule[join](intEqn)): \n else\n intEqn := Int(f(x),x=a..b): \n eqn := intEqn= rhs(Rule[split,c](intEqn)): \n end if:\n\n Set('ruleWin(title)' =cat(convert(name,string),\" rule\")):\n # Set('ML_rule'=MathML:-Ex portPresentation(eqn)):\n\n Understand(Int, op(understoodRules)): \+ \n \n return MathML:-ExportPresentation(eqn):\n end use: \nend p roc: # end aboutRule\n\n############################################## ##############\n\n#################################################### ########\n# pre: aRule is a valid integration rule\n# post: if ruleSta te=true, aRule is understood\n# else, aRule is removed from unde rsto0d integration rules\n\nchangeUnderstoodRules := proc(aRule, ruleS tate)\n use Student:-Calculus1 in\n if ruleState=true then \n \+ Understand(Int,aRule):\n else\n forgetUnderstoodRule(aRule): \n end if:\n end use: \nend proc: # end changeUnderstoodRules\n\n# ###########################################################\n\n####### #####################################################\n# pre: aRule is a valid integration rule \n# post: aRule is removed from understood i ntegration rules\n\nforgetUnderstoodRule := proc(aRule)\n local rules :\n use Student:-Calculus1 in\n rules := rhs(Understand(Int)):\n \+ rules := subs(aRule=NULL,rules):\n Understand(Int,'none'):\n i f nops(rules)>0 then\n Understand(Int,op(rules));\n end if:\n \+ end use:\nend proc:\n################################################ ############\n\n###################################################### ######\n# pre: null\n# post: clears the historic record of all steps\n \nclearSteps := proc()\n use Student:-Calculus1, Maplets:-Tools in\n \+ Set('ML'=\"\"): Set('info'=\"\"): \n Clear(all): steps:=[]: mlSt eps:=[]:\n Set(undomenu(enabled)=false) \n end use:\nend proc: # e nd clearSteps()\n\n################################################### #########\n\n######################################################### ###\n# pre: Maple 8 or higher is installed\n# post: run Step-by-Step I ntegration Solver\n\nrunIntMaplet := proc()\n\nlocal maplet, bc, dc, l c:\nbc := 'background'=\"#DDFFFF\":\ndc := 'background'=\"#CCFFFF\":\n lc := 'background'=\"#EEFFFF\":\n\nuse Maplets, Maplets:-Elements, Stu dent:-Calculus1 in\n\nmaplet := Maplet( \n 'onstartup'=RunWindow('int Win'),\n\n############################################################ \n\n Font['F1'](\"Default\", 'bold'='true', 'size'=14),\n Font['F2'] (\"Default\", 'italic'='true', 'size'=12), \n\n####################### #####################################\n \n Window['intWin']( 'menuba r'='intMB',\n 'resizable'='false', \n 'title'=\"Calculus 1 - Ste p-by-Step Integration Solver\",\n BoxColumn(bc, \n\n BoxRow('b order'='true','inset'=0,'spacing'=0, \n 'caption'=\"Enter a fun ction\", bc, \n Label('caption'=\"Function \", 'font'='F1',bc) ,\n TextField['TF_fun']('value'=3*sin(x), 'width'=22, lc),\n \+ Label('caption'=\" Variable \", 'font'='F1',bc), \n TextF ield['TF_var'](\"x\",4,lc),\n Label('caption'=\" from \", 'font '='F1', bc),\n TextField['TF_lower']('width'=5, lc),\n L abel('caption'=\" to \", 'font'='F1',bc), \n TextField['TF_upp er']('width'=5, lc) \n ), # end BoxRow\n\n BoxRow('inset'=0 ,'spacing'=0, bc, \n BoxColumn('border'='true', 'inset'=0, 'spa cing'=0, \n 'caption'=\"Problem status\", bc, \n Box Row(MathMLViewer['ML']('height'=470, 'width'=400, lc), bc),\n \+ BoxRow('halign'='right', bc,\n Button(\"Start\", \n \+ 'onclick'=Evaluate('function'='startRule()'),\n 't ooltip'=\"Initialize to find a integration\", lc),\n Button (\"Final Ans\", \n 'onclick'=Evaluate('function'='getFina lAnswer()'),\n 'tooltip'=\"Get the final answer\", lc), \+ \n Button(\"All Steps\", \n 'onclick'=Evaluate ('function'='showAllSteps(RMI_all2, RMI_all3)'),\n 'toolt ip'=\"Show a complete solution\", lc),\n Button(\"Clear\", \+ \n 'onclick'=Evaluate('function'='clearSteps()'),\n \+ 'tooltip'=\"Clear output and problem history\", lc),\n \+ Button(\"Close\", Shutdown(), 'tooltip'=\"close\", lc) \n \+ ) # end BoxRow\n ), # end BoxColumn\n\n BoxColumn('inse t'=0, 'inset'=0, 'spacing'=0, bc, \n\n BoxRow('border'='true' , 'caption'=\"Messages\", \n 'inset'=0, 'spacing'=0, b c, \n BoxCell(\n TextBox['info']('editable'=' false',\n 'value'=\"\", lc, \n 'tooltip' =\"Message\", \n 'height'=4, 'width'=24 \n \+ ) # end TextBox\n ) # end BoxCell\n ), # end Box Row \n\n BoxRow('border'='true', 'caption'=\"Hints\" , \n 'inset'=0, 'spacing'=10, bc, \n BoxCe ll(Button['B_getHint'](\"Obtain a Hint\", \n 'onclic k'=Evaluate('function'='getHint()'), \n 'tooltip'=\" Receive a Hint\", lc)),\n BoxCell(Button['B_applyHint'](\"A pply the Hint\", \n 'onclick'=Evaluate('function'='a pplyHint()'), \n 'tooltip'=\"Apply the Hint\", lc)) \n ), # end BoxRow\n\n BoxColumn('border'='true', 'i nset'=0, 'spacing'=0,\n 'caption'=\"Integration Ru les\", bc, \n BoxRow('halign'='left', 'inset'=0, 'spacing'= 3, bc,\n BoxCell('halign'='left',\n Button ['B_constant'](\" Constant \", lc, \n Evaluate('func tion'='applyRule(constant)'), \n 'tooltip'=\"Int(c, x )= c*x or Int(c, x=a..b) = c*b - c*a\")\n ), # BoxCell\n \+ BoxCell('halign'='left',\n Button['B_const antmultiple'](\" Constant Multiple\", lc, \n Evaluat e('function'='applyRule(constantmultiple)'), \n 'tool tip'=\"Int(c*f(x)) = c*Int(f(x))\")\n ) # BoxCell\n \+ ), # BoxRow\n\n BoxRow('halign'='left', 'inset'=0, 's pacing'=1, bc, \n BoxCell('halign'='left',\n \+ Button['B_identity'](\"Identity\", lc, \n Evaluate ('function'='applyRule(identity)'), \n 'tooltip'=\"In t(x,x) = x^2/2\")\n ), # BoxCell\n BoxCell(' halign'='left',\n Button['B_sum'](\"Sum\", lc, \n \+ Evaluate('function'='applyRule(sum)'), \n \+ 'tooltip'=\"Apply sum rule: Int(f(x)+g(x)) = Int(f(x)) + Int(g(x))\") \n ), # BoxCell\n BoxCell('halign'='left',\n Button['B_difference'](\"Difference\", lc, \n \+ Evaluate('function'='applyRule(difference)'), \n \+ 'tooltip'=\"Int(f(x)-g(x)) = Int(f(x)) - Int(g(x))\")\n \+ ) # BoxCell\n ), # BoxRow\n\n BoxRow('halign '='left', 'inset'=0, 'spacing'=5, bc,\n BoxCell('halign'= 'left',\n Button['B_power'](\"Power \", lc, \n \+ Evaluate('function'='applyRule(power)'), \n \+ 'tooltip'=\"Int(x^n, x) = x^(n+1)/(n+1)\")\n ), # BoxCell \n BoxCell('halign'='left',\n Button['B_re vert'](\" Revert \", lc, \n Evaluate('function'='appl yRule(revert)'),\n 'tooltip'=\"Reverts a change of va riables substitution\")\n ), # BoxCell\n Box Cell('halign'='left', \n Button['B_solve'](\" Solve \", lc, \n Evaluate('function'='applyRule(solve)'), \n \+ 'tooltip'=\"Algebraically solve for the integral appea red more than once\")\n ) # end BoxCell\n ) # \+ end BoxRow\n ), # end Column\n\n BoxColumn('border'= 'true', 'inset'=0, 'spacing'=0,\n 'caption'=\"Inte gration Rules with Arguments\", bc,\n BoxRow('inset'=0, 'sp acing'=0, bc,\n Button['B_parts'](\"Int By Parts\", lc, \+ \n 'onclick'=Evaluate('function'='applyRuleParts()'), \+ \n 'tooltip'=\"Int(f(x)*Diff(g(x),x),x) = f(x)*g(x)-Int (g(x)*Diff(f(x),x),x)\" ),\n Label(\" f(x)=\", dc), \n \+ TextField['TF_parts_f']('width'=3, lc), \n Label(\" \+ g(x)=\", dc), \n TextField['TF_parts_g']('width'=3, lc) \+ \n ), # end BoxRow\n \n BoxRow('inset'=0, 'sp acing'=0, bc,\n BoxColumn('halign'='left', 'inset'=0, 'sp acing'=0, bc, \n Button['B_rewrite'](\"Rewrite \", lc, \+ \n 'onclick'=Evaluate('function'='applyRuleRewrite()' ), \n 'tooltip'=\"Change the form of the expression\" ),\n Button['B_change'](\"Change\", lc, \n \+ 'onclick'=Evaluate('function'='applyRuleChange()'), \n \+ 'tooltip'=\"Change the variable of the integration\")\n \+ ), # BoxColumn\n TextBox['TB_args'](\n \+ 'value'=\"\", lc,\n 'tooltip'=\"Arguments of the Rul es\", \n 'height'=2, 'width'=22 \n ) # en d TextBox\n ) # end BoxRow\n ), # end BoxColumn \n \n BoxColumn('border'='true', 'inset'=0, 'spacing'=0,\n \+ 'caption'=\"Function Rules\", bc, \n BoxRow ('halign'='left', 'inset'=0, 'spacing'=0, bc, \n Label(' caption'=\"Enter a Function: \", bc),\n TextField['TF_ma thfunc']('width'=6, lc)\n ), # end BoxRow\n Bo xRow('halign'='left', 'inset'=0, 'spacing'=5, bc, \n But ton['B_applyMathFunc'](\"Apply\", lc,\n Evaluate('func tion'='applyMathFuncRule()')),\n Button['B_selectMathfun c'](\"Select a Function\", \n 'onclick'=RunWindow('math funcWin'), lc)\n ) # end BoxRow\n ), # end BoxCol umn \n\n BoxRow('border'='true', 'inset'=0, 'spacing'=3,\n \+ 'caption'=\"Definite Integral Rules\", bc, \n \+ Button(\"Flip\", lc, \n Evaluate('function'='applyRul e(flip)'), \n 'tooltip'=\"Int(f(x),x=a..b) = -Int(f(x),x= b..a)\" ),\n Button(\"Join\", lc, \n Evaluate ('function'='applyRule(join)'), \n 'tooltip'=\"Int(f(x),x =a..c) + Int(f(x),x=c..b) = Int(f(x),x=a..b)\" ),\n Button( \"Split\", lc, \n 'onclick'=Evaluate('function'='applyRu leSplit()'), \n 'tooltip'=\"Int(f(x),x=a..b) = Int(f(x),x =a..c) + Int(f(x),x=c..b)\" ), \n Label(\" at \", dc), \n \+ TextField['TF_c']('width'=2, lc)\n ) # end BoxRow\n \n ) # end BoxColumn \n ) # end BoxRow\n\n ) # end Box Column\n ), # end Window\n\n######################################### ###################\n\n Window['mathfuncWin']('resizable'='false',\n \+ 'title'=\"Select a Mathematical Function\",\n 'defaultbutton'='B _close2',\n BoxColumn(bc, \n\n BoxRow('border'='true', 'inset' =1, 'spacing'=5, bc, \n 'caption'=\"Exponential and Logarithmic Functions\", \n Button['B_exp'](\"Natural Exponential\", lc,\n 'onclick'=Action(\n SetOption('TF_mathfunc'=\"ex p\"),\n CloseWindow('mathfuncWin'), \n Evaluat e('function'='applyRule(exp)')) \n ), # end Button exp\n \+ Button['B_ln'](\"Natural Logarithmic\", lc,\n 'onclick'=Acti on(\n SetOption('TF_mathfunc'=\"ln\"),\n Close Window('mathfuncWin'), \n Evaluate('function'='applyRule(l n)')) \n ) # end Button ln\n ), # end BoxRow\n\n Grid Layout('border'='true', 'inset'=1, bc, \n 'caption'=\"Trigonome tric, Hyperbolic Functions and their Inverses\",\n\n GridRow(\n GridCell(Button['B_sin'](\" sin \", lc,\n 'o nclick'=Action(\n SetOption('TF_mathfunc'=\"sin\"),\n \+ CloseWindow('mathfuncWin'), \n Evaluate('fun ction'='applyRule(sin)') ) \n )), # end Button/GridCell\n \+ GridCell(Button['B_cos'](\" cos \", lc,\n 'oncli ck'=Action(\n SetOption('TF_mathfunc'=\"cos\"),\n \+ CloseWindow('mathfuncWin'), \n Evaluate('function'= 'applyRule(cos)')) \n )), # end Button/GridCell\n Gr idCell(Button['B_tan'](\" tan \", lc,\n 'onclick'=Acti on(\n SetOption('TF_mathfunc'=\"tan\"),\n \+ CloseWindow('mathfuncWin'), \n Evaluate('function'='appl yRule(tan)') ) \n )), # end Button/GridCell\n GridC ell(Button['B_cot'](\" cot \", lc,\n 'onclick'=Action( \n SetOption('TF_mathfunc'=\"cot\"),\n Clo seWindow('mathfuncWin'), \n Evaluate('function'='applyRu le(cot)') ) \n )), # end Button/GridCell\n GridCell( Button['B_sec'](\" sec \", lc,\n 'onclick'=Action(\n \+ SetOption('TF_mathfunc'=\"sec\"),\n CloseWi ndow('mathfuncWin'), \n Evaluate('function'='applyRule(s ec)') ) \n )), # end Button/GridCell\n GridCell(Butt on['B_csc'](\" csc \", lc,\n 'onclick'=Action(\n \+ SetOption('TF_mathfunc'=\"csc\"),\n CloseWindow ('mathfuncWin'), \n Evaluate('function'='applyRule(csc)' ) ) \n )) # end Button/GridCell\n ), # end GridRow\n \+ \n GridRow(\n GridCell(Button['B_arcsin'](\" arcsin \", lc,\n 'onclick'=Action(\n SetOption('TF_ mathfunc'=\"arcsin\"),\n CloseWindow('mathfuncWin'), \n \+ Evaluate('function'='applyRule(arcsin)') ) \n ) ), # end Button/GridCell\n GridCell(Button['B_arccos'](\" arc cos \", lc,\n 'onclick'=Action(\n SetOption(' TF_mathfunc'=\"arccos\"),\n CloseWindow('mathfuncWin'), \+ \n Evaluate('function'='applyRule(arccos)') ) \n \+ )), # end Button/GridCell\n GridCell(Button['B_arctan'](\" \+ arctan \", lc,\n 'onclick'=Action(\n SetOptio n('TF_mathfunc'=\"arctan\"),\n CloseWindow('mathfuncWin' ), \n Evaluate('function'='applyRule(arctan)') ) \n \+ )), # end Button/GridCell\n GridCell(Button['B_arccot']( \" arccot \", lc,\n 'onclick'=Action(\n SetOp tion('TF_mathfunc'=\"arccot\"),\n CloseWindow('mathfuncW in'), \n Evaluate('function'='applyRule(arccot)') ) \n \+ )), # end Button/GridCell\n GridCell(Button['B_arcsec '](\" arcsec \", lc,\n 'onclick'=Action(\n Se tOption('TF_mathfunc'=\"arcsec\"),\n CloseWindow('mathfu ncWin'), \n Evaluate('function'='applyRule(arcsec)') ) \+ \n )), # end Button/GridCell\n GridCell(Button['B_ar ccsc'](\" arccsc \", lc,\n 'onclick'=Action(\n \+ SetOption('TF_mathfunc'=\"arccsc\"),\n CloseWindow('ma thfuncWin'), \n Evaluate('function'='applyRule(arccsc)') ) \n )) # end Button/GridCell\n ), # end GridRow\n \+ \n GridRow(\n GridCell(Button['B_sinh'](\" sinh \", lc,\n 'onclick'=Action(\n SetOption('TF_math func'=\"sinh\"),\n CloseWindow('mathfuncWin'), \n \+ Evaluate('function'='applyRule(sinh)') ) \n )), # end Button/GridCell\n GridCell(Button['B_cosh'](\" cosh \", l c,\n 'onclick'=Action(\n SetOption('TF_mathfu nc'=\"cosh\"),\n CloseWindow('mathfuncWin'), \n \+ Evaluate('function'='applyRule(cosh)') ) \n )), # end B utton/GridCell\n GridCell(Button['B_tanh'](\" tanh \", lc, \n 'onclick'=Action(\n SetOption('TF_mathfunc '=\"tanh\"),\n CloseWindow('mathfuncWin'), \n \+ Evaluate('function'='applyRule(tanh)') ) \n )), # end But ton/GridCell\n GridCell(Button['B_coth'](\" coth \", lc,\n 'onclick'=Action(\n SetOption('TF_mathfunc'= \"coth\"),\n CloseWindow('mathfuncWin'), \n \+ Evaluate('function'='applyRule(coth)') ) \n )), # end Butto n/GridCell\n GridCell(Button['B_sech'](\" sech \", lc,\n \+ 'onclick'=Action(\n SetOption('TF_mathfunc'=\" sech\"),\n CloseWindow('mathfuncWin'), \n \+ Evaluate('function'='applyRule(sech)') ) \n )), # end Button/ GridCell\n GridCell(Button['B_csch'](\" csch \", lc,\n \+ 'onclick'=Action(\n SetOption('TF_mathfunc'=\"cs ch\"),\n CloseWindow('mathfuncWin'), \n Ev aluate('function'='applyRule(csch)') ) \n )) # end Button/Gri dCell\n ), # end GridRow\n\n GridRow(\n GridCel l(Button['B_arcsinh'](\"arcsinh\", lc,\n 'onclick'=Action( \n SetOption('TF_mathfunc'=\"arcsinh\"),\n \+ CloseWindow('mathfuncWin'), \n Evaluate('function'='app lyRule(arcsinh)') ) \n )), # end Button/GridCell\n G ridCell(Button['B_arccosh'](\"arccosh\", lc,\n 'onclick'=Ac tion(\n SetOption('TF_mathfunc'=\"arccosh\"),\n \+ CloseWindow('mathfuncWin'), \n Evaluate('function' ='applyRule(arccosh)') ) \n )), # end Button/GridCell\n \+ GridCell(Button['B_arctanh'](\"arctanh\", lc,\n 'onclic k'=Action(\n SetOption('TF_mathfunc'=\"arctanh\"),\n \+ CloseWindow('mathfuncWin'), \n Evaluate('func tion'='applyRule(arctanh)') ) \n )), # end Button/GridCell\n \+ GridCell(Button['B_arccoth'](\"arccoth\", lc,\n 'o nclick'=Action(\n SetOption('TF_mathfunc'=\"arccoth\"), \n CloseWindow('mathfuncWin'), \n Evaluate ('function'='applyRule(arccoth)') ) \n )), # end Button/GridC ell\n GridCell(Button['B_arcsech'](\"arcsech\", lc,\n \+ 'onclick'=Action(\n SetOption('TF_mathfunc'=\"arcsec h\"),\n CloseWindow('mathfuncWin'), \n Eva luate('function'='applyRule(arcsech)') ) \n )), # end Button/ GridCell\n GridCell(Button['B_arccsch'](\"arccsch\", lc,\n \+ 'onclick'=Action(\n SetOption('TF_mathfunc'=\"a rccsch\"),\n CloseWindow('mathfuncWin'), \n \+ Evaluate('function'='applyRule(arccsch)') ) \n )) # end But ton/GridCell\n ) # end GridRow\n\n ), # end GridLayout\n\n BoxRow('border'='true', 'inset'=1, 'spacing'=5, bc, \n 'c aption'=\"Other Maple Mathematical Functions\", \n Label('capti on'=\"Enter a Maple Mathematical Function: \", bc),\n TextField ['TF_other'](15, lc),\n Button['B_other'](\"Apply\",'onclick'=' A_other', lc)\n ), # end BoxRow\n\n BoxRow( Button['B_close2 '](\"Close\",CloseWindow('mathfuncWin'), lc), bc )\n\n ) # end BoxC olumn\n ), # end Window\n \n######################################### ###################\n\n Window['argRuleWin']('defaultbutton'='closeAr gRuleWin',\n 'title'=\"Using Rules with Arguments\",\n 'resizabl e'='false',\n BoxColumn('inset'=6, 'spacing'=6, bc, \n BoxCe ll(\n TextBox['TB_argRule']('height'=15, 'width'=40, lc, \n \+ 'editable'='false', 'font'='F2', \n 'value'=\"Cl ick the button below to see the description\"\n ) # end TextB ox\n ), # end BoxCell\n BoxRow('inset'=0, 'spacing'=12, bc, \+ \n Button(\"Parts and Solve\", lc, \n 'onclick'=Se tOption('TB_argRule'=partsStr)),\n Button(\"Rewrite\", lc, \n \+ 'onclick'=SetOption('TB_argRule'=rewriteStr)),\n But ton(\"Change and Revert\", lc, \n 'onclick'=SetOption('TB_ argRule'=changeStr)),\n Button['closeArgRuleWin'](\"Close\", Clo seWindow('argRuleWin'), lc)\n ) # end BoxRow\n ) # end BoxColu mn \n ), # end Window\n\n############################################ ################\n\n Window['ruleWin'](\n 'title'=\"Integration Ru le\", 'resizable'='false',\n BoxColumn('inset'=0, 'spacing'=5, 'ins et'=10, bc, \n BoxRow('inset'=0, 'spacing'=0, bc, \n Mat hMLViewer['ML_rule']('width'=380, 'height'=80, lc) \n ), # end Bo xRow\n BoxRow('inset'=0, 'spacing'=0, bc, \n Button(\"Clos e\", 'onclick'=A_ruleWin, lc)\n ) # end BoxRow\n ) # end BoxCo lumn\n ), # end ruleWin\n\n########################################## ##################\n\n Window['helpWin']( 'resizable'='false',\n ' title'=\"Using the Step-by-Step Integration Problem Solver Maplet\",\n BoxColumn('border'='true', 'inset'=0, 'spacing'=8, bc,\n BoxC ell(\n TextBox('height'=24, 'width'=40, lc,\n 'editabl e'='false', 'font'='F1', 'foreground'=\"#333399\",\n 'value'= helpStr\n ) # end TextBox\n ), # end BoxCell\n BoxRow ('inset'=0, 'spacing'=0, bc,\n Button(\"Close\", lc, \n \+ CloseWindow('helpWin'))\n ) # end BoxRow\n ) # end BoxColum n\n ), # end helpWin\n\n############################################# ###############\n\n MenuBar['intMB'](\n\n Menu(\"File\",\n Me nuItem(\"Start to Solve\", \n 'onclick'=Evaluate('function'='st artRule()')),\n MenuItem(\"Final Answer\", \n 'onclick'=Ev aluate('function'='getFinalAnswer()')),\n MenuItem(\"Show All Ste ps\", \n 'onclick'=Evaluate('function'='showAllSteps(RMI_all2, \+ RMI_all3)')),\n MenuSeparator(),\n MenuItem(\"Obtain a Hint \", \n 'onclick'=Evaluate('function'='getHint()')),\n Menu Item(\"Apply the Hint\", \n 'onclick'=Evaluate('function'='appl yHint()')),\n MenuSeparator(),\n MenuItem['undomenu'](\"Undo \", 'enabled'=false, \n 'onclick'=Evaluate('function'='undoLast Step()')), \n MenuSeparator(),\n MenuItem(\"Clear\", \n \+ 'onclick'=Evaluate('function'='clearSteps()')),\n MenuSeparato r(),\n MenuItem(\"Close\", Shutdown())\n ), # end Menu/File\n \+ \n Menu(\"Rule Definition\",\n MenuItem(\"Constant Rule\", ' onclick'='A_i_constant'),\n MenuItem(\"Constant Multiple\", 'oncl ick'='A_i_constantmultiple'),\n MenuSeparator(),\n MenuItem( \"Sum Rule\", 'onclick'='A_i_sum'),\n MenuItem(\"Difference Rule \", 'onclick'='A_i_difference'),\n MenuSeparator(),\n MenuIt em(\"Identity Rule\", 'onclick'='A_i_identity'),\n MenuItem(\"Pow er Rule\", 'onclick'='A_i_power'),\n MenuSeparator(),\n Menu Item(\"Flip Rule\", 'onclick'='A_i_flip'),\n MenuItem(\"Join Rule \", 'onclick'='A_i_join'),\n MenuItem(\"Split Rule\", 'onclick'=' A_i_split'),\n MenuSeparator(),\n MenuItem(\"Integrate by Pa rts\", 'onclick'='A_i_parts'),\n MenuItem(\"Solve Integral\", 'on click'='A_i_parts'),\n MenuSeparator(),\n MenuItem(\"Rewrite Expression\", 'onclick'='A_i_rewrite'),\n MenuSeparator(),\n \+ MenuItem(\"Change (Int Variable)\", 'onclick'='A_i_change'),\n \+ MenuItem(\"Revert (Int Variable)\", 'onclick'='A_i_change'),\n Me nuSeparator(),\n MenuItem(\"Natural Exponential\", 'onclick'='A_i _exp'),\n MenuItem(\"Natural Logorithm\",'onclick'='A_i_ln'),\n \+ MenuSeparator(),\n Menu(\"Trigonometric Functions\",\n \+ MenuItem(\"sin\",'onclick'='A_i_sin'),\n MenuItem(\"cos\",'onc lick'='A_i_cos'),\n MenuItem(\"tan\",'onclick'='A_i_tan'),\n \+ MenuItem(\"cot\",'onclick'='A_i_cot'),\n MenuItem(\"sec\", 'onclick'='A_i_sec'),\n MenuItem(\"csc\",'onclick'='A_i_csc')\n ), # end Menu/Trig\n Menu(\"Inverse Trigonometric Functions \",\n MenuItem(\"arcsin\",'onclick'='A_i_arcsin'),\n Men uItem(\"arccos\",'onclick'='A_i_arccos'),\n MenuItem(\"arctan\" ,'onclick'='A_i_arctan'),\n MenuItem(\"arccot\",'onclick'='A_i_ arccot'),\n MenuItem(\"arcsec\",'onclick'='A_i_arcsec'),\n \+ MenuItem(\"arccsc\",'onclick'='A_i_arccsc')\n ), # end Menu/In verse Trig\n Menu(\"Hyperbolic Functions\",\n MenuItem(\"s inh\",'onclick'='A_i_sinh'),\n MenuItem(\"cosh\",'onclick'='A_i _cosh'),\n MenuItem(\"tanh\",'onclick'='A_i_tanh'),\n Me nuItem(\"coth\",'onclick'='A_i_coth'),\n MenuItem(\"sech\",'onc lick'='A_i_sech'),\n MenuItem(\"csch\",'onclick'='A_i_csch')\n \+ ), # end Menu/Hyperbolic \n Menu(\"Inverse Hyperbolic Functi ons\",\n MenuItem(\"arcsinh\",'onclick'='A_i_arcsinh'),\n \+ MenuItem(\"arccosh\",'onclick'='A_i_arccosh'),\n MenuItem(\"a rctanh\",'onclick'='A_i_arctanh'),\n MenuItem(\"arccoth\",'oncl ick'='A_i_arccoth'),\n MenuItem(\"arcsech\",'onclick'='A_i_arcs ech'),\n MenuItem(\"arccsch\",'onclick'='A_i_arccsch')\n ) # end Menu/Inverse hyperbolic\n ), # end Menu/About the Rule\n \n \+ Menu(\"Apply the Rule\",\n MenuItem(\"Constant Rule\", \n \+ 'onclick'=Evaluate('function'='applyRule(constant)')),\n MenuI tem(\"Constant Multiple\", \n 'onclick'=Evaluate('function'='ap plyRule(constantmultiple)')),\n MenuSeparator(),\n MenuItem( \"Sum Rule\", \n 'onclick'=Evaluate('function'='applyRule(sum)' )),\n MenuItem(\"Difference Rule\", \n 'onclick'=Evaluate( 'function'='applyRule(difference)')),\n MenuSeparator(),\n M enuItem(\"Power Rule\", \n 'onclick'=Evaluate('function'='apply Rule(power)')),\n MenuItem(\"Identity Rule\", \n 'onclick' =Evaluate('function'='applyRule(identity)')),\n MenuSeparator(), \n MenuItem(\"Solve\", \n 'onclick'=Evaluate('function'='a pplyRule(solve)')),\n MenuItem(\"Revert\", \n 'onclick'=Ev aluate('function'='applyRule(revert)')),\n MenuSeparator(),\n \+ MenuItem(\"Natural Exponential\",\n 'onclick'=Evaluate('funct ion'='applyRule(exp)')),\n MenuItem(\"Natural Logorithm\", \n \+ 'onclick'=Evaluate('function'='applyRule(ln)')),\n MenuSepara tor(),\n Menu(\"Trigonometric Functions\",\n MenuItem(\"si n\",\n 'onclick'=Evaluate('function'='applyRule(sin)')),\n \+ MenuItem(\"cos\",\n 'onclick'=Evaluate('function'='apply Rule(cos)')),\n MenuItem(\"tan\",\n 'onclick'=Evaluate ('function'='applyRule(tan)')),\n MenuItem(\"cot\",\n \+ 'onclick'=Evaluate('function'='applyRule(cot)')),\n MenuItem(\" sec\",\n 'onclick'=Evaluate('function'='applyRule(sec)')),\n \+ MenuItem(\"csc\",\n 'onclick'=Evaluate('function'='app lyRule(csc)'))\n ), # end Menu/Trig\n Menu(\"Inverse Trigono metric Functions\",\n MenuItem(\"arcsin\",\n 'onclick' =Evaluate('function'='applyRule(arcsin)')),\n MenuItem(\"arccos \",\n 'onclick'=Evaluate('function'='applyRule(arccos)')),\n \+ MenuItem(\"arctan\",\n 'onclick'=Evaluate('function'=' applyRule(arctan)')),\n MenuItem(\"arccot\",\n 'onclic k'=Evaluate('function'='applyRule(arccot)')),\n MenuItem(\"arcs ec\",\n 'onclick'=Evaluate('function'='applyRule(arcsec)')), \n MenuItem(\"arccsc\",\n 'onclick'=Evaluate('function '='applyRule(arccsc)'))\n ), # end Menu/Inverse Trig\n Menu( \"Hyperbolic Functions\",\n MenuItem(\"sinh\",\n 'oncl ick'=Evaluate('function'='applyRule(sinh)')),\n MenuItem(\"cosh \",\n 'onclick'=Evaluate('function'='applyRule(cosh)')),\n \+ MenuItem(\"tanh\",\n 'onclick'=Evaluate('function'='appl yRule(tanh)')),\n MenuItem(\"coth\",\n 'onclick'=Evalu ate('function'='applyRule(coth)')),\n MenuItem(\"sech\",\n \+ 'onclick'=Evaluate('function'='applyRule(sech)')),\n MenuI tem(\"csch\",\n 'onclick'=Evaluate('function'='applyRule(csch )'))\n ), # end Menu/Hyperbolic \n Menu(\"Inverse Hyperbolic Functions\",\n MenuItem(\"arcsinh\",\n 'onclick'=Eval uate('function'='applyRule(arcsinh)')),\n MenuItem(\"arccosh\", \n 'onclick'=Evaluate('function'='applyRule(arccosh)')),\n \+ MenuItem(\"arctanh\",\n 'onclick'=Evaluate('function'='a pplyRule(arctanh)')),\n MenuItem(\"arccoth\",\n 'oncli ck'=Evaluate('function'='applyRule(arccoth)')),\n MenuItem(\"ar csech\",\n 'onclick'=Evaluate('function'='applyRule(arcsech)' )),\n MenuItem(\"arccsch\",\n 'onclick'=Evaluate('func tion'='applyRule(arccsch)'))\n ) # end Menu/Inverse hyperbolic\n \+ ), # end Menu/Apply Rules\n\n Menu(\"Understood Rules\",\n \+ CheckBoxMenuItem['CMI_constant'](\"Constant Rule\", \n 'onclick '=Evaluate('function'='changeUnderstoodRules(constant,CMI_constant)') \+ ),\n CheckBoxMenuItem['CMI_constantmultiple'](\"Constant Multiple \",\n 'onclick'=Evaluate('function'= \n 'changeU nderstoodRules(constantmultiple,CMI_constantmultiple)') ),\n Menu Separator(),\n CheckBoxMenuItem['CMI_sum'](\"Sum Rule\", \n \+ 'onclick'=Evaluate('function'='changeUnderstoodRules(sum,CMI_sum)') \+ ),\n CheckBoxMenuItem['CMI_difference'](\"Difference Rule\", \n \+ 'onclick'=Evaluate('function'='changeUnderstoodRules(difference, CMI_sum)') ),\n MenuSeparator(), \n CheckBoxMenuItem['CMI_id entity'](\"Identity Rule\", \n 'onclick'=Evaluate('function'=' changeUnderstoodRules(identity,CMI_identity)') ),\n CheckBoxMenuI tem['CMI_power'](\"Power Rule\", \n 'onclick'=Evaluate('functi on'='changeUnderstoodRules(power,CMI_power)') ),\n MenuSeparator( ),\n CheckBoxMenuItem['CMI_solve'](\"Solve Rule\", \n 'onc lick'=Evaluate('function'='changeUnderstoodRules(solve,CMI_solve)') ), \n CheckBoxMenuItem['CMI_revert'](\"Revert Rule\", \n 'onc lick'=Evaluate('function'='changeUnderstoodRules(revert,CMI_revert)') \+ ),\n MenuSeparator(), \n CheckBoxMenuItem['CMI_exp'](\"Natur al Exponential\", \n 'onclick'=Evaluate('function'='changeUnde rstoodRules(exp,CMI_exp)') ),\n CheckBoxMenuItem['CMI_ln'](\"Natu ral Logorithm\", \n 'onclick'=Evaluate('function'='changeUnders toodRules(ln,CMI_ln)') ),\n MenuSeparator(),\n Menu(\"Trigon ometric Functions\",\n CheckBoxMenuItem['CMI_sin'](\"sin\", \n \+ 'onclick'=Evaluate('function'='changeUnderstoodRules(sin,CMI_ sin)') ),\n CheckBoxMenuItem['CMI_cos'](\"cos\", \n 'o nclick'=Evaluate('function'='changeUnderstoodRules(cos,CMI_cos)')),\n \+ CheckBoxMenuItem['CMI_tan'](\"tan\", \n 'onclick'=Eval uate('function'='changeUnderstoodRules(tan,CMI_tan)') ),\n Chec kBoxMenuItem['CMI_cot'](\"cot\", \n 'onclick'=Evaluate('funct ion'='changeUnderstoodRules(cot,CMI_cot)') ),\n CheckBoxMenuIte m['CMI_sec'](\"sec\", \n 'onclick'=Evaluate('function'='chang eUnderstoodRules(sec,CMI_sec)') ),\n CheckBoxMenuItem['CMI_csc' ](\"csc\", \n 'onclick'=Evaluate('function'='changeUnderstood Rules(csc,CMI_csc)') )\n ), # end Menu/Trig\n Menu(\"Inverse Trigonometric Functions\",\n CheckBoxMenuItem['CMI_arcsin'](\" arcsin\", \n 'onclick'=Evaluate('function'='changeUnderstoodR ules(arcsin,CMI_arcsin)') ),\n CheckBoxMenuItem['CMI_arccos']( \"arccos\", \n 'onclick'=Evaluate('function'='changeUnderstoo dRules(arccos,CMI_arccos)') ),\n CheckBoxMenuItem['CMI_arctan'] (\"arctan\", \n 'onclick'=Evaluate('function'='changeUndersto odRules(arctan,CMI_arctan)') ),\n CheckBoxMenuItem['CMI_arccot' ](\"arccot\", \n 'onclick'=Evaluate('function'='changeUnderst oodRules(arccot,CMI_arccot)') ),\n CheckBoxMenuItem['CMI_arcsec '](\"arcsec\", \n 'onclick'=Evaluate('function'='changeUnders toodRules(arcsec,CMI_arcsec)') ),\n CheckBoxMenuItem['CMI_arccs c'](\"arccsc\", \n 'onclick'=Evaluate('function'='changeUnder stoodRules(arccsc,CMI_arccsc)') )\n ), # end Menu/Inverse Trig\n \+ Menu(\"Hyperbolic Functions\",\n CheckBoxMenuItem['CMI_sin h'](\"sinh\", \n 'onclick'=Evaluate('function'='changeUnderst oodRules(sinh,CMI_sinh)') ),\n CheckBoxMenuItem['CMI_cosh'](\"c osh\", \n 'onclick'=Evaluate('function'='changeUnderstoodRule s(cosh,CMI_cosh)') ),\n CheckBoxMenuItem['CMI_tanh'](\"tanh\", \+ \n 'onclick'=Evaluate('function'='changeUnderstoodRules(tanh, CMI_tanh)') ),\n CheckBoxMenuItem['CMI_coth'](\"coth\", \n \+ 'onclick'=Evaluate('function'='changeUnderstoodRules(coth,CMI_cot h)') ),\n CheckBoxMenuItem['CMI_sech'](\"sech\", \n 'o nclick'=Evaluate('function'='changeUnderstoodRules(sech,CMI_sech)') ), \n CheckBoxMenuItem['CMI_csch'](\"csch\", \n 'onclick' =Evaluate('function'='changeUnderstoodRules(csch,CMI_csch)') )\n \+ ), # end Menu/Hyperbolic \n Menu(\"Inverse Hyperbolic Functions \",\n CheckBoxMenuItem['CMI_arcsinh'](\"arcsinh\", \n \+ 'onclick'=Evaluate('function'='changeUnderstoodRules(arcsinh,CMI_arcsi nh)') ),\n CheckBoxMenuItem['CMI_arccosh'](\"arccosh\", \n \+ 'onclick'=Evaluate('function'='changeUnderstoodRules(arccosh,CMI_ arccosh)') ),\n CheckBoxMenuItem['CMI_arctanh'](\"arctanh\", \n 'onclick'=Evaluate('function'='changeUnderstoodRules(arctanh ,CMI_arctanh)') ),\n CheckBoxMenuItem['CMI_arccoth'](\"arccoth \", \n 'onclick'=Evaluate('function'='changeUnderstoodRules(a rccoth,CMI_arccoth)') ),\n CheckBoxMenuItem['CMI_arcsech'](\"ar csech\", \n 'onclick'=Evaluate('function'='changeUnderstoodRu les(arccoth,CMI_arccoth)') ),\n CheckBoxMenuItem['CMI_arccsch'] (\"arccsch\", \n 'onclick'=Evaluate('function'='changeUnderst oodRules(arccoth,CMI_arccoth)') )\n ) # end Menu/Inverse hyperbol ic\n ), # end Menu/Understood Rules\n \n Menu(\"Help\", \n \+ RadioButtonMenuItem['RMI_all1']('value'=false, 'group'='RMI_all',\n \+ \"Hide the Rule in 'All Steps'\" ),\n RadioButtonMenuItem[' RMI_all2']('value'=true, 'group'='RMI_all', \n \"Show the Rule \+ on the Right in 'All Steps'\" ), \n RadioButtonMenuItem['RMI_all3 ']('value'=false, 'group'='RMI_all',\n \"Show the Rule on the L eft in 'All Steps'\" ),\n MenuSeparator(),\n RadioButtonMenu Item['RMI_single1']('value'=false, 'group'='RMI_single',\n \"Hi de the Rule in a single step\" ),\n RadioButtonMenuItem['RMI_sing le2']('value'=true, 'group'='RMI_single', \n \"Show the Rule on the Right in a single step\" ), \n RadioButtonMenuItem['RMI_sing le3']('value'=false, 'group'='RMI_single',\n \"Show the Rule on the Left in a single step\" ),\n MenuSeparator(),\n MenuIte m(\"Using this Maplet\", 'onclick'=RunWindow('helpWin'))\n ) # end \+ Menu/Help\n\n ), # end MenuBar\n\n\n################################# ###########################\n\n ButtonGroup['RMI_all'](), ButtonGroup ['RMI_single'](), \n\n################################################ ############\n\n Action['A_other'](\n SetOption('target'='TF_mathf unc',Argument('TF_other')),\n CloseWindow('mathfuncWin'), \n Eva luate('function'='applyOtherRule()') \n ), # end A_other\n\n Action ['A_ruleWin'](\n SetOption('ML_rule'=\"\"),\n CloseWindow('ruleW in')\n ), # end A_ruleWin\n \n#################################### ########################\n\n Action['A_i_constant'](\n Evaluate('f unction'='aboutRule(constant, c)'),\n RunWindow('ruleWin')\n ), # \+ end A_i_constant\n \n Action['A_i_constantmultiple'](\n Evaluate(' function'='aboutRule(constantmultiple, c*f(x))'),\n RunWindow('rule Win')\n ), # end A_i_constantmultiple\n \n Action['A_i_sum'](\n \+ Evaluate('function'='aboutRule(sum,f(x)+g(x))'),\n RunWindow('ruleW in') \n ), # end A_i_sum\n\n Action['A_i_difference'](\n Evaluat e('function'='aboutRule(difference,f(x)-g(x))'),\n RunWindow('ruleW in') \n ), # end A_i_difference\n \n Action['A_i_identity'](\n \+ Evaluate('function'='aboutRule(identity,x)'),\n RunWindow('ruleWin' )\n ), # end A_i_identity\n \n Action['A_i_power'](\n Evaluate(' function'='aboutRule(power,x^n)'),\n RunWindow('ruleWin')\n ), # e nd A_i_power\n\n Action['A_i_flip'](\n Evaluate('ML_rule'='aboutDe fRule(flip)'),\n RunWindow('ruleWin')\n ), # end A_i_flip\n\n Act ion['A_i_join'](\n Evaluate('ML_rule'='aboutDefRule(join)'),\n R unWindow('ruleWin')\n ), # end A_i_join\n\n Action['A_i_split'](\n \+ Evaluate('ML_rule'='aboutDefRule(split)'),\n RunWindow('ruleWin') \n ), # end A_i_split\n\n Action['A_i_parts'](\n SetOption('TB_ar gRule'=partsStr),\n RunWindow('argRuleWin')\n ), # end A_i_parts\n \n Action['A_i_rewrite'](\n SetOption('TB_argRule'=rewriteStr),\n \+ RunWindow('argRuleWin')\n ), # end A_i_parts\n\n Action['A_i_chan ge'](\n SetOption('TB_argRule'=changeStr),\n RunWindow('argRuleW in')\n ), # end A_i_parts\n\n Action['A_i_exp'](\n Evaluate('func tion'='aboutRule(exp,exp(x))'),\n RunWindow('ruleWin')\n ), # end \+ A_i_exp\n\n Action['A_i_ln'](\n Evaluate('function'='aboutRule(ln, ln(x))'),\n RunWindow('ruleWin')\n ), # end A_i_ln\n\n Action['A_ i_sin'](\n Evaluate('function'='aboutRule(sin,sin(x))'),\n RunWi ndow('ruleWin')\n ), # end A_i_sin\n\n Action['A_i_cos'](\n Evalu ate('function'='aboutRule(cos,cos(x))'),\n RunWindow('ruleWin')\n \+ ), # end A_cos\n\n Action['A_i_tan'](\n Evaluate('function'='about Rule(tan,tan(x))'),\n RunWindow('ruleWin')\n ), # end A_i_tan\n\n \+ Action['A_i_cot'](\n Evaluate('function'='aboutRule(cot,cot(x))'), \n RunWindow('ruleWin')\n ), # end A_i_cot\n\n Action['A_i_sec']( \n Evaluate('function'='aboutRule(sec,sec(x))'),\n RunWindow('ru leWin')\n ), # end A_i_sec\n\n Action['A_i_csc'](\n Evaluate('fun ction'='aboutRule(csc,csc(x))'),\n RunWindow('ruleWin')\n ), # end A_i_csc\n\n Action['A_i_arcsin'](\n Evaluate('function'='aboutRul e(arcsin,arcsin(x))'),\n RunWindow('ruleWin')\n ), # end A_i_arcsi n\n\n Action['A_i_arccos'](\n Evaluate('function'='aboutRule(arcco s,arccos(x))'),\n RunWindow('ruleWin')\n ), # end A_i_cos\n\n Act ion['A_i_arctan'](\n Evaluate('function'='aboutRule(arctan,arctan(x ))'),\n RunWindow('ruleWin')\n ), # end A_i_arctan\n\n Action['A_ i_arccot'](\n Evaluate('function'='aboutRule(arccot,arccot(x))'),\n RunWindow('ruleWin')\n ), # end A_i_arccot\n\n Action['A_i_arcse c'](\n Evaluate('function'='aboutRule(arcsec,arcsec(x))'),\n Run Window('ruleWin')\n ), # end A_i_arcsec\n\n Action['A_i_arccsc'](\n \+ Evaluate('function'='aboutRule(arccsc,arccsc(x))'),\n RunWindow( 'ruleWin')\n ), # end A_i_arccsc\n\n Action['A_i_sinh'](\n Evalua te('function'='aboutRule(sinh,sinh(x))'),\n RunWindow('ruleWin')\n \+ ), # end A_i_sinh\n\n Action['A_i_cosh'](\n Evaluate('function'=' aboutRule(cosh,cosh(x))'),\n RunWindow('ruleWin')\n ), # end A_i_c osh\n\n Action['A_i_tanh'](\n Evaluate('function'='aboutRule(tanh, tanh(x))'),\n RunWindow('ruleWin')\n ), # end A_i_tanh\n\n Action ['A_i_coth'](\n Evaluate('function'='aboutRule(coth,coth(x))'),\n \+ RunWindow('ruleWin')\n ), # end A_i_coth\n\n Action['A_i_sech'](\n Evaluate('function'='aboutRule(sech,sech(x))'),\n RunWindow('ru leWin')\n ), # end A_i_sech\n\n Action['A_i_csch'](\n Evaluate('f unction'='aboutRule(csch,csch(x))'),\n RunWindow('ruleWin')\n ), # end A_i_csch\n\n Action['A_i_arcsinh'](\n Evaluate('function'='ab outRule(arcsinh,arcsinh(x))'),\n RunWindow('ruleWin')\n ), # end A _i_arcsinh\n\n Action['A_i_arccosh'](\n Evaluate('function'='about Rule(arccosh,arccosh(x))'),\n RunWindow('ruleWin')\n ), # end A_i_ cosh\n\n Action['A_i_arctanh'](\n Evaluate('function'='aboutRule(a rctanh,arctanh(x))'),\n RunWindow('ruleWin')\n ), # end A_i_arctan h\n\n Action['A_i_arccoth'](\n Evaluate('function'='aboutRule(arcc oth,arccoth(x))'),\n RunWindow('ruleWin')\n ), # end A_i_arccoth\n \n Action['A_i_arcsech'](\n Evaluate('function'='aboutRule(arcsech ,arcsech(x))'),\n RunWindow('ruleWin')\n ), # end A_i_arcsech\n\n \+ Action['A_i_arccsch'](\n Evaluate('function'='aboutRule(arccsch,ar ccsch(x))'),\n RunWindow('ruleWin')\n ), # end A_i_arccsch\n\n#### ########################################################\n\n Action[' A']()\n\n): # end maplet\n\n######################################### ###################\n\nUnderstand(Int,none) :\nMaplets[Display](maplet ) :\n\nend use: # end use\nend proc: # end runIntMaplet\n\n########### #################################################\n\nend module: # end IntMaplet()\nIntMaplet:-runIntMaplet();" }}{PARA 6 "" 1 "" {TEXT -1 38 "Initializing Java runtime environment." }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 27 "Riemann S um (small example)" }}{EXCHG {PARA 0 "" 0 "" {TEXT 281 36 "Click in re d area and press [Enter]." }{TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 1535 "# Riemann Sum Maplet\nrestart;\nPlotRiemann := proc ( f, a, b, n )\n Student:-Calculus1:-ApproximateInt( f, x=a..b, parti tion=n, output=plot, title=\"\");\nend proc:\n\nWriteRiemann := proc( \+ f, a, b, n )\n Student:-Calculus1:-ApproximateInt( f, x=a..b, partiti on=n, output=sum, title=\"\");\nend proc:\n\nuse Maplets:-Elements in \nRiemannSumMaplet := Maplet(\n [[\"Enter a function \", \n TextBo x['F']( value=\"cos(x)\", width=10 ),\n\n \"Left endpoint \", \n \+ TextBox['a']( value=\"0\", width=3 ),\n\n \"Right endpoint \", \n \+ TextBox['b']( value=\"4\", width=3 )],\n\n [\"Number of partition s\", \n Slider['n']( 0..100, 10, 'majorticks'=20, 'minorticks'=5, ' snapticks'='false' )],\n\n [Plotter['P']( width=300, height=300 )], \n\n [MathMLViewer['RS']( height=75, width=400 )],\n\n [Button['B1 '](\"Close\", \n Shutdown(['F'])),\n \n Button['B2' ](\"Plot\", \n onclick = 'JustPlot'),\n\n Button['B 3'](\"Show Riemann Sum\", \n onclick = 'ShowSum')] \n \+ ],\n\n\n Action['JustPlot'](\n\n Evaluate('P' = 'plot(F, x=a..b)' )\n ),\n\n Action['ShowSum'](\n\n Evaluate('target'='P', \n \+ 'function'='PlotRiemann', \n Argument( 'F' ), \n \+ Argument( 'a' ), \n Argument( 'b' ), \n \+ Argument( 'n' )\n ),\n\n Evaluate('target'='RS', \n \+ 'function'='WriteRiemann', \n Argument( 'F' ), \n Argument( 'a' ), \n Argument( 'b' ), \n \+ Argument( 'n' )\n )\n )\n \n):\nend use:\n\nM aplets:-Display( RiemannSumMaplet );" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 26 "Area Surfac e of Revolution" }}{EXCHG {PARA 0 "" 0 "" {TEXT 282 36 "Click in red a rea and press [Enter]." }{TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 11328 "# Surface of Revolution Maplet\n# Copyright 2002 Waterloo Map le Inc.\n# \n# This maplet plots and computes the area of the surface \+ of revolution generated by rotating a function f(x) around either the \+ horizontal or vertical axis.\n# \n# Instructions\n# \n# The user enter s a function f(x), a range [a, b] on the x-axis, and the axis of revol ution. When you press the 'Plot' button, the surface of revolution is plotted. When you press the 'Area' button, the area of the surface i s computed and displayed in a pop-up window.\n# \n# To run this maplet , click the !!! button in the tool bar.\n# \nrestart;\nRevolutionMap let := module()\n\n################################################### #########\n\nexport iniMathML, addMathML, exportMathML, \n getR evolution, getArea, runRevolutionMaplet:\nlocal helpStr, mlStr:\n\n### #########################################################\n\n\n####### #####################################################\n\nmlStr := \"\" :\n\nhelpStr := \n\"This maplet plots and computes the area of the sur face of revolution generated by rotating a function f(x) around the ho rizontal or the vertical axis.\n\nInstructions\n\nThe user enters a fu nction f(x), a range [a, b] on the x-axis, and the axis of revolution. When you press the 'Plot' button, the surface of revolution is plott ed. When you press the 'Area' button, the area of the surface is comp uted and displayed in a pop-up window.\":\n\n######################### ###################################\n\n\n############################# ###############################\n\n# pre: iniEqn :: algebraic expressi on\n# post: returns the Presentation MathML of iniEqn\niniMathML := pr oc(iniEqn)\n MathML:-ExportPresentation(iniEqn);\nend proc:\n\n###### ######################################################\n\n\n########## ##################################################\n\n# pre: mathMLStr :: string, in form of Presentation MathML\n# addEqn :: algebraic expression \naddMathML := proc(mathMLStr, addEqn)\n local tree, cmc, child, children, nl, eqnSign;\n use XMLTools in\n tree := FromStr ing(mathMLStr);\n cmc := ContentModelCount(tree);\n child := Fro mString(MathML:-ExportPresentation(addEqn));\n children := ContentM odel(child);\n nl := FromString(\" \");\n \+ eqnSign := Element(\"mo\",\"=\");\n tree := AddChild(tree,nl,cmc); \n tree := AddChild(tree,eqnSign,cmc+1);\n for child in children do \n cmc := ContentModelCount(tree);\n tree := AddChild(tr ee,child,cmc);\n end do:\n tree := MakeElement(\"mrow\", [], Con tentModel(tree) ):\n tree := Element(\"math\", tree):\n ToString (tree):\n end use:\nend proc:\n\n#################################### ########################\n\n\n######################################## ####################\n\n#exportMathML := proc()\n# Maplets:-Tools:-Se t('ML'=mlStr):\n#end proc: \n\n####################################### #####################\n\ngetArea := proc(boo1, P_fun, P_a, P_b)\n\n l ocal temp, temp2, str, view, value:\n\n use Maplets:-Tools, Student:- Calculus1 in\n\n str:=P_fun:\n if temp=\"\" then \n return \+ plots[textplot]([1,1,\"No function input\"], 'font'=[HELVETICA,18]):\n end if:\n\n temp:=P_a:\n if temp=\"\" then \n return pl ots[textplot]([1,1,\"Lower limit is missing\"], 'font'=[HELVETICA,18]) :\n end if:\n \n temp2:=P_b:\n if temp2=\"\" then \n \+ return plots[textplot]([1,1,\"Upper limit is missing\"], 'font'=[HELVE TICA,18]):\n end if:\n\n str := cat(str, \", \", temp, \"..\", t emp2):\n\n if not boo1 then str := cat(str, \", axis=vertical\") en d if:\n\n mlStr := iniMathML( SurfaceOfRevolution(parse(str), outpu t=integral) ):\n value := SurfaceOfRevolution(parse(str)):\n mlS tr := addMathML(mlStr, value):\n mlStr := addMathML(mlStr, evalf(va lue)):\n end use:\nend proc:\n\n\n################################### #########################\n\ngetRevolution := proc(boo1, boo2, boo3,P_ fun, P_a, P_b,P_x1, P_x2, P_y1, P_y2, P_z1, P_z2)\n\n local temp, tem p2, str, view, value:\n\n use Maplets:-Tools, Student:-Calculus1,Stri ngTools in\n \n\n str:=P_fun:\n if temp=\"\" then \n retur n plots[textplot]([1,1,\"No function input\"], 'font'=[HELVETICA,18]): \n end if:\n\n temp:=Trim(P_a):\n if temp=\"\" then \n r eturn plots[textplot]([1,1,\"Lower limit is missing\"], 'font'=[HELVET ICA,18]):\n end if:\n \n temp2:=Trim(P_b):\n if temp2=\"\" then \n return plots[textplot]([1,1,\"Upper limit is missing\"], 'font'=[HELVETICA,18]):\n end if:\n\n str := cat(str, \", \", t emp, \"..\", temp2):\n\n if not boo1 then str := cat(str, \", axis= vertical\") end if:\n\n if not(boo2 or boo3) then \n return p lots[textplot]( [1,1,\"Select function or surface from Display Options \"]):\n end if: \n if not boo2 then str := cat(str, \", showfunc tion=false\") end if:\n if not boo3 then str := cat(str, \", showsu rface=false\") end if:\n\n view := [\"DEFAULT\",\"DEFAULT\",\"DEFAU LT\"]:\n\n temp:=Trim(P_x1):\n temp2:=Trim(P_x2):\n if temp<> \"\" and temp2<>\"\" then\n view[1]:=cat(temp, \"..\", temp2):\n \+ end if: \n\n temp:=Trim(P_y1):\n temp2:=Trim(P_y2):\n if t emp<>\"\" and temp2<>\"\" then\n view[2]:=cat(temp, \"..\", temp2 ):\n end if: \n\n temp:=Trim(P_z1):\n temp2:=Trim(P_z2):\n \+ if temp<>\"\" and temp2<>\"\" then\n view[3]:=cat(temp, \"..\", \+ temp2):\n end if: \n\n temp:=cat(\", view=[\", view[1], \", \", \+ view[2], \", \", view[3], \"]\"):\n str := cat(str, temp):\n \n \+ return SurfaceOfRevolution(parse(str), output=plot, title=\" \"): \n \n end use:\n\nend proc:\n\n######################################### ###################\n\n############################################### #############\n\nrunRevolutionMaplet := proc()\n\nlocal maplet, ML_opt s, b, s, c, dc, lc:\n\nb := 'border'=true:\ns := 'inset'=0, 'spacing'= 0:\nc := 'background'=\"#DDFFFF\":\ndc := 'background'=\"#CCFFFF\":\nl c := 'background'=\"#EEFFFF\": \n\nuse Maplets:-Elements in\n\n####### #####################################################\n\nmaplet := Map let(\n 'onstartup'=RunWindow('mainWin'),\n\n######################### ###################################\n\n Font['F1']('family'=\"Default \", 'bold'='true', 'italic'='true'),\n Font['F2']('family'=\"Default \", 'bold'='true', 'size'=14),\n\n#################################### ########################\n\n MenuBar['MB'](\n Menu(\"File\",\n \+ MenuItem(\"Plot\", 'onclick'='A_revolution'),\nMenuItem(\"Area\", 'o nclick'='A_area'), \n MenuSeparator(),\n MenuItem(\"Close\", 'onclick'=Shutdown())\n ), # end Menu/File\n Menu(\"Help\", \n \+ MenuItem(\"About this maplet\", 'onclick'=RunWindow('helpWin'))\n ) # end menu/Help\n ), # end MenuBar \n\n######################## ####################################\n\n Window['mainWin']('resizable '='false', \n 'title'=\"Calculus 1 - Surface of Revolution\",\n \+ 'menubar'='MB', \n \n BoxColumn(s, c,\n\n BoxRow(s,c,b , \n BoxRow(s,c,b,'caption'=\"Enter a function and interval \", \n Label(\"Function \", 'font'='F2', c), \n \+ TextField['TF_fun'](16, lc, 'value'=\"1+cos(x)\", 'tooltip'=\"Enter a function\"),\n Label(\" a\", 'font'='F2', c), \n \+ Label(\" = \", 'font'='F1', c), \n TextField['TF_a']('val ue'=\"0\", 3, lc, 'tooltip'=\"Lower limit\"),\n Label(\" b \", 'font'='F2', c), \n Label(\" = \", 'font'='F1', c), \n \+ TextField['TF_b']('value'=\"4*Pi\", 3, lc, 'tooltip'=\"uppe r limit\")\n ), # end BoxRow\n\n BoxRow('inset'=0, ' spacing'=3, c, b, \n 'caption'=\"Axis of revolution\", \n \+ RadioButton['RB']('caption'=\"horizontal axis\", \n \+ 'group'='BG_axis', 'value'=true, c), \n RadioButton(' caption'=\"vertical axis\", 'group'='BG_axis', c)\n ) # end B oxColumn\n ), # end BoxRow \n\n BoxRow(s, c, b, \n \+ BoxColumn(s, c, b, 'caption'=\"Plot Window\", \n Plot ter['P'](lc)\n ),\n\n BoxColumn(s,c,b, 'inset'=0, 's pacing'=6, 'caption'=\"Area of the surface\", \n MathMLVi ewer['ML']('height'=370, 'width'=240, lc)\n ) # end BoxRow\n \+ ), # end BoxRow\n\n BoxRow(s, c, \n BoxColumn( s, c, b, 'caption'=\"Display Options\",\n \n BoxRow (s, c, \n CheckBox['CB2']('caption'=\"Show function\", c, \+ \n 'value'=true),\n CheckBox['CB3']('caption'= \"Show surface\", c, \n 'value'=true)\n ), # en d BoxRow\n \n BoxRow(s, c, \n Label(\"x\", ' font'='F2', c), \n Label(\" = \", 'font'='F1', c),\n \+ TextField['x1'](2, lc, 'value'=\" \"), \n Label( \" .. \", 'font'='F2', c),\n TextField['x2'](2, lc, 'valu e'=\" \"),\n Label(\" y\", 'font'='F2', c), \n \+ Label(\" = \", 'font'='F1', c),\n TextField['y1'](2, \+ lc, 'value'=\" \"),\n Label(\" .. \", 'font'='F2', c),\n \+ TextField['y2'](2, lc, 'value'=\" \"),\n Lab el(\" z\", 'font'='F2', c), \n Label(\" = \", 'font'='F1 ', c),\n TextField['z1'](2, lc, 'value'=\" \"), \n \+ Label(\" .. \", 'font'='F2', c),\n TextField['z2'] (2, lc, 'value'=\" \")\n ) # end BoxRow\n ), # end \+ BoxColumn \n \n BoxColumn(s, c, \n BoxRow('inset'=0, 'spa cing'=10, c, \n Button(\" Plot \", dc, 'onclick'='A_revolutio n' ), \n Button(\"Area\", dc, 'onclick'='A_area' ), \n \+ Button(\"Close\", Shutdown(), dc)\n ) # end BoxColumn\n) # \+ end BoxColumn \n\n) # end BoxColumn \n ) # end BoxColumn\n\n ), \+ # end Window\n\n###################################################### ######\n\n Window['helpWin']( 'resizable'='false',\n 'title'=\"Abo ut Surface of Revolution Maplet\",\n BoxColumn(b, c, 'inset'=0, 'sp acing'=10,\n BoxCell(\n TextBox('height'=15, 'width'=28,\n lc, 'foreground'=\"#333399\", \n 'editable'='false' , 'font'='F2', \n 'value'=helpStr\n ) # end TextBox\n \+ ), # end BoxCell\n BoxRow(s, c,\n Button(\"Close\", \+ \n CloseWindow('helpWin'), dc)\n ) # end BoxRow\n ) \+ # end BoxColumn\n ), # end helpWin\n\n############################## ##############################\n\n#################################### ########################\n\n ButtonGroup['BG_axis'](),\n\n########### #################################################\n\n Action['A_revol ution']\n ( Evaluate\n ('waitforresult'='false',\n 'target' ='P',\n 'function'='getRevolution',\n Argument(RB),\n A rgument(CB2),\n Argument(CB3),\n Argument('TF_fun', quotedte xt='true'),\n Argument('TF_a', quotedtext='true'),\n Argumen t('TF_b', quotedtext='true'),\n Argument('x1', quotedtext='true') ,\n Argument('x2', quotedtext='true'),\n Argument('y1', quot edtext='true'),\n Argument('y2', quotedtext='true'),\n Argum ent('z1', quotedtext='true'),\n Argument('z2', quotedtext='true') \n )\n ),\n Action['A_area']\n ( Evaluate\n ( 'waitforresult'=' false',\n 'target'='ML',\n 'function'='getArea',\n Argumen t(RB),\n Argument('TF_fun',quotedtext='true'),\n Argument('TF_ a', quotedtext='true'),\n Argument('TF_b', quotedtext='true')\n \+ )\n ) \n############################################################\n ): # end Maplet\n\n################################################### #########\n\nMaplets:-Display(maplet):\n\nend use: # end use\nend proc : # end proc\n\n###################################################### ######\n\nend module: # end module\nRevolutionMaplet:-runRevolutionMap let();" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 29 "Volume of Solid of Revolution" }}{EXCHG {PARA 0 "" 0 "" {TEXT 283 36 "Click in red area and press [Enter]." } {TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 11131 "# Volume of Revo lution Maplet\n# Copyright 2002 Waterloo Maple Inc.\n# \n# This maplet plots and computes the volume of the solid of revolution generated by rotating a function f(x) around either horizontal or vertical axis.\n # \n# Instructions\n# \n# The user enters a function f(x), a range [a, b] on the x-axis, and the axis of revolution. When you press the 'Pl ot' button, the surface of revolution is plotted. When you press the \+ 'Volume' button, the volume of the solid is computed and displayed in \+ a pop-up window.\n# \n# To run this maplet, click the !!! button in th e tool bar.\n# \nrestart;\nRevolutionMaplet := module()\n\n######### ###################################################\n\nexport iniMathM L, addMathML, exportMathML, getLastMath, \n getRevolution, getV olume, runRevolutionMaplet:\nlocal helpStr, mlStr, save_string:\n\n### #########################################################\n\n\n####### #####################################################\n\nmlStr := \"\" :\n\nhelpStr := \n\"This maplet plots and computes the volume of the s olid of revolution generated by rotating a function f(x) around the ho rizontal or the vertical axis.\n\nInstructions\n\nThe user enters a fu nction f(x), a range [a, b] on the x-axis, and the axis of revolution. When you press the 'Plot' button, the surface of revolution is plott ed. When you press the 'Volume' button, the volume of the solid is co mputed and displayed in a pop-up window.\":\n\n####################### #####################################\n\ngetLastMath:=proc()\n save_s tring;\nend proc:\n\n################################################# ###########\n# pre: iniEqn :: algebraic expression\n# post: returns th e Presentation MathML of iniEqn\n\niniMathML := proc(iniEqn)\n MathML :-ExportPresentation(iniEqn);\nend proc:\n\n########################## ##################################\n\n\n############################## ##############################\n# pre: mathMLStr :: string, in form of Presentation MathML\n# addEqn :: algebraic expression \n\naddMat hML := proc(mathMLStr, addEqn)\n local tree, cmc, child, children, nl , eqnSign;\n use XMLTools in\n tree := FromString(mathMLStr);\n \+ cmc := ContentModelCount(tree);\n child := FromString(MathML:-Expo rtPresentation(addEqn));\n children := ContentModel(child);\n nl := FromString(\" \");\n eqnSign := Element( \"mo\",\"=\");\n tree := AddChild(tree,nl,cmc);\n tree := AddChi ld(tree,eqnSign,cmc+1);\n for child in children do \n cmc := C ontentModelCount(tree);\n tree := AddChild(tree,child,cmc);\n \+ end do:\n tree := MakeElement(\"mrow\", [], ContentModel(tree) ):\n tree := Element(\"math\", tree):\n ToString(tree):\n end use: \nend proc:\n\n####################################################### #####\n\n############################################################ \n\ngetVolume := proc(boo1, p_func, p_a, p_b)\n\n local temp, temp2, \+ str, view, value:\n\n use Maplets:-Tools, Student:-Calculus1 in\n\n \+ str:=p_func:\n if str=\"\" then \n return plots[textplot]([1 ,1,\"No function input\"], 'font'=[HELVETICA,18]):\n end if:\n\n \+ temp:=p_a:\n if temp=\"\" then \n return plots[textplot]([1,1 ,\"Lower limit is missing\"], 'font'=[HELVETICA,18]):\n end if:\n \+ \n temp2:=p_b:\n if temp2=\"\" then \n return plots[textp lot]([1,1,\"Upper limit is missing\"], 'font'=[HELVETICA,18]):\n en d if:\n\n str := cat(str, \", \", temp, \"..\", temp2):\n\n if n ot boo1 then str := cat(str, \", axis=vertical\") end if:\n\n mlStr := iniMathML( VolumeOfRevolution(parse(str), output=integral) ):\n \+ value := VolumeOfRevolution(parse(str)):\n mlStr := addMathML(mlSt r, value):\n mlStr := addMathML(mlStr, evalf(value)):\n end use:\n end proc:\n\n\n####################################################### #####\n\ngetRevolution := proc(boo1, boo2, boo3, p_func, p_a, p_b, p_x 1, p_x2, p_y1, p_y2, p_z1, p_z2)\n\n local temp, temp2, str, view, va lue:\n\n use Maplets:-Tools, Student:-Calculus1, StringTools in\n\n \+ save_string:=\"\";\n\n str:=Trim(p_func):\n if str=\"\" then \n \+ return plots[textplot]([1,1,\"No function entered\"]):\n end i f:\n\n temp:=Trim(p_a):\n if temp=\"\" then \n return plots [textplot]([1,1,\"Lower limit is missing\"]):\n end if:\n \n \+ temp2:=Trim(p_b):\n if temp2=\"\" then \n return plots[textplo t]([1,1,\"Upper limit is missing\"]):\n end if:\n\n str := cat(s tr, \", \", temp, \"..\", temp2):\n\n if not boo1 then str := cat(s tr, \", axis=vertical\") end if:\n\n if not(boo2 or boo3) then \n \+ return plots[textplot]( [1,1,\"Select function or surface from Di splay Options\"]):\n end if: \n\n if not boo2 then str := cat(st r, \", showfunction=false\") end if:\n if not boo3 then str := cat( str, \", showvolume=false\") end if:\n\n view := [\"DEFAULT\",\"DEF AULT\",\"DEFAULT\"]:\n\n temp:=Trim(p_x1):\n temp2:=Trim(p_x2): \n if temp <> \"\" and temp2 <> \"\" then\n view[1]:=cat(temp, \"..\", temp2):\n end if: \n\n temp:=Trim(p_y1):\n temp2:=Tr im(p_y2):\n if temp <> \"\" and temp2 <> \"\" then\n view[2]:= cat(temp, \"..\", temp2):\n end if: \n\n temp:=Trim(p_z1):\n \+ temp2:=Trim(p_z2):\n if temp <> \"\" and temp2 <> \"\" then\n \+ view[3]:=cat(temp, \"..\", temp2):\n end if: \n\n temp:=cat(\", \+ view=[\", view[1], \", \", view[2], \", \", view[3], \"]\"):\n str \+ := cat(str, temp):\n \n return VolumeOfRevolution(parse(str), out put=plot): \n\n end use:\n\nend proc:\n\n############################ ################################\n\n################################## ##########################\n\nrunRevolutionMaplet := proc()\n\nlocal m aplet, ML_opts, b, s, c, dc, lc:\n\nb := 'border'=true:\ns := 'inset'= 0, 'spacing'=0:\nc := 'background'=\"#DDFFFF\":\ndc := 'background'=\" #CCFFFF\":\nlc := 'background'=\"#EEFFFF\": \n\nuse Maplets:-Elements \+ in\n\n############################################################\n\n maplet := Maplet(\n 'onstartup'=RunWindow('mainWin'),\n\n############ ################################################\n\n Font['F1']('fami ly'=\"Default\", 'bold'='true', 'italic'='true'),\n Font['F2']('famil y'=\"Default\", 'bold'='true', 'size'=14),\n\n######################## ####################################\n\n MenuBar['MB'](\n Menu(\"F ile\",\n MenuItem(\"Plot\", 'onclick'='A1'), \n MenuSeparato r(),\n MenuItem(\"Close\", 'onclick'=Shutdown())\n ), # end Me nu/File\n Menu(\"Help\", \n MenuItem(\"About this maplet\", 'o nclick'=RunWindow('helpWin'))\n ) # end menu/Help\n ), # end MenuB ar \n\n############################################################\n \n Window['mainWin']('resizable'='false', \n 'title'=\"Calculus 1 \+ - Volume of Revolution\",\n 'menubar'='MB', \n \n BoxColum n(s, c,\n\n BoxRow(s, c, b, \n BoxRow(s, c, b, 'capti on'=\"Enter a function and interval\", \n Label(\"Function : \", 'font'='F2', c), \n TextField['TF_func'](16, lc, 'val ue'=1+cos(x), 'tooltip'=\"Enter a function\"),\n Label(\" a \", 'font'='F2', c), \n Label(\" = \", 'font'='F1', c), \n TextField['TF_a']('value'=0, 3, lc, 'tooltip'=\"Lower limi t\"),\n Label(\" b \", 'font'='F2', c), \n Label (\" = \", 'font'='F1', c), \n TextField['TF_b']('value'=\"4 *Pi\", 3, lc, 'tooltip'=\"upper limit\")\n ), # end BoxRow\n \n BoxRow('inset'=0, 'spacing'=3, c, b, \n 'capti on'=\"Axis of revolution\", \n RadioButton['RB']('caption'= \"horizontal axis\", \n 'group'='BG_axis', 'value'=true, \+ c), \n RadioButton('caption'=\"vertical axis\", 'group'='BG _axis', c)\n ) # end BoxColumn\n ), # end BoxRow \n \n BoxRow(s, c, b, \n BoxColumn(s, c, b, 'caption'=\"P lot Window\", \n Plotter['P'](lc)\n ),\n\n \+ BoxColumn(s,c,b, 'inset'=0, 'spacing'=6, 'caption'=\"Volume of the s olid\", \n MathMLViewer['ML']('height'=370, 'width'=240, \+ lc)\n ) # end BoxRow\n ), # end BoxRow\n\n BoxR ow(c, s, \n BoxColumn(s, c, b, 'caption'=\"Display Options\", \n\n BoxRow(s, c, \n CheckBox['CB2']('caption'=\"Sh ow function\", c, \n 'value'=true),\n CheckBo x['CB3']('caption'=\"Show volume\", c, \n 'value'=true) \n ), # end BoxRow\n\n BoxRow(s, c, \n \+ Label(\"x\", 'font'='F2', c), \n Label(\" = \", 'font'='F1' , c),\n TextField['x1']('width'=2, lc, 'value'=\" \"), \n \+ Label(\" .. \", 'font'='F2', c),\n TextField['x2' ]('width'=2, lc, 'value'=\" \"),\n Label(\" y\", 'font'='F 2', c), \n Label(\" = \", 'font'='F1', c),\n Tex tField['y1']('width'=2, lc, 'value'=\" \"),\n Label(\" .. \+ \", 'font'='F2', c),\n TextField['y2']('width'=2, lc, 'valu e'=\" \"),\n Label(\" z\", 'font'='F2', c), \n \+ Label(\" = \", 'font'='F1', c),\n TextField['z1']('width'=2 , lc, 'value'=\" \"), \n Label(\" .. \", 'font'='F2', c),\n TextField['z2']('width'=2, lc, 'value'=\" \")\n ) # end BoxRow\n\n ), # end BoxColumn \n\n BoxColumn('i nset'=10, 'spacing'=10, c, \n\n BoxRow('inset'=10, 'spacing'= 10, c, \n Button(\" Plot \", dc, 'onclick'='A1'),\n \+ Button(\"Volume\", dc, 'onclick'=Evaluate('target'='ML', 'functi on'='getVolume', \n Argument('RB'),\n Argu ment('TF_func', quotedtext='true'), \n Argument('TF_a', \+ quotedtext='true'),\n Argument('TF_b', quotedtext='true' ), 'waitforresult'='false') ), \n\n Button(\"Close\", dc, Shutdown())\n ) # end BoxRow\n\n ) # end BoxColumn\n ) \+ # end BoxColumn\n)\n ), # end Window\n\n############################# ###############################\n\n Window['helpWin']( 'resizable'='f alse',\n 'title'=\"About the Volume of Revolution Maplet\",\n Bo xColumn(b, c, 'inset'=0, 'spacing'=10,\n BoxCell(\n TextBo x('height'=15, 'width'=28,\n lc, 'foreground'=\"#333399\", \n 'editable'='false', 'font'='F2', \n 'value'=helpStr \n ) # end TextBox\n ), # end BoxCell\n BoxRow(s, c, \n Button(\"Close\", CloseWindow('helpWin'), dc)\n ) # end BoxRow\n ) # end BoxColumn\n ), # end helpWin\n\n############### #############################################\n\n ButtonGroup['BG_axi s'](),\n\n############################################################ \n\nAction['A1'](Evaluate('target'='P', 'function'='getRevolution', \n Argument('RB'), \n Argument('CB2'), \n \+ Argument('CB3'), \n Argument('TF_func', quot edtext='true'), \n Argument('TF_a', quotedtext='true'), \n Argument('TF_b', quotedtext='true'), \n \+ Argument('x1', quotedtext='true'),\n Argument('x2', quo tedtext='true'),\n Argument('y1', quotedtext='true'),\n \+ Argument('y2', quotedtext='true'),\n Argum ent('z1', quotedtext='true'),\n Argument('z2', quotedtex t='true'), 'waitforresult'='false')) \n\n\n): # end Maplet\n\n######## ####################################################\n\nMaplets:-Displ ay(maplet):\n\nend use: # end use\nend proc: # end proc\n\n########### #################################################\n\nend module: # end module\004\nRevolutionMaplet:-runRevolutionMaplet();" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}}{MARK "3 0" 113 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }