{VERSION 5 0 "IBM INTEL NT" "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 "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 1 }{CSTYLE "2D Comment" 2 18 "" 0 1 0 0 0 0 0 0 0 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 } {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" 0 3 1 {CSTYLE "" -1 -1 "" 1 18 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }1 0 0 0 8 4 0 0 0 0 0 0 -1 0 }{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 "" 3 256 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 3 257 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 3 258 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {EXCHG {PARA 256 "" 0 "" {TEXT -1 11 "Using Maple" }}{PARA 257 "" 0 "" {TEXT -1 2 "to" }}{PARA 258 "" 0 "" {TEXT -1 25 "Approxima te Areas by Sums" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 92 "First, here are two things to remember in order to avoid \+ throwing away accuracy in this lab:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" } }{PARA 0 "" 0 "" {TEXT -1 132 "(1) Use exact values wherever you can. \+ The right hand endpoint ought to be written as Pi/2, not as some appro ximation like 1.570796." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 419 "(2) It's definitely a good idea to start out by set ting Digits equal to some value larger than the default of 10 (30 shou ld be fine). This tells Maple to carry out the calculations to 30 digi t precision instead of 10 digits. You are computing numbers that will \+ be very close to 1, and then subtracting 1 from the result. There will therefore be lots of error unless you carry the calculations out to a lot of precision." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 13 "Digit s := 30;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%'DigitsG\"#I" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 174 "If I wer e going to do a bunch of things with sums of areas of slices, I'd prob ably want to start out by defining a general function to do the summa tion. Something like this:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 83 "rightrect := (f, a, b, n) ->\nevalf((b-a)/n) * sum(evalf(f(a + (b- a)*k/n)), k=1..n);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%*rightrectGf*6 &%\"fG%\"aG%\"bG%\"nG6\"6$%)operatorG%&arrowGF+*&-%&evalfG6#*&,&9&\"\" \"9%!\"\"F69'F8F6-%$sumG6$-F16#-9$6#,&F7F6*&*&F4F6%\"kGF6F6F9F8F6/FE;F 6F9F6F+F+F+" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 22 "This takes a funct ion " }{XPPEDIT 18 0 "f;" "6#%\"fG" }{TEXT -1 57 " (not an expression) along with left and right endpoints " }{XPPEDIT 18 0 "a;" "6#%\"aG" } {TEXT -1 5 " and " }{XPPEDIT 18 0 "b;" "6#%\"bG" }{TEXT -1 26 " and th e number of slices " }{XPPEDIT 18 0 "n;" "6#%\"nG" }{TEXT -1 102 ", an d returns the sum of the areas with the right hand rule. Here are a co uple of examples of its use:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "rightrect(sin, 0, Pi/2, 10);" }{TEXT -1 0 "" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#$\"?Y!Qz\"pz0-Tp-G[w5!#H" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 106 "This gives one of the numbers you need to compute: the s um of the areas of 10 rectangles for the function " }{XPPEDIT 18 0 "y \+ = sin(x);" "6#/%\"yG-%$sinG6#%\"xG" }{TEXT -1 9 " between " }{XPPEDIT 18 0 "x = 0;" "6#/%\"xG\"\"!" }{TEXT -1 5 " and " }{XPPEDIT 18 0 "x = \+ Pi/2;" "6#/%\"xG*&%#PiG\"\"\"\"\"#!\"\"" }{TEXT -1 81 ". To use a func tion of your own definition, you'd need to do something like this:" }} }{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "f := x -> x^2;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"fGf*6#%\"xG6\"6$%)operatorG%&arrowGF(*$)9$ \"\"#\"\"\"F(F(F(" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "rightr ect(f, 0, 1, 1000000);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#$\"?++++++++ ]LL$QLL$!#I" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 56 "That summed 1,000, 000 right rectangles for the function " }{XPPEDIT 18 0 "y = x^2;" "6#/ %\"yG*$%\"xG\"\"#" }{TEXT -1 9 " between " }{XPPEDIT 18 0 "x = 0;" "6# /%\"xG\"\"!" }{TEXT -1 5 " and " }{XPPEDIT 18 0 "x = 1;" "6#/%\"xG\"\" \"" }{TEXT -1 1 "." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 107 "Similar definitions can be given for functions to sum le ft rectangles, trapezoids, and midpoint rectangles:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 84 "leftrect := (f, a, b, n) ->\nevalf((b-a)/ n) * sum(evalf(f(a + (b-a)*k/n)), k=0..n-1);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%)leftrectGf*6&%\"fG%\"aG%\"bG%\"nG6\"6$%)operatorG%&a rrowGF+*&-%&evalfG6#*&,&9&\"\"\"9%!\"\"F69'F8F6-%$sumG6$-F16#-9$6#,&F7 F6*&*&F4F6%\"kGF6F6F9F8F6/FE;\"\"!,&F9F6F6F8F6F+F+F+" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 70 "trapezoid := (f, a, b, n) ->\n(leftrect(f ,a,b,n)+rightrect(f,a,b,n))/2;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%*t rapezoidGf*6&%\"fG%\"aG%\"bG%\"nG6\"6$%)operatorG%&arrowGF+,&-%)leftre ctG6&9$9%9&9'#\"\"\"\"\"#*&F7F8-%*rightrectGF2F8F8F+F+F+" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 90 "midpoint := (f, a, b, n) ->\nevalf( (b-a)/n) * sum(evalf(f(a + (b-a)*(k+1/2)/n)), k=0..n-1);" }}{PARA 11 " " 1 "" {XPPMATH 20 "6#>%)midpointGf*6&%\"fG%\"aG%\"bG%\"nG6\"6$%)opera torG%&arrowGF+*&-%&evalfG6#*&,&9&\"\"\"9%!\"\"F69'F8F6-%$sumG6$-F16#-9 $6#,&F7F6*&*&F4F6,&%\"kGF6#F6\"\"#F6F6F6F9F8F6/FF;\"\"!,&F9F6F6F8F6F+F +F+" }}}}{MARK "0 0 0" 0 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 } {PAGENUMBERS 0 1 2 33 1 1 }