{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 }{CSTYLE "" -1 259 "" 1 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Tim es" 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 54 "Calculus Exploration 13: Area \+ of Surface of Revolution" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 " " 0 "" {TEXT 257 39 "The following is the Maple code for the" }{TEXT -1 1 " " }{TEXT 259 216 "Area of Surface of Revolution Maplet, which s hould be used to both visualize the surface areas and obtain solutions to problems. You can either execute the code below or run the corresp onding Maplet from the webpage." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }} {SECT 1 {PARA 3 "" 0 "" {TEXT -1 41 "Area of Surface of Revolution Map let Code" }}{EXCHG {PARA 0 "" 0 "" {TEXT 258 36 "Click in red area and press [Enter]." }{TEXT -1 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 11323 "# Surface of Revolution Maplet\n# Copyright 2002 Waterloo Maple 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 ho rizontal 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 revolut ion. When you press the 'Plot' button, the surface of revolution is p lotted. When you press the 'Area' button, the area of the surface is \+ computed and displayed in a pop-up window.\n# \n# To run this maplet, \+ click the !!! button in the tool bar.\n# \nrestart;\nRevolutionMaple t := module()\n\n##################################################### #######\n\nexport iniMathML, addMathML, exportMathML, \n getRev olution, getArea, runRevolutionMaplet:\nlocal helpStr, mlStr:\n\n##### #######################################################\n\n\n######### ###################################################\n\nmlStr := \"\": \n\nhelpStr := \n\"This maplet plots and computes the area of the surf ace of revolution generated by rotating a function f(x) around the hor izontal or the vertical axis.\n\nInstructions\n\nThe user enters a fun ction 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 plotte d. When you press the 'Area' button, the area of the surface is compu ted and displayed in a pop-up window.\":\n\n########################## ##################################\n\n\n############################## ##############################\n\n# pre: iniEqn :: algebraic expressio n\n# post: returns the Presentation MathML of iniEqn\niniMathML := pro c(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 := FromStri ng(mathMLStr);\n cmc := ContentModelCount(tree);\n child := From String(MathML:-ExportPresentation(addEqn));\n children := ContentMo del(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'=\"Area of Surface of Revolution\",\n 'menu bar'='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 Text Field['TF_fun'](16, lc, 'value'=\"1+cos(x)\", 'tooltip'=\"Enter a func tion\"),\n Label(\" a\", 'font'='F2', c), \n Lab el(\" = \", 'font'='F1', c), \n TextField['TF_a']('value'= \"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'=\"upper lim it\")\n ), # end BoxRow\n\n BoxRow('inset'=0, 'spaci ng'=3, c, b, \n 'caption'=\"Axis of revolution\", \n \+ RadioButton['RB']('caption'=\"horizontal axis\", \n \+ 'group'='BG_axis', 'value'=true, c), \n RadioButton('capti on'=\"vertical axis\", 'group'='BG_axis', c)\n ) # end BoxCol umn\n ), # end BoxRow \n\n BoxRow(s, c, b, \n \+ BoxColumn(s, c, b, 'caption'=\"Plot Window\", \n Plotter[' P'](lc)\n ),\n\n BoxColumn(s,c,b, 'inset'=0, 'spacin g'=6, 'caption'=\"Area of the surface\", \n MathMLViewer[ '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'=\"Sho w surface\", c, \n 'value'=true)\n ), # end Box Row\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, 'value'=\" \"),\n Label(\" y\", 'font'='F2', c), \n L abel(\" = \", 'font'='F1', c),\n TextField['y1'](2, lc, ' value'=\" \"),\n Label(\" .. \", 'font'='F2', c),\n \+ TextField['y2'](2, lc, 'value'=\" \"),\n Label(\" z\", 'font'='F2', c), \n Label(\" = \", 'font'='F1', c) ,\n TextField['z1'](2, lc, 'value'=\" \"), \n \+ Label(\" .. \", 'font'='F2', c),\n TextField['z2'](2, l c, 'value'=\" \")\n ) # end BoxRow\n ), # end BoxCo lumn \n \n BoxColumn(s, c, \n BoxRow('inset'=0, 'spacing' =10, c, \n Button(\" Plot \", dc, 'onclick'='A_revolution' ), \n Button(\"Area\", dc, 'onclick'='A_area' ), \n B utton(\"Close\", Shutdown(), dc)\n ) # end BoxColumn\n) # end B oxColumn \n\n) # end BoxColumn \n ) # end BoxColumn\n\n ), # end Window\n\n########################################################### #\n\n Window['helpWin']( 'resizable'='false',\n 'title'=\"About Su rface of Revolution Maplet\",\n BoxColumn(b, c, 'inset'=0, 'spacing '=10,\n BoxCell(\n TextBox('height'=15, 'width'=28,\n \+ lc, 'foreground'=\"#333399\", \n 'editable'='false', 'fo nt'='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_revolution ']\n ( Evaluate\n ('waitforresult'='false',\n 'target'='P', \n 'function'='getRevolution',\n Argument(RB),\n Argume nt(CB2),\n Argument(CB3),\n Argument('TF_fun', quotedtext='t rue'),\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', quotedtex t='true'),\n Argument('y2', quotedtext='true'),\n Argument(' 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 Argument(RB) ,\n Argument('TF_fun',quotedtext='true'),\n Argument('TF_a', q uotedtext='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: # e nd proc\n\n########################################################### #\n\nend module: # end module\nRevolutionMaplet:-runRevolutionMaplet() ;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}}{MARK "4" 0 } {VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }