{VERSION 5 0 "IBM INTEL LINUX" "5.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 "" 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 "Text Output" -1 2 1 {CSTYLE "" -1 -1 "Courier" 1 10 0 0 255 1 0 0 0 0 0 1 3 0 3 0 }1 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 2 6 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 2 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Warning" 2 7 1 {CSTYLE "" -1 -1 "" 0 1 0 0 255 1 0 0 0 0 0 0 1 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "Heading 1" -1 256 1 {CSTYLE "" -1 -1 "Times" 1 18 0 0 0 1 2 1 2 2 2 2 1 1 1 1 }3 1 0 0 8 4 1 0 1 0 2 2 0 1 }{PSTYLE "Normal" -1 257 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 {EXCHG {PARA 256 "" 0 "" {TEXT -1 18 "Riemann Sum Maplet" }} {PARA 257 "" 0 "" {TEXT -1 22 "by: Mohamed Moutadayne" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 143 "This Maplet will plot the Riemann Sum representation for any surface (defined by F) in 3-s pace. F must be differentiable in the given region." }}{PARA 0 "" 0 " " {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 256 57 "To run this maplet, cl ick the !!! button in the tool bar." }{TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 100 "restart: w ith(plots): with(plottools): with(student): with(Maplets[Elements]): w ith(VectorCalculus):" }}{PARA 7 "" 1 "" {TEXT -1 50 "Warning, the name changecoords has been redefined\n" }}{PARA 7 "" 1 "" {TEXT -1 43 "War ning, the name arrow has been redefined\n" }}{PARA 7 "" 1 "" {TEXT -1 66 "Warning, the assigned names <,> and <|> now have a global binding \n" }}{PARA 7 "" 1 "" {TEXT -1 110 "Warning, these protected names hav e been redefined and unprotected: *, +, ., Vector, diff, int, limit, s eries\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 957 "# ----This proc edure plots the RiemannSum of the given function\nRiemannSum := proc ( func, lowx, highx, lowy, highy, xdivs, ydivs, withSurf, hV, vV)\n\n l ocal f, delx, dely, surf, plotter, i, j:\n\n f := unapply ( func, [x, y]):\n delx := (highx-lowx)/xdivs: dely := (highy-lowy)/ydivs:\n su rf :=plot3d(f(x,y),x=lowx..highx, y=lowy..highy, color=blue, style=pat ch):\n plotter :=\{\}:\n for i from 1 to xdivs do\n for j from 1 \+ to ydivs do\n plotter := plotter union \{cuboid([lowx+(i-1)*delx, lowy+(j-1)*dely, 0], [lowx+i*delx, lowy+j*dely, evalf(f(lowx+i*delx,l owy+j*dely))])\}:\n end do:\n end do:\n\n if withSurf = true then \n display3d(plotter union \{surf\}, axes=boxed, style=patch, orien tation=[hV,vV], title=\"Riemann Sums: Volume under F(x,y)\", titlefon t = [TIMES, BOLD, 14]); \n else\n display3d(plotter, axes=boxed , style=patch, orientation=[hV,vV], title=\"Riemann Sums: Volume unde r F(x,y)\", titlefont = [TIMES, BOLD, 14]);\n end if:\n\nend:\n" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 656 "# ----This procedure perfor ms an error check on RiemannSum proc and returns an error msg if attem p to plot fails. \nDrawRiemannSum := proc(func, lowX, highX, lowY, hi ghY, divX, divY, showCurve, hV, vV)\n\n local failPlot:\n\n try\n \+ RiemannSum (func, lowX, highX, lowY, highY, divX, divY, showCurve, \+ hV, vV):\n catch:\n failPlot := \n textplot3d([4,4,3,\"Th ere is an error with your parameters.\"]), textplot3d([4,4,2, \"The fu nction may not be continuous in the given range.\"]):\n display(f ailPlot, axes=BOXED, view=[-5..5, -5..5, -5..5], color=RED, title=\"Ri emann Sums: Volume under F(x,y)\", titlefont = [TIMES, BOLD, 14]):\n \+ end try;\n\nend:\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 436 "# - ---Calculate the RiemannSum\nCalculation := proc (func, lowx, highx, l owy, highy, xdivs, ydivs)\n\n local delx, dely, f, SummationValue, Ex actValue, ApproximateValue:\n\n delx := (highx-lowx)/xdivs: dely := \+ (highy-lowy)/ydivs:\n f := unapply ( func, [x,y]):\n SummationValue \+ := rightsum(rightsum(f(x, y), x=lowx..highx,xdivs), y = lowy..highy,yd ivs);\n ExactValue := evalf(value(SummationValue));\n\n SummationVal ue = ExactValue;\n\nend:\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 383 "# ----Returns the exact volume under the surface\nExactCalculatio n := proc(func, lowx, highx, lowy, highy)\n\n local f, SymbolRepresen tation, ExactValue;\n\n f := unapply( func, [x,y] );\n\n SymbolRepre sentation := Int(Int(f(x,y), y=lowy..highy), x=lowx..highx);\n ExactV alue := evalf(int(f(x,y), [x,y] = Rectangle(lowx..highx,lowy..highy))) ;\n\n SymbolRepresentation = ExactValue;\n\nend:\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 7776 "bd := 'border'=true:\ns := 'inset'=0, ' spacing'=0:\ncd := 'background'=\"#DDFFFF\":\ndc := 'background'=\"#CC FFFF\":\nlc := 'background'=\"#EEFFFF\":\n\nRiemannSumMaplet := Maplet ( \n \n 'onstartup' = RunWindow('MainWin'),\n\n Font['F1']('family' =\"Comic Sans MS\", 'bold'='false', 'italic'='false', size=12),\n Fon t['F2']('family'=\"Comic Sans MS\", 'bold'='true', 'italic'='false', s ize=14),\n \n Window['MainWin']('title' = \"Riemann Sums\", 'menub ar'='Menu', 'layout' = 'Body', 'width'=950, 'height'=800),\n Window[' HelpWin']('title' = \"Help: Riemann Sums\", 'layout' = 'HelpBody'),\n \+ Window['DefWin']('title' = \"Definition: Riemann Sums\", 'layout' = ' DefBody'),\n\n BoxLayout['HelpBody']( \n BoxColumn(bd, cd, 'ins et'=0, 'spacing'=4,\n BoxRow(s, cd, \n TextBox('wrapped'=t rue, 'width'=80, 'height'=15, cd, 'font'='F1', 'editable'='false', 'va lue'=\n############################ HELP TEXT (BELOW) ################ ############\n\"The purpose of this Maplet is to aid the user in visua lizing how to represent the integral of f(x,y) with a Reimann Sum.\n\n To Use this Maplet the user must enter 4 pieces of information:\n\n1) \+ Enter a function F, of x,y, which will be used to plot the Riemann Sum .\n2) Enter the domain on which the function F(x,y) will be plotted.\n 3) The number of Rectangles that the user wishes to use along the x an d y axes to create the Riemann Sum.\n4) Mark the checkbox which indica tes whether or not the (x,y) will appear on the graph with the Riemann Sum.\n\nWhen the above pieces of information have been entered it is \+ then possible to 'Plot' the function F(x,y) and its Riemann Sum. It i s also possible to calculate the value of the Integral and the Riemann Sum. Please note that these processes could take a while and there m ay be a waiting period after a button is pressed. There are 2 slider \+ bars located by the graph. These bars are used to control the angle o f rotation of the graph. The default setting is 45 degrees down and 2 35 degrees to the side. After the desired values are set on the slide r bar, it is necessary to re-plot the graph.\n\nPLOTTING ERROR:\nIf a \+ division by 0 occurs or the graph is not continuous/differentiable at \+ the desired co-ordinates then an error will occur and this Maplet will not plot the graphs. The values must be re-entered at this point.\n \nSyntax erros are caused by entereing invalid values in any of the pr ompts. If this happens the Maplet must be restarted.\"\n############# ############### HELP TEXT (ABOVE) ############################\n \+ )\n ),\n BoxRow(s, cd, \n Button(\"Close\", 'font'= 'F1', dc, CloseWindow('HelpWin') )\n )\n ) \n ), \n\n BoxLa yout['DefBody'](\n BoxColumn(bd, 'inset'=0, 'spacing'=4, cd, \n \+ BoxRow(s, cd, \n TextBox('wrapped'=true, 'width'=35, 'height' =3, cd, 'font'='F2', 'editable'='false', 'value'=\n \"Given a surface F(x,y), a region defined by x = a..b and y = c..d, and m and \+ n equally spaced points along the x and y axes respectively, the volum e of the space between the surface F and the plane z=0 is given by the approximation:\"\n )\n ),\n BoxRow(s,cd,\n Ma thMLViewer['Def1']('height'=60, 'width'=600, 'value'=\n MathM L[Export](sum(sum(f(x[i],y[j])*Delta*x, i=1..m)*Delta*y, j=1..n))\n \+ )\n ),\n BoxRow(s, cd, TextBox('wrapped'=true, 'width'= 35, 'height'=1, cd, 'font'='F2', 'editable'='false', 'value'=\"where\" )),\n BoxRow(s,cd,\n MathMLViewer['Def2']('height'=60, 'wi dth'=600, 'value'=\n MathML[Export](\{x[i] = a + i*((b-a)/m), y[j] = c + j*((d-c)/n)\})\n )\n ),\n BoxRow(s, cd, T extBox('wrapped'=true, 'width'=35, 'height'=1, cd, 'font'='F2', 'edita ble'='false', 'value'=\"The exact value is given by:\")),\n BoxRo w(s,cd,\n MathMLViewer['Def3']('height'=65, 'width'=600, 'value '=\n MathML[Export](limit(limit(sum(sum(f(x[i],y[j])*Delta*x, i=1..m)*Delta*y, j=1..n), m=infinity), n=infinity)=int(int(f(x,y), y= c..d), x=a..b))\n )\n ),\n BoxRow (s,cd, Button(\"Clo se\", 'font'='F1', dc, CloseWindow('DefWin')))\n )\n ),\n \n B oxLayout['Body'](\n BoxRow(s, cd, \n BoxColumn(s, cd, bd, 'cap tion'=\"Plotter\", \n BoxRow(s, cd,\n Plotter['Plot']( lc),\n Slider['VertView'](lower=0,background=\"#DDFFFF\",fill ed=true,majorticks=30,minorticks=10,orientation=vertical,snapticks=fal se,upper=360,value=45)\n ),\n Slider['HorView'](lower=0, background=\"#DDFFFF\",filled=true,majorticks=30,minorticks=10,orienta tion=horizontal,snapticks=false,upper=360,value=45),\n TextBox( 'wrapped'=true, 'width'=35, 'height'=1, cd, 'font'='F1', 'editable'='f alse', 'value'=\"Riemann sum evaluation for the volume under the surfa ce:\"),\n MathMLViewer['RSValue'](cd, 'height'=70, 'width'=400) ,\n TextBox('wrapped'=true, 'width'=35, 'height'=1, cd, 'font'= 'F1', 'editable'='false', 'value'=\"Actual value for volume under the \+ surface:\"),\n MathMLViewer['AValue'](cd, 'height'=70, 'width'= 400)\n ), \n BoxColumn(s, cd, 'inset'=1, 'spacing'=1,\n \+ BoxRow(cd,bd,'caption'=\"Function of (x, y) :\", 'inset'=1, 'spacin g'=1,\n Label(\"F(x, y) = \", 'font'='F1', cd), \n T extField['FuncF'](16, lc, 'value'=x^2*y^2, 'tooltip'=\"Enter a functio n of (x,y)\")\n ), \n BoxRow(s, cd, bd, 'caption'=\"Doma in of F\", \n BoxRow(s,cd,\n Label(\"x\", 'font'= 'F1', cd), \n Label(\" = \", 'font'='F1', cd),\n \+ TextField['xLow'](2, lc, 'value'=-5), \n Label(\"..\", 'fo nt'='F1', cd),\n TextField['xHigh'](2, lc, 'value'=5)\n \+ ),\n BoxRow(s,cd,\n Label(\"y\", 'font'='F1' , cd), \n Label(\" = \", 'font'='F1', cd),\n Tex tField['yLow'](2, lc, 'value'=-5), \n Label(\"..\", 'font'= 'F1', cd),\n TextField['yHigh'](2, lc, 'value'=5)\n \+ )\n ), \n BoxRow(s, cd, bd, 'caption'=\"Number of R ectangles:\", \n BoxRow(s,cd,\n Label(\"x: \", ' font'='F1', cd),\n Slider['xDivs'](lower=1,background=\"#D DFFFF\",filled=true,majorticks=2,minorticks=1,orientation=horizontal,s napticks=true,upper=25,value=10)\n\n ),\n BoxRow(s,c d,\n Label(\"y: \", 'font'='F1', cd),\n Slider ['yDivs'](lower=1,background=\"#DDFFFF\",filled=true,majorticks=2,mino rticks=1,orientation=horizontal,snapticks=true,upper=25,value=10)\n \+ )\n ),\n BoxRow(s,cd,\n CheckBox['showFu nc'](cd, caption=\"Show F(x,y) -> Will appear blue on the graph\")\n \+ ), \n BoxRow(s, cd,\n Button(\"Plot Riemann Sum \", dc, 'tooltip'=\"Plot\",\n 'onclick'=Evaluate('Plot'='Dr awRiemannSum('FuncF', 'xLow', 'xHigh', 'yLow', 'yHigh', 'xDivs', 'yDiv s', 'showFunc', 'HorView', 'VertView')'))\n ),\n BoxRow( s,cd,\n Button(\"Evaluate Riemann Sum and Integral\", dc, 'to oltip'=\"Evaluate True Value of Volume\", 'onclick'='GetVals')\n \+ ), \n BoxRow('inset'=0, 'spacing'=0, cd, \n Button( \"Close\", Shutdown(), dc)\n )\n ) \n ) \n ),\n\n Men uBar['Menu'](\n Menu(\"File\",\n MenuItem(\"Plot Riemann Sun\" , 'onclick'=Evaluate('Plot'='DrawRiemannSum('FuncF', 'xLow', 'xHigh', \+ 'yLow', 'yHigh', 'xDivs', 'yDivs', 'showFunc', 'HorView', 'VertView')' )),\n MenuItem(\"Evaluate Riemann Sum and Integral\", 'onclick'=' GetVals'),\n MenuSeparator(),\n MenuItem(\"Close\", 'onclick '=Shutdown())\n ), \n Menu(\"About\", \n MenuItem(\"Definit ion\", 'onclick'=RunWindow('DefWin'))\n ), \n Menu(\"Help\", \n MenuItem(\"Help\", 'onclick'=RunWindow('HelpWin'))\n ) \n ), \n\n Action['GetVals'](\n Evaluate('RSValue'='Calculation('FuncF' , 'xLow', 'xHigh', 'yLow', 'yHigh', 'xDivs', 'yDivs')'),\n Evaluate ('AValue'='ExactCalculation('FuncF', 'xLow', 'xHigh', 'yLow', 'yHigh') ')\n )\n\n):\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "Maplets[ Display] (RiemannSumMaplet);" }}{PARA 6 "" 1 "" {TEXT -1 38 "Initializ ing Java runtime environment." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "0 5 1" 0 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 } {PAGENUMBERS 0 1 2 33 1 1 }