{VERSION 3 0 "SUN SPARC SOLARIS" "3.0" }
{USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0
1 0 0 0 0 }{CSTYLE "" -1 256 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }
{CSTYLE "" -1 257 "" 0 1 0 0 0 0 0 1 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 }{CSTYLE "" -1 259 "" 0 1 0 0 0 0 0
1 0 0 0 0 0 0 0 }{CSTYLE "" -1 260 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }
{CSTYLE "" -1 261 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{CSTYLE "" -1 262
"" 0 1 0 0 0 0 1 0 1 0 0 0 0 0 0 }{CSTYLE "" -1 263 "" 0 1 0 0 0 0 1
0 1 0 0 0 0 0 0 }{CSTYLE "" -1 264 "" 0 1 0 0 0 0 1 0 1 0 0 0 0 0 0 }
{CSTYLE "" -1 265 "" 0 1 0 0 0 0 1 0 1 0 0 0 0 0 0 }{CSTYLE "" -1 266
"" 0 1 0 0 0 0 1 0 1 0 0 0 0 0 0 }{CSTYLE "" -1 267 "" 0 1 0 0 0 0 1
0 0 0 0 0 0 0 0 }{CSTYLE "" -1 268 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 }
{CSTYLE "" -1 269 "" 0 1 0 0 0 0 1 0 1 0 0 0 0 0 0 }{CSTYLE "" -1 270
"" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 }{PSTYLE "Normal" -1 0 1 {CSTYLE ""
-1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1
0 }{PSTYLE "R3 Font 0" -1 256 1 {CSTYLE "" -1 -1 "Helvetica" 1 24 0 0
0 0 2 1 2 0 0 0 0 0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "R3 Fo
nt 2" -1 257 1 {CSTYLE "" -1 -1 "Courier" 1 24 0 0 0 0 2 1 2 0 0 0 0
0 0 }0 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }}
{SECT 0 {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG
{PARA 0 "" 0 "" {TEXT -1 179 "@ Copyright 1995-99 by Arlen Strader and
Philip B. Yasskin, Texas A&M Univ.\n\nCalculus Lab: \n \n Using \+
Riemann Sums to Approximate the \n\n Area under a C
urve\n" }}{PARA 0 "" 0 "" {TEXT -1 119 "(You may need to edit the \"re
ad\" statement before executing. It may need the full path to the fil
e inside the quotes.)" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 67 "with(stude
nt): with(plots):\nread(\"riemann_init.m\"); INITIALIZE;" }}}
{EXCHG {PARA 0 "" 0 "" {TEXT -1 32 "This worked if the output says \"
" }{TEXT 267 16 "Demo Initialized" }{TEXT -1 61 ".\" You need to fix \+
the \"read\" statement if the output says \"" }{TEXT 268 10 "INITIALIZ
E" }{TEXT -1 2 ".\"" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 41 "\nDefine t
he function with which to work.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0
18 "f:=x-> x^2+9; " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 61 "\nDefin
e the ranges with which to work and plot the function.\n" }}{PARA 0 ">
" 0 "" {MPLTEXT 1 0 34 "xrange:=x= 1..9 ; yrange:= 0..100;" }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 25 "plot(f(x),xrange,yrange);" }
}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 26 "\nAnimate the Riemann sums\n" }}
{PARA 0 "> " 0 "" {MPLTEXT 1 0 47 "RightBox(f,xrange,8,color=maroon,sh
ading=blue);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 45 "LeftBox(f,x
range,8,color=maroon,shading=red);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT
-1 203 "\nWe compute the area of the smallest rectangle containing the
region and the area of the largest rectangle contained in the region.
\nThese are called UPPER and LOWER BOUNDS for the area we are computin
g.\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "f(9);" }}}{EXCHG {PARA 0 "> \+
" 0 "" {MPLTEXT 1 0 21 "upper_bound1 := 8*90;" }}}{EXCHG {PARA 0 "> "
0 "" {MPLTEXT 1 0 5 "f(1);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0
21 "lower_bound1 := 8*10;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 63 "\nSo
the area must be between 80 and 720. NOT VERY INTERESTING!" }}{PARA
0 "" 0 "" {TEXT -1 57 "\nWe compute upper and lower bounds using two r
ectangles:\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "f(1), f(5), f(9);"
}}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 22
"First the upper bound:" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "> \+
" 0 "" {MPLTEXT 1 0 28 "upper_bound2 := 4*34 + 4*90;" }}}{EXCHG {PARA
0 "" 0 "" {TEXT -1 35 "\nNow you compute the lower bound: " }{TEXT
257 40 "(You need to type the rest of the line.)" }{TEXT -1 1 "\n" }}
{PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "lower_bound2 := " }}}{EXCHG {PARA
0 "" 0 "" {TEXT -1 64 "\nSo the area must be between 176 and 496. St
ill not very good." }}{PARA 0 "" 0 "" {TEXT -1 111 "\nNow you compute \+
upper and lower bounds using 4 rectangles:\n(First compute the heights
. What are the widths?)\n" }{TEXT 256 41 "(You need to type the rest \+
of each line.)" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "> \+
" 0 "" {MPLTEXT 1 0 11 "f(1), f(3)," }}}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 16 "upper_bound4 := " }}}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 16 "lower_bound4 := " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1
60 "\nSo the area must be between 240 and 400. A little better." }}
{PARA 0 "" 0 "" {TEXT -1 146 "\nTo go to 8 rectangles, it becomes tedi
ous to compute the function values and then retype each of the values.
So for the upper bound, we compute\n" }}{PARA 0 "> " 0 "" {MPLTEXT
1 0 72 "upper_bound8 := 1*f(2)+1*f(3)+1*f(4)+1*f(5)+1*f(6)+1*f(7)+1*f(
8)+1*f(9);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 95 "\nNow you compute t
he lower bound using 8 rectangles: (You don't need to multiply by the
1's.)\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "lower_bound8 := " }}}
{EXCHG {PARA 0 "" 0 "" {TEXT -1 66 "\nSo the area must be between 276 \+
and 356. Again a little better." }}{PARA 0 "" 0 "" {TEXT -1 450 "\nF
or 16 rectangles, you would want to compute\n\nupper_bound16 := .5*f(1
.5) + .5*f(2) + .5*f(2.5) + ... + .5*f(8) + .5*f(8.5) + .5*f(9);\n\nwi
th 16 terms. Equivalently, you could factor out the .5 and compute\n
\nupper_bound16 := .5*( f(1.5) + f(2) + f(2.5) + ... + f(8) + f(8.5) +
f(9) );\n\nBut even that is too tedious. \n\nSo we use Maple's sum c
ommand. The following command evaluates f(1+.5*i) for each integer i \+
between 1 and 16 and adds the results.\n" }}{PARA 0 "> " 0 ""
{MPLTEXT 1 0 33 "Sum(f(1+.5*i),i=1..16); value(%);" }}}{EXCHG {PARA 0
"" 0 "" {TEXT -1 61 "\nSo to compute the upper bound with 16 rectangle
s we execute\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 26 ".5*Sum(f(1+.5*i),
i=1..16);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "upper_bound16 := value
(%);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 87 "\nNow you compute the low
er bound with 16 rectangles.\n(What should the values of i be?)\n" }}
{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0
17 "lower_bound16 := " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 66 "\nSo the
area must be between 295 and 335. Again a little better." }}{PARA
0 "" 0 "" {TEXT -1 114 "\nNow you compute the upper and lower bounds w
ith 32 rectangles.\n(What are the widths? What are the values of i?)
\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 ""
{MPLTEXT 1 0 17 "upper_bound32 := " }}}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "lower_bound32 :
=" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 46 "\nSo the area must be betwee
n these two values." }}{PARA 0 "" 0 "" {TEXT -1 108 "\nYou could conti
nue this way, but we will automate the process.\n\nWe first let n be t
he number of rectangles:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "n := 64;
" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 37 "\nThen the width of each rect
angle is " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "width := (9 - 1)/n;" }
}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 51 "\nand the function must be evalu
ated at the numbers " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "x = 1 + wid
th * i;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 43 "\nSo the upper bound u
sing 64 rectangles is:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 48 "upper_bou
nd64 := width*sum(f(1+width*i),i=1..n);" }}}{EXCHG {PARA 0 "" 0 ""
{TEXT -1 1 "(" }{TEXT 258 5 "Note:" }{TEXT -1 1 " " }{TEXT 262 3 "sum
" }{TEXT -1 1 " " }{TEXT 259 4 "does" }{TEXT -1 1 " " }{TEXT 263 3 "Su
m" }{TEXT -1 1 " " }{TEXT 260 3 "and" }{TEXT -1 1 " " }{TEXT 264 5 "va
lue" }{TEXT -1 1 " " }{TEXT 261 17 "at the same time." }{TEXT -1 2 " )
" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 53 "\nNow you compute the lower b
ound using 64 rectangles." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "lower_
bound64 := " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 76 "\nThese fractions \+
may be converted into decimals using Maple's evalf command:" }}{PARA
0 "> " 0 "" {MPLTEXT 1 0 33 "up_bnd64 := evalf(upper_bound64);" }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 34 "low_bnd64 := evalf(lower_bou
nd64);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 68 "\nThe average of these \+
two numbers is our best estimate for the area:" }}{PARA 0 "> " 0 ""
{MPLTEXT 1 0 35 "area64 := (up_bnd64 + low_bnd64)/2;" }}}{EXCHG {PARA
0 "" 0 "" {TEXT -1 76 "\nAnd half of the width between them is the max
imum error in our computation:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 41 "h
alf_width64 := (up_bnd64 - low_bnd64)/2;" }}}{EXCHG {PARA 0 "" 0 ""
{TEXT -1 94 "\nSo at this point we know that the area is approximately
314.7 with a maximum error of +/- 5." }}{PARA 0 "" 0 "" {TEXT -1
237 "\nFinally, you compute the upper and lower bounds with 128 rectan
gles.\nExpress your answers in decimals and give your best estimate fo
r the area along with the maximum error. \n(NOTE: The number 128 shou
ld only appear on the first line).\n" }}{PARA 0 "> " 0 "" {MPLTEXT 1
0 5 "n := " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "width := " }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "upper_bound :=" }}}{EXCHG
{PARA 0 "> " 0 "" {MPLTEXT 1 0 15 "lower_bound := " }}}{EXCHG {PARA 0
"> " 0 "" {MPLTEXT 1 0 10 "up_bnd := " }}}{EXCHG {PARA 0 "> " 0 ""
{MPLTEXT 1 0 11 "low_bnd := " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1
0 8 "area := " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "half_width
:= " }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 89 "\nWrite a sentence here g
iving your best estimate for the area and the maximum error:\n\n\n\n\n
" }}{PARA 0 "" 0 "" {TEXT -1 92 "\nCalculate the area to within an err
or of +/- .001 by appropriately increasing the value of " }{TEXT 266
1 "n" }{TEXT -1 75 ". Notice that once you have typed in the commands
you only need to change " }{TEXT 265 1 "n" }{TEXT -1 266 " and re-exe
cute all of the commands. (You can also copy and paste the lines from
above and make the necessary changes.) If Maple bogs down, it's beca
use Maple is doing exact integer arithmetic. You can force decimals b
y putting a decimal point after the value of " }{TEXT 269 1 "n" }
{TEXT -1 1 "." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "
" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}
{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "
" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 42 "Check you a
nswer with Maple's Int command:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "
Int(f(x),x=1..9); value(%); evalf(%);" }}}{EXCHG {PARA 0 "" 0 ""
{TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT 270 13 "Extra Credit:" }{TEXT
-1 166 "\n\nUse these techniques to compute the area of a quarter-circ
le of radius 2 to within +/- .0001 . \nIts equation is y = sqrt(4-x
^2). The x-range should be 0..2 ." }}{PARA 0 "" 0 "" {TEXT -1 137
"Notice the graph if decreasing. What does this say about the upper a
nd lower bounds?\nThe area should come out to be 1/4*Pi*2^2 = Pi .\n
" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{MARK "0 0 0" 0 }
{VIEWOPTS 1 1 0 1 1 1803 }