{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 "" -1 256 "" 1 18 0 0 0 0 0 1 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 257 "" 1 18 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 }{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 "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 }} {SECT 0 {PARA 256 "" 0 "" {TEXT 256 56 "Calculus Exploration 10: Volum es of Solids of Revolution" }{TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 257 322 "The following is the Maple code \+ for the Volumes of Solids of Revolution Maplet, which should be used t o both visualize the solids and obtain solutions to problems. Note tha t this Maplet can be used only for the disk and shell methods. You can either execute the code below or run the corresponding Maplet from th e webpage." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 43 "Volumes of Solids of Revolution Maplet Code" }}{EXCHG {PARA 0 "" 0 "" {TEXT 258 36 "Click in red area and press [Enter]." } {TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 11415 "# 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#### Changes\n 'title' =\"Volumes of Solids of Revolution: Disk & Shell Methods\",\n 'men ubar'='MB', \n \n BoxColumn(s, c,\n\n BoxRow(s, c, b, \+ \n BoxRow(s, c, b, 'caption'=\"Enter a function and an inter val : \", \n Label(\"Function: \", 'font'='F2', c),\n#### \+ Changes\n TextField['TF_func'](16, lc, 'value'=1-x^2, 'tool tip'=\"Enter a function\"),\n Label(\" a \", 'font'='F2', c ), \n Label(\" = \", 'font'='F1', c), \n TextFie ld['TF_a']('value'=0, 3, lc, 'tooltip'=\"Lower limit\"),\n \+ Label(\" b \", 'font'='F2', c), \n Label(\" = \", 'font'='F 1', c), \n TextField['TF_b']('value'=\"1\", 3, lc, 'tooltip '=\"upper limit\")\n ), # end BoxRow\n\n BoxRow('ins et'=0, 'spacing'=3, c, b,\n#### Changes \n 'caption'=\"Cho ose an axis of revolution : \", \n RadioButton['RB']('capti on'=\"horizontal x-axis\", \n 'group'='BG_axis', 'value'= true, c), \n RadioButton('caption'=\"vertical z-axis\", 'gr oup'='BG_axis', c)\n ) # end BoxColumn\n ), # end BoxR ow \n\n BoxRow(s, c, b,\n#### Changes \n BoxColumn(s , c, b, 'caption'=\"Note the xyz-coordinates with z = f(x) the blue cu rve and the vertical axis = z-axis.\", \n Plotter['P'](lc) \n ),\n#### Changes\n BoxColumn(s,c,b,'inset'=0, 'sp acing'=6, 'caption'=\" Volume of the solid corresponding to plot at le ft.\", \n MathMLViewer['ML']('height'=370, 'width'=240, l c)\n ) # end BoxRow\n ), # end BoxRow\n\n BoxRo w(c, s, \n BoxColumn(s, c, b, 'caption'=\"To clearly see the b lue curve unclick 'Show volume' below.\",\n\n BoxRow(s, c, \n \+ CheckBox['CB2']('caption'=\"Show function\", c, \n \+ 'value'=true),\n CheckBox['CB3']('caption'=\"Show vol ume\", 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(\" .. \", 'fo nt'='F2', c),\n TextField['x2']('width'=2, lc, 'value'=\" \+ \"),\n#### Changes\n Label(\" y\", 'font'='F2', c), \n \+ Label(\" = \", 'font'='F1', c),\n TextField['y1'](' width'=2, lc, 'value'=\" \"),\n Label(\" .. \", 'font'='F2' , c),\n TextField['y2']('width'=2, lc, 'value'=\" \"),\n\n \+ Label(\" z\", 'font'='F2', c), \n Label(\" = \" , 'font'='F1', c),\n TextField['z1']('width'=2, lc, 'value' =\" \"), \n Label(\" .. \", 'font'='F2', c),\n T extField['z2']('width'=2, lc, 'value'=\" \")\n ) # end BoxRow \n\n ), # end BoxColumn \n\n BoxColumn('inset'=10, 'sp acing'=10, c, \n\n BoxRow('inset'=10, 'spacing'=10, c, \n \+ Button(\" Plot \", dc, 'onclick'='A1'),\n Button( \"Compute Volume\", dc, 'onclick'=Evaluate('target'='ML', 'function'=' getVolume', \n Argument('RB'),\n Argument( 'TF_func', quotedtext='true'), \n Argument('TF_a', quote dtext='true'),\n Argument('TF_b', quotedtext='true'), 'w aitforresult'='false') ), \n\n Button(\"Close\", dc, Shut down())\n ) # end BoxRow\n\n ) # end BoxColumn\n ) # end BoxColumn\n)\n ), # end Window\n\n################################## ##########################\n\n Window['helpWin']( 'resizable'='false' ,\n 'title'=\"About the Volume of Revolution Maplet\",\n BoxColu mn(b, c, 'inset'=0, 'spacing'=10,\n BoxCell(\n TextBox('he ight'=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 BoxRo w\n ) # end BoxColumn\n ), # end helpWin\n\n##################### #######################################\n\n ButtonGroup['BG_axis'](), \n\n############################################################\n\nAc tion['A1'](Evaluate('target'='P', 'function'='getRevolution', \n \+ Argument('RB'), \n Argument('CB2'), \n \+ Argument('CB3'), \n Argument('TF_func', quotedtext ='true'), \n Argument('TF_a', quotedtext='true'),\n \+ Argument('TF_b', quotedtext='true'), \n Argume nt('x1', quotedtext='true'),\n Argument('x2', quotedtext ='true'),\n#### Changes\n Argument('y1', quotedtext='tru e'),\n Argument('y2', quotedtext='true'),\n \+ Argument('z1', quotedtext='true'),\n Argument('z2', qu otedtext='true'), 'waitforresult'='false')) \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\004\nRevolutionMaplet:-runRevolutionMaplet();" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{MARK "4" 0 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }