# Calculus Exploration 11: Arc Length # # The following is the Maple code for the Arc Length Maplet and the Approximate Integration Maplet. Note that arc length (curve length) problems often give rise to integrals with difficult (or nonexistent) primitive antiderivatives expressible in terms of elementary functions. This means that we will be developing new techniques of integration in order to find some of the new antiderivatives that arise from various arc length problems. # # In this exploration, you should use the Arc Length Maplet below to explore the arc length of various curves that you are familiar with. In doing this, you will see new antiderivatives displayed that you are not familiar with. So, currently, you won't be able to find these yourself. However, in these cases you can use the Approximate Integration Maplet to estimate the arc length integral and compare it to that given by the Arc Length Maplet. The point of this exploration is to motivate the new techniques for finding antiderivatives that we will be developing in the weeks ahead. # # Arc Length # Approximate Integration # Click in red area and press [Enter]. # Approximate Integration Maplet # Copyright 2002 Waterloo Maple Inc. # # The Approximate Integration maplet computes, plots, and animates approximated definite integrals of a given function f(x) over a given interval [a, b] using any of the following methods. # Riemann sums using left, right, upper, lower, midpoint, or random points # Trapezoidal rule # Simpson's rule or Simpson's 3/8 rule # Bode's rule # Newton-Cotes' formula # # It also provides a comparison of the above approximations for a given function, range, and number of partitions. # # The user enters a function, and the upper and lower limits (a and b) of the definite integral to approximate. # # The user selects a method for approximation and sets the number of partitions by moving the slider. # # When the user clicks the Plot button, the definite integral of the input function from a to b is approximated and displayed in the plotter window. # # An animation showing how the approximation improves as the number of partitions increases can be generated by setting various options and then clicking the Animate button. # # The user can control how an interval is subdivided. The halve option indicates that the interval is to be subdivided into two equal subintervals. The random option indicates that the interval is to be randomly subdivided. # # The user can control which intervals are to be subpartitioned with each iteration. The all option indicates that every interval is subpartitioned. The width option indicates that the interval with greatest width is subpartitioned. If there is more than one interval with largest width, the leftmost is subpartitioned. The area option indicates that the interval with greatest area is subpartitioned. If there is more than one interval with largest area, the leftmost is subpartitioned. # # When the user clicks the Compare button, a comparison of the values computed by all methods is displayed. # # To run this maplet, click the Execute (!!!) button in the context bar. # restart; ApproxIntegralMaplet := module() ############################################################ export getApproxIntegral, runApproxIntegralMaplet, getPlotOptions, getAnimationOptions, getMethod, getMainExpr, getPartitionExpr, getSavedStr, getupStr, getlowStr, getleftStr, getmidStr, getrightStr, gettrapStr, getsimpStr, getsimp38Str, getbodeStr, getorder5Str, getorder6Str, getorder7Str, getorder8Str: local helpStr, savedStr, upStr, lowStr, leftStr, midStr , rightStr, trapStr, simpStr, simp38Str, bodeStr, order5Str, order6Str,order7Str,order8Str: ############################################################ ############################################################ helpStr := "The Approximate Integration maplet computes, plots, and animates approximated definite integrals of a given function f(x) over a given interval [a, b] using any of the following methods. · Riemann sums using left, right, upper, lower, midpoint, or random points · Trapezoidal rule · Simpson's rule or Simpson's 3/8 rule · Bode's rule . Newton-Cotes' formula It also provides a comparison of the above approximations for a given function, range, and number of partitions. Enter a function, and the upper and lower limits (a and b) of the definite integral to approximate. Select a method for approximation and set the number of partitions by moving the slider. Click the 'Plot' button. The definite integral of the function from a to b is approximated and displayed in the plotter window. To display an animation of how the approximation improves as the number of partitions increases, set various options and click the 'Animate' button. To control how an interval is subdivided, select 'halve' or 'random'. The 'halve' option indicates that the interval is to be subdivided into two equal subintervals. The 'random' option indicates that the interval is to be randomly subdivided. To control which intervals are to be subpartitioned with each iteration, select 'all', 'width', or 'area'. The 'all' option indicates that every interval is subpartitioned. The 'width' option indicates that the interval with greatest width is subpartitioned. If there is more than one interval with largest width, the leftmost is subpartitioned. The 'area' option indicates that the interval with greatest area is subpartitioned. If there is more than one interval with largest area, the leftmost is subpartitioned. To compare the values computed by all methods, click the 'Compare' button. ": ############################################################ ############################################################ getSavedStr:= proc() savedStr; end: getupStr:=proc() upStr; end: getlowStr:=proc() lowStr; end: getleftStr:=proc() leftStr; end: getmidStr:=proc() midStr; end: getrightStr:=proc() rightStr; end: gettrapStr:=proc() trapStr; end: getsimpStr:=proc() simpStr; end: getsimp38Str:=proc() simp38Str; end: getbodeStr:=proc() bodeStr; end: getorder5Str:=proc() order5Str; end: getorder6Str:=proc() order6Str; end: getorder7Str:=proc() order7Str; end: getorder8Str:=proc() order8Str; end: ############################################################ getMainExpr := proc(P_fun, P_a, P_b) local temp, temp2, str, view: use Maplets:-Tools, StringTools in temp:=Trim(P_fun): if temp="" then error "No function or algebraic expression entered": end if: str := temp: temp:=Trim(P_a): if temp="" then error "No lower limit entered: a = ?": end if: temp2:=Trim(P_b): if temp2="" then error "No upper limit entered: b = ?": end if: str := cat(str, ", ", temp, "..", temp2): return str: end use: end proc: # end getMainExpr ############################################################ ############################################################ getPartitionExpr := proc(P_partition,P_fun, P_a, P_b) local str, numPartition: use Maplets:-Tools, StringTools in numPartition:=parse(P_partition): return cat(getMainExpr(P_fun, P_a, P_b), ", ", "partition=", numPartition ): end use: end proc: # end getPartitionExpr ############################################################ ############################################################ getPlotOptions := proc(isOutline, isShowArea, isShowFunction, isShowPoints,P_x1, P_x2, P_y1, P_y2,P_partition,P_fun, P_a, P_b) local temp, temp2, str, view: use Maplets:-Tools, StringTools in str := getPartitionExpr(P_partition,P_fun, P_a, P_b): if isOutline=true then str := cat(str, ", outline=true"): end if: if isShowArea=false then str := cat(str, ", showarea=false"): end if: if isShowFunction=false then str := cat(str, ", showfunction=false"): end if: if isShowPoints=false then str := cat(str, ", showpoints=false"): end if: view := ["DEFAULT","DEFAULT"]: temp:=Trim(P_x1): temp2:=Trim(P_x2): if temp<>"" and temp2<>"" then temp:=cat(temp, "..", temp2): view[1]:=temp: end if: temp:=Trim(P_y1): temp2:=Trim(P_y2): if temp<>"" and temp2<>"" then temp:=cat(temp, "..", temp2): view[2]:=temp: end if: if not (view[1]="DEFAULT" and view[2]="DEFAULT") then temp:=cat(", view=[", view[1], ", ", view[2], "]"): str := cat(str, temp): end if: return str: end use: end proc: # end getPlotOptions ############################################################ ############################################################ getAnimationOptions := proc(P_iterations, isRandomly, isWidth,isArea) local temp, list, i, str: use Maplets:-Tools, StringTools in temp:=Trim(P_iterations): if temp<>"" then list := [cat("iterations=",temp)]: end if: if isRandomly=true then list := [op(list), "refinement=random"]: end if: if isWidth=true then list := [op(list), "subpartition=width"]: elif isArea=true then list := [op(list), "subpartition=area"]: end if: if nops(list)=0 then return NULL: else str := "": for i from 1 to nops(list) do str := cat(str, ", ", list[i]): end do: return str: end if: end use: end proc: # end getAnimationOptions ############################################################ ############################################################ getMethod := proc(way, isLeft, isRight, isUp, isLow, isRandom, isTrap, isSimp, isSimp38, isBode, isNewton,P_order) local method: use Maplets:-Tools in if isLeft = true then method := "left": elif isRight = true then method := "right": elif isUp = true then method := "upper": elif isLow = true then method := "lower": elif isRandom = true then method := "random": elif isTrap = true then method := "trapezoid": elif isSimp = true then method := "simpson": elif isSimp38 = true then method := "simpson[3/8]": elif isBode = true then method := "bode": elif isNewton = true then method := StringTools:-Trim(P_order): if method="" then error "Enter the order of Newton-Cotes' method": end if: method := cat("newtoncotes[", method, "]"): else return NULL: end if: return cat(", method=", method): end use: end proc: # end ApproxIntegral ############################################################ ############################################################ getApproxIntegral := proc(way,P_fun, P_a, P_b,isLeft, isRight, isUp, isLow, isRandom, isTrap, isSimp, isSimp38, isBode, isNewton,P_order,isOutline, isShowArea, isShowFunction, isShowPoints,P_x1, P_x2, P_y1, P_y2,P_iterations, isRandomly, isWidth,isArea,P_partition) local str, temp,method: use Student:-Calculus1, Maplets:-Tools, StringTools in method:= parse(way): if method=plot then str := getPlotOptions(isOutline, isShowArea, isShowFunction, isShowPoints,P_x1, P_x2, P_y1,P_y2,P_partition,P_fun, P_a, P_b): str := cat(str, getMethod(way, isLeft, isRight, isUp, isLow, isRandom, isTrap, isSimp, isSimp38, isBode, isNewton,P_order) ): savedStr:=evalf(ApproximateInt(parse(str))): ApproximateInt(parse(str), title=" ",output=plot): elif method=animation then str := getPlotOptions(isOutline, isShowArea, isShowFunction, isShowPoints,P_x1, P_x2, P_y1, P_y2,P_partition,P_fun, P_a, P_b): str := cat (str, getMethod(way, isLeft, isRight, isUp, isLow, isRandom, isTrap, isSimp, isSimp38, isBode, isNewton,P_order), getAnimationOptions(P_iterations, isRandomly, isWidth,isArea) ): savedStr:=ApproximateInt(parse(str)): ApproximateInt(parse(str),title=" ", output=animation): elif method=list then str := getPartitionExpr(P_partition,P_fun, P_a, P_b): temp:= cat(str,",method=upper"): upStr := evalf(ApproximateInt(parse(temp)), 22): temp:= cat(str,",method=lower"): lowStr := evalf(ApproximateInt(parse(temp)), 22): temp:= cat(str,",method=left"): leftStr := evalf(ApproximateInt(parse(temp)), 22): temp:= cat(str,",method=midpoint"): midStr := evalf(ApproximateInt(parse(temp)), 22): temp:= cat(str,",method=right"): rightStr:= evalf(ApproximateInt(parse(temp)), 22): temp:= cat(str,",method=trapezoid"): trapStr := evalf(ApproximateInt(parse(temp)), 22): temp:= cat(str,",method=simpson"): simpStr:= evalf(ApproximateInt(parse(temp)), 22): temp:= cat(str,",method=simpson[3/8]"): simp38Str := evalf(ApproximateInt(parse(temp)), 22): temp:= cat(str,",method=bode"): bodeStr := evalf(ApproximateInt(parse(temp)), 22): temp:= cat(str,",method=newtoncotes[5]"): order5Str:= evalf(ApproximateInt(parse(temp)), 22): temp:= cat(str,",method=newtoncotes[6]"): order6Str := evalf(ApproximateInt(parse(temp)), 22): temp:= cat(str,",method=newtoncotes[7]"): order7Str := evalf(ApproximateInt(parse(temp)), 22): temp:= cat(str,",method=newtoncotes[8]"): order8Str := evalf(ApproximateInt(parse(temp)), 22): else ApproximateInt(parse(str)): end if: end use: end proc: # end getApproxIntegral ############################################################ ############################################################ # pre: null # post: run Inverse Function Maplet runApproxIntegralMaplet := proc() local maplet: use Maplets:-Elements, MathML in ############################################################ maplet := Maplet( 'onstartup'=RunWindow('mainWin'), ############################################################ Font['F1']('family'="Default", 'bold'='true', 'italic'='true'), Font['F2']('family'="Default", 'bold'='true', 'size'=14), ############################################################ MenuBar['MB']( Menu("File", MenuItem("Plot", 'onclick'='A_plot'), MenuItem("Animate", 'onclick'='A_animate'), MenuSeparator(), MenuItem("Close", 'onclick'=Shutdown()) ), # end Menu/File Menu("Compare", MenuItem("Compare Methods", 'onclick'=A_compare) ), # end menu/Compare Menu("Help", MenuItem("Using this Maplet", 'onclick'=RunWindow('helpWin')) ) # end menu/Help ), # end MenuBar ############################################################ Window['mainWin']('resizable'='false', 'title'="Calculus 1 - Approximate Integration", 'menubar'='MB', 'defaultbutton'='B_plot', BoxColumn('inset'=0, 'spacing'=0, 'background'="#DDFFFF", BoxRow('inset'=0, 'spacing'=2, 'background'="#DDFFFF", BoxRow('inset'=0, 'spacing'=0, 'background'="#DDFFFF", 'border'='true', 'caption'="Enter a function and interval", Label("Function ", 'font'='F2', 'background'="#DDFFFF"), TextField['TF_fun']('width'=20, 'background'="#EEFFFF", 'tooltip'="Enter any valid function or algebraic expression", 'value'=sin(x)), Label(" a ", 'font'='F2', 'background'="#DDFFFF"), Label(" = ", 'font'='F1', 'background'="#DDFFFF"), TextField['TF_a']('value'=0, 'width'=2, 'background'="#EEFFFF", 'tooltip'="Enter the lower limit of approximated integral"), Label(" b ", 'font'='F2', 'background'="#DDFFFF"), Label(" = ", 'font'='F1', 'background'="#DDFFFF"), TextField['TF_b']('value'="Pi", 'width'=2, 'background'="#EEFFFF", 'tooltip'="Enter the upper limit of approximated integral") ) # end BoxRow ), # end BoxRow BoxRow('inset'=0, 'spacing'=0, 'background'="#DDFFFF", BoxColumn('inset'=0, 'spacing'=0, 'background'="#DDFFFF", BoxRow('inset'=0, 'spacing'=0, 'background'="#DDFFFF", 'border'='true', 'caption'="Plot Window", Plotter['P']('background'="#EEFFFF", 'cyclic'=true, 'continuous'=true, 'delay'=300) ), # end BoxRow BoxColumn('inset'=0, 'spacing'=5, 'background'="#DDFFFF", 'border'='true', 'caption'="Display Options", BoxRow('inset'=0, 'spacing'=6, 'background'="#DDFFFF", CheckBox[CB_showarea]('value'=true, 'background'="#DDFFFF", 'caption'="Show the value of the area" ), # end CheckBox CheckBox[CB_showfunction]('value'=true, 'background'="#DDFFFF", 'caption'="Show function" ) # end CheckBox ), # BoxRow BoxRow('inset'=0, 'spacing'=4, 'background'="#DDFFFF", CheckBox[CB_outline]('value'=false, 'background'="#DDFFFF", 'caption'="Outline the boxes as a whole" ), # end CheckBox CheckBox[CB_showpoints]('value'=true, 'background'="#DDFFFF", 'caption'="Show points" ) # end CheckBox ), # BoxRow BoxRow('inset'=0, 'spacing'=0, 'background'="#DDFFFF", Label("x", 'font'='F2', 'background'="#DDFFFF"), Label(" = ", 'font'='F1', 'background'="#DDFFFF"), TextField['x1'](2, 'background'="#EEFFFF",'value'=" "), Label(" .. ", 'font'='F2', 'background'="#DDFFFF"), TextField['x2'](2, 'background'="#EEFFFF",'value'=" "), Label(" y", 'font'='F2', 'background'="#DDFFFF"), Label(" = ", 'font'='F1', 'background'="#DDFFFF"), TextField['y1'](2, 'background'="#EEFFFF",'value'=" "), Label(" .. ", 'font'='F2', 'background'="#DDFFFF"), TextField['y2'](2, 'background'="#EEFFFF",'value'=" ") ) # end BoxRow ) # end BoxColumn ), # end BoxColumn BoxColumn('inset'=0, 'spacing'=0, 'background'="#DDFFFF", BoxColumn('inset'=0, 'spacing'=0, 'background'="#DDFFFF", 'border'='true', 'caption'="Riemann Sums", BoxRow('inset'=0, 'spacing'=0, 'background'="#DDFFFF", RadioButton['RB_up']('caption'="upper", 'group'='BG_methods', 'background'="#DDFFFF", 'tooltip'="Upper Riemann sum"), RadioButton['RB_low']('caption'="lower", 'group'='BG_methods', 'background'="#DDFFFF", 'tooltip'="Lower Riemann sum"), RadioButton['RB_random']('caption'="random", 'group'='BG_methods', 'background'="#DDFFFF", 'tooltip'="Random selection of point") ), # end BoxRow BoxRow('inset'=0, 'spacing'=0, 'background'="#DDFFFF", RadioButton['RB_left']('caption'="left", 'group'='BG_methods', 'background'="#DDFFFF", 'tooltip'="Left Riemann sum"), RadioButton['RB_mid']('caption'="midpoint", 'group'='BG_methods', 'background'="#DDFFFF", 'tooltip'="Midpoint Riemann sum", 'value'=true), RadioButton['RB_right']('caption'="right", 'group'='BG_methods', 'background'="#DDFFFF", 'tooltip'="Right Riemann sum") ) # end BoxRow ), # end BoxColumn BoxColumn('inset'=0, 'spacing'=0, 'background'="#DDFFFF", 'border'='true', 'caption'="Newton-Cotes' Formulae", BoxRow('inset'=0, 'spacing'=0, 'background'="#DDFFFF", RadioButton['RB_trap']('group'='BG_methods', 'caption'="Trapezoidal Rule", 'background'="#DDFFFF"), RadioButton['RB_simp']('group'='BG_methods', 'caption'="Simpson's Rule", 'background'="#DDFFFF") ), # end BoxRow BoxRow('inset'=0, 'spacing'=0, 'background'="#DDFFFF", RadioButton['RB_simp38']('group'='BG_methods', 'caption'="Simpson's 3/8 Rule", 'background'="#DDFFFF"), RadioButton['RB_bode']('group'='BG_methods', 'caption'="Bode's Rule", 'background'="#DDFFFF") ), # end BoxRow BoxRow('inset'=0, 'spacing'=0, 'background'="#DDFFFF", RadioButton['RB_newton']('group'='BG_methods', 'caption'="Newton-Cotes' Formula", 'background'="#DDFFFF"), Label("with order = ", 'background'="#DDFFFF"), TextField['TF_order'](2, 'value'=5, 'background'="#EEFFFF") ) # end BoxRow ), # end BoxColumn BoxColumn('inset'=0, 'spacing'=0, 'background'="#DDFFFF", 'border'='true', 'caption'="Number of Partition", Slider['SL_partition']('lower'=1, 'upper'=46, 'background'="#DDFFFF", 'foreground'="#CCFFFF", 'majorticks'=9, 'minorticks'=1, 'value'=10, 'tooltip'="Initial number of equally spaced subintervals" ) # end Slider ), # end BoxColumn BoxRow('inset'=0, 'spacing'=0, 'background'="#DDFFFF", 'border'='true', 'caption'="Approximated Area", Label("Area", 'font'='F2', 'background'="#DDFFFF"), Label(" = ", 'font'='F1', 'background'="#DDFFFF"), TextField['TF_area']('width'=18, 'background'="#EEFFFF", 'editable'=false, 'tooltip'="Approximated integral sum",'value'=" "), TextField['way_plot']('value'="plot",'visible'='false'), TextField['way_animate']('value'="animation",'visible'='false'), TextField['way_list']('value'="list",'visible'='false') ), # end BoxRow BoxColumn('inset'=0, 'spacing'=0, 'background'="#DDFFFF", 'border'='true', 'caption'="Animation Options", BoxRow('inset'=0, 'spacing'=4, 'background'="#DDFFFF", Button[B_play]("Play", 'background'="#EEFFFF", 'enabled'=false, SetOption(P('play')=true)), Button[B_stop]("Stop", 'background'="#EEFFFF", 'enabled'=false, SetOption(P('`stop`')=true)), Button[B_pause]("Pause", 'background'="#EEFFFF", 'enabled'=false, SetOption(P('pause')=true)) ), # end BoxRow BoxRow('inset'=0, 'spacing'=4, 'background'="#DDFFFF", Button[B_backward]("Backward", 'background'="#EEFFFF", 'enabled'=false, SetOption(P('frame_backwards')=true), 'tooltip'="Previous frame", 'visible'='false'), Button[B_forward]("Forward", 'background'="#EEFFFF", 'enabled'=false, SetOption(P('frame_forward')=true), 'tooltip'="Next frame", 'visible'='false') ), # end BoxRow BoxRow('inset'=0, 'spacing'=0, 'background'="#DDFFFF", Label("Number of Frames: ", 'background'="#DDFFFF"), TextField['TF_iterations']('value'=4, 'width'=3, 'background'="#EEFFFF"), Label(" "), CheckBox[CB_repeat]('value'=true, 'background'="#DDFFFF", 'caption'="Repeat animation", 'enabled'=false, 'onchange'=SetOption(target=P, `option`='continuous', Argument(CB_repeat) ) ) # end CheckBox ), # end BoxRow BoxRow('inset'=0, 'spacing'=0, 'background'="#DDFFFF", Label("Subdivide Interval: ", 'background'="#DDFFFF"), RadioButton['RB_halve']('group'='BG_refinement', 'caption'="halve", 'value'=true, 'background'="#DDFFFF", 'tooltip'="Halve each interval" ), RadioButton['RB_randomly']('group'='BG_refinement', 'caption'="random", 'background'="#DDFFFF", 'tooltip'="Randomly divide each interval" ) ), # end BoxRow BoxRow('inset'=0, 'spacing'=0, 'background'="#DDFFFF", Label("Subpartition: ", 'background'="#DDFFFF"), RadioButton['RB_all']('group'='BG_subpartition', 'caption'="all ", 'value'=true, 'background'="#DDFFFF", 'tooltip'="Divide all partitions" ), RadioButton['RB_width']('group'='BG_subpartition', 'caption'="width", 'background'="#DDFFFF", 'tooltip'="Divide partition with the longest width" ), RadioButton['RB_area']('group'='BG_subpartition', 'caption'="area", 'background'="#DDFFFF", 'tooltip'="Divide partition with the largest area" ) ) # end BoxRow ), # end BoxColumn BoxRow('inset'=0, 'spacing'=1, 'background'="#DDFFFF", Button['B_plot']("Plot", 'background'="#EEFFFF", 'onclick'='A_plot'), Button("Animate", 'background'="#EEFFFF", 'onclick'='A_animate'), Button("Compare", 'background'="#EEFFFF", 'onclick'='A_compare', 'tooltip'="Compare values of each method"), Button("Close", 'onclick'=Shutdown(), 'background'="#EEFFFF") ) # end BoxRow ) # end Column ) # end BoxRow ) # end BoxColumn ), # end Window ############################################################ Window['helpWin']( 'resizable'='false', 'title'="Using the Approximate Integration Maplet", BoxColumn('border'='true', 'inset'=0, 'spacing'=10, 'background'="#CCFFFF", BoxCell( TextBox('height'=20, 'width'=36, 'background'="#EEFFFF", 'foreground'="#333399", 'editable'='false', 'font'='F2', 'value'=helpStr ) # end TextBox ), # end BoxCell BoxRow('inset'=0, 'spacing'=0, 'background'="#CCFFFF", Button("Close", CloseWindow('helpWin'), 'background'="#DDFFFF") ) # end BoxRow ) # end BoxColumn ), # end helpWin ############################################################ Window['compWin']( 'resizable'='false', 'title'=" Comparison of Approximated Values", BoxColumn('inset'=0, 'spacing'=10, 'background'="#DDFFFF", GridLayout('background'="#DDFFFF", 'inset'=0, 'border'=true, 'caption'="Riemann Sums", GridRow('halign'=left, GridCell(Label("Method ", 'font'='F2')), GridCell(Label("Approximated Integral Value", 'font'='F2')) ), # GridRow GridRow('halign'=left, GridCell(" Upper Sum ", 'halign'=left), GridCell(TextField['TF_up']('background'="#DDFFFF", 'value'=" ")) ), # GridRow GridRow('halign'=left, GridCell(" Lower Sum "), GridCell(TextField['TF_low']('background'="#DDFFFF", 'value'=" ")) ), # GridRow GridRow('halign'=left, GridCell(" Left Sum "), GridCell(TextField['TF_left']('background'="#DDFFFF", 'value'=" ")) ), # GridRow GridRow('halign'=left, GridCell(" Midpoint "), GridCell(TextField['TF_mid']('background'="#DDFFFF", 'value'=" ")) ), # GridRow GridRow('halign'=left, GridCell(" Right Sum "), GridCell(TextField['TF_right']('background'="#DDFFFF", 'value'=" ")) ) # GridRow ), # end GridLayout GridLayout('background'="#DDFFFF", 'inset'=0, 'border'=true, 'caption'="Newton-Cotes' Formulae", GridRow('halign'=left, GridCell(Label("Order", 'font'='F2')), GridCell(Label("Method ", 'font'='F2')), GridCell(Label("Approximated Integral Value", 'font'='F2')) ), # GridRow GridRow('halign'=left, GridCell("1"), GridCell("Trapezoidal Rule "), GridCell(TextField['TF_trap']('background'="#DDFFFF", 'value'=" ")) ), # GridRow GridRow('halign'=left, GridCell("2"), GridCell("Simpson's Rule "), GridCell(TextField['TF_simp']('background'="#DDFFFF", 'value'=" ")) ), # GridRow GridRow('halign'=left, GridCell("3"), GridCell("Simpson's 3/8 Rule "), GridCell(TextField['TF_simp38']('background'="#DDFFFF", 'value'=" ")) ), # GridRow GridRow('halign'=left, GridCell("4"), GridCell("Bode's Rule "), GridCell(TextField['TF_bode']('background'="#DDFFFF", 'value'=" ")) ), # GridRow GridRow('halign'=left, GridCell("5"), GridCell(""), GridCell(TextField['TF_order5']('background'="#DDFFFF", 'value'=" ")) ), # GridRow GridRow('halign'=left, GridCell("6"), GridCell(""), GridCell(TextField['TF_order6']('background'="#DDFFFF", 'value'=" ")) ), # GridRow GridRow('halign'=left, GridCell("7"), GridCell(""), GridCell(TextField['TF_order7']('background'="#DDFFFF", 'value'=" ")) ), # GridRow GridRow('halign'=left, GridCell("8"), GridCell(""), GridCell(TextField['TF_order8']('background'="#DDFFFF", 'value'=" ")) ) # GridRow ), # end GridLayout BoxRow('inset'=0, 'spacing'=0, 'background'="#DDFFFF", Button("Close", CloseWindow('compWin'), 'background'="#DDFFFF", 'foreground'="#333399") ) # end BoxRow ) # end BoxColumn ), # end sumWin ############################################################ ButtonGroup['BG_methods'](), ButtonGroup['BG_refinement'](), ButtonGroup['BG_subpartition'](), ############################################################ Action['A_compare'] ( Evaluate ( 'waitforresult'='false','function'='getApproxIntegral', Argument('way_list'), Argument('TF_fun',quotedtext='true'), Argument('TF_a',quotedtext='true'), Argument('TF_b',quotedtext='true'), Argument(RB_left), Argument(RB_right), Argument(RB_up), Argument(RB_low), Argument(RB_random), Argument(RB_trap), Argument(RB_simp), Argument(RB_simp38), Argument(RB_bode), Argument(RB_newton), Argument('TF_order',quotedtext='true'), Argument(CB_outline), Argument(CB_showarea), Argument(CB_showfunction), Argument(CB_showpoints), Argument('x1',quotedtext='true'), Argument('x2',quotedtext='true'), Argument('y1',quotedtext='true'), Argument('y2',quotedtext='true'), Argument('TF_iterations',quotedtext='true'), Argument(RB_randomly), Argument(RB_width), Argument(RB_area), Argument('SL_partition',quotedtext='true') ), Evaluate ('waitforresult'='false','target'='TF_up','function'='getupStr' ), Evaluate ('waitforresult'='false','target'='TF_low','function'='getlowStr' ), Evaluate ('waitforresult'='false','target'='TF_left','function'='getleftStr' ), Evaluate ('waitforresult'='false','target'='TF_mid','function'=' getmidStr' ), Evaluate ('waitforresult'='false','target'='TF_right','function'='getrightStr' ), Evaluate ('waitforresult'='false','target'='TF_trap','function'='gettrapStr' ), Evaluate ('waitforresult'='false','target'='TF_simp','function'=' getsimpStr' ), Evaluate ('waitforresult'='false','target'='TF_simp38','function'='getsimp38Str' ), Evaluate ('waitforresult'='false','target'='TF_bode','function'=' getbodeStr' ), Evaluate ('waitforresult'='false','target'='TF_order5','function'='getorder5Str' ), Evaluate ('waitforresult'='false','target'='TF_order6','function'='getorder6Str' ), Evaluate ('waitforresult'='false','target'='TF_order7','function'='getorder7Str' ), Evaluate ('waitforresult'='false','target'='TF_order8','function'='getorder8Str' ), RunWindow('compWin') ), # end A_comp Action['A_plot'] ( Evaluate ( 'waitforresult'='false','target'='P','function'='getApproxIntegral', Argument('way_plot',quotedtext='true'), Argument('TF_fun',quotedtext='true'), Argument('TF_a',quotedtext='true'), Argument('TF_b',quotedtext='true'), Argument(RB_left), Argument(RB_right), Argument(RB_up), Argument(RB_low), Argument(RB_random), Argument(RB_trap), Argument(RB_simp), Argument(RB_simp38), Argument(RB_bode), Argument(RB_newton), Argument('TF_order',quotedtext='true'), Argument(CB_outline), Argument(CB_showarea), Argument(CB_showfunction), Argument(CB_showpoints), Argument('x1',quotedtext='true'), Argument('x2',quotedtext='true'), Argument('y1',quotedtext='true'), Argument('y2',quotedtext='true'), Argument('TF_iterations',quotedtext='true'), Argument(RB_randomly), Argument(RB_width), Argument(RB_area), Argument('SL_partition',quotedtext='true') ), Evaluate ('waitforresult'='false','target'='TF_area', 'function'='getSavedStr' ), SetOption( 'B_play'('enabled')='false'), SetOption( 'B_stop'('enabled')='false'), SetOption( 'B_pause'('enabled')='false'), SetOption( 'B_backward'('enabled')='false'), SetOption( 'B_forward'('enabled')='false'), SetOption( 'CB_repeat'('enabled')='false') ), Action['A_animate'] ( Evaluate ( 'waitforresult'='false','target'='P','function'='getApproxIntegral', Argument('way_animate'), Argument('TF_fun',quotedtext='true'), Argument('TF_a',quotedtext='true'), Argument('TF_b',quotedtext='true'), Argument(RB_left), Argument(RB_right), Argument(RB_up), Argument(RB_low), Argument(RB_random), Argument(RB_trap), Argument(RB_simp), Argument(RB_simp38), Argument(RB_bode), Argument(RB_newton), Argument('TF_order',quotedtext='true'), Argument(CB_outline), Argument(CB_showarea), Argument(CB_showfunction), Argument(CB_showpoints), Argument('x1',quotedtext='true'), Argument('x2',quotedtext='true'), Argument('y1',quotedtext='true'), Argument('y2',quotedtext='true'), Argument('TF_iterations',quotedtext='true'), Argument(RB_randomly), Argument(RB_width), Argument(RB_area), Argument('SL_partition',quotedtext='true') ), SetOption( 'B_play'('enabled')='true'), SetOption( 'B_stop'('enabled')='true'), SetOption( 'B_pause'('enabled')='true'), SetOption( 'B_backward'('enabled')='true'), SetOption( 'B_forward'('enabled')='true'), SetOption( 'CB_repeat'('enabled')='true') ), Action['A']() ############################################################ ): # end Maplet ############################################################ Maplets:-Display(maplet): end use: # end use end proc: # end proc ############################################################ end module: # end module ApproxIntegralMaplet:-runApproxIntegralMaplet();