Defining double integrals - Riemann SumsWorksheet by Mike May, S. J.- maymk@slu.eduRevised by Russell Blyth - blythrd@slu.edurestart; with(Student[Calculus1]):This worksheet uses commands from the Student[Calculus1] package. The line above loads this package and has to be run before the examples will work. Following our pattern in this course we approach a topic in multivariable calculus by reviewing the topic in single variable calculus.Reviewing Riemann sums for functions of one variableRecall that for a function f(x) of one variable, the integral from x=a to x=b is defined as the limit as n approaches infinity of the sum of the areas of rectangles whose widths are obtained by cutting the region from a to b into n subintervals, and whose heights are obtained by approximating the function on each subinterval by a constant function. In loose terms we approximate the region by rectangles and take the limit of their combined areas as we use more and more rectangles.Example 1 We use Riemann sums to approximate NiMtJSRpbnRHNiQsJiokKSUieEciIiQiIiJGK0YpISIiL0YpOywkRitGLEYq . The visual approachWe would like to plot the curve and the approximating rectangles. We start with 7 subintervals.lowx := -1: highx :=2: xdivs :=7:
f := x -> x^3-x:
ApproximateInt(f(x),x=lowx..highx,partition=xdivs,output=plot,method=right);If we increase the number of subintervals we get a very good approximation.The numeric approachThe picture above uses a right hand rule for evaluating the sum. We can have Maple compute this sum for us. It serves our interests to first formally compute the sum, then to evaluate it, and finally to convert to a decimal value.lowx := -1: highx :=2: xdivs :=7:
f := x -> x^3-x:
sum1 := ApproximateInt(f(x),x=lowx..highx,partition=xdivs, output=sum,method=right);
sum2 := value(sum1);
sum3 := evalf(sum2);If we want a better approximation, we can increase the number of subintervals. sum500 := evalf(ApproximateInt(f(x),x=lowx..highx,partition=500, output=value,method=right));We can also set up the sum for an arbitrary number of subintervals and then take the limit as the number of subintervals approaches infinity.sum1arbn := ApproximateInt(f(x),x=lowx..highx,partition='n', output=sum,method=right);
sum2arbn := value(sum1arbn);
sum3inf := limit(sum2arbn,n=infinity);
evalf(sum3inf);We compare this with the result obtained through symbolic integration and see that they are the same.Int(f(x),x) = int(f(x),x);
Int(f(x), x=-1..2) = int(f(x), x=-1..2);
Int(f(x), x=-1..2) = evalf(int(f(x), x=-1..2));Exercise1. The Riemann sum definition of integral is most useful when we are either trying to decide which interval is appropriate in a problem or when we are trying to evaluate an integral that we cannot do symbolically. Approximate Int(sin(x^4)/x^2, x=0..1) by using Riemann sums with 100 subintervals. Generalizing to functions of 2 variablesTo make computations and the Maple programming easier we will restrict to the case where the region of integration is a rectangle. We now want to break up both the x interval and the y interval into subintervals. That means we will be summing the volumes of small boxes with rectangular bases and heights determined by evaluating the function at some point in each small rectangular base. We will visualize how the boxes approximate the region and also find the value of the approximation.Example 2Approximate the volume under the surface obtained by graphing g(x,y) = 2-x^2-y^2 with x and y between -1 and 1. Symbolically we want to evaluate NiMtJSRpbnRHNiQtRiQ2JCwoIiIjIiIiKiQpJSJ4R0YpRiohIiIqJCklInlHRilGKkYuL0YxOywkRipGLkYqL0YtRjM=.The Visual ApproachWe start with 7 subintervals in x and 5 intervals in y. We separately plot the surface, the approximating Riemann sum, and the approximating sum together with the surface.lowx := -1: highx :=1:
lowy := -1: highy :=1:
xdivs :=7: ydivs :=5:
g := (x,y) -> 2 - x^2 - y^2:
plot3d(g(x,y),x=-1..1,y=-1..1,axes=boxed);
Student[MultivariateCalculus][ApproximateInt]
(g(x,y),x=lowx..highx,y=lowy..highy,partition=[xdivs,ydivs], output=plot,axes=boxed,showfunction=false);
Student[MultivariateCalculus][ApproximateInt]
(g(x,y),x=lowx..highx,y=lowy..highy,partition=[xdivs,ydivs], output=plot,axes=boxed);To improve the approximation we increase the number of rectangles used.lowx := -1: highx :=1:
lowy := -1: highy :=1:
xdivs :=25: ydivs :=20:
g := (x,y) -> 2 - x^2 - y^2:
Student[MultivariateCalculus][ApproximateInt]
(g(x,y),x=lowx..highx,y=lowy..highy,partition=[xdivs,ydivs], output=plot,axes=boxed);
Once again we get a better approximation by increasing the number of subintervals. It should be noted however that if we were to increase to 100 subintervals for each of x and y, then we would have to compute the sums of the volumes of 10,000 boxes.The Numeric ApproachOnce again we mimic what we did for a function of one variable. We start by evaluating with a small number of subintervals.lowx := -1: highx :=1:
lowy := -1: highy :=1:
xdivs :=7: ydivs :=5:
g := (x,y) -> 2 - x^2 - y^2:
sum1 := ApproximateInt(ApproximateInt(g(x,y),x=lowx..highx, partition=xdivs,output=sum,method=right), y=lowy..highy,partition=ydivs, output=sum, method=right);
sum2 := value(sum1);
sum3 := evalf(sum2);Next we look at the value we obtain this way with a large number of subintervals. We also take the limit as the number of subintervals approaches infinity.approx100 := ApproximateInt(ApproximateInt(g(x,y),x=lowx..highx,
partition=100,output=sum,method=right), y=lowy..highy,
partition=100, output=sum, method=right);
sum1arbmn :=ApproximateInt(ApproximateInt(g(x,y),x=lowx..highx, partition='n',output=sum,method=right), y=lowy..highy,partition='m',
output=sum, method=right);
sum2arbmn := value(sum1arbmn);
sum3a := limit(limit(sum2arbmn,n=infinity),m=infinity);
limitinfinity = evalf(sum3a);Finally we compare the result above with the result of symbolic integration and see that they are the same.Int(Int(g(x,y),y=-1..1),x=-1..1) = int(int(g(x,y),y=-1..1),x=-1..1);
Int(Int(g(x,y),y=-1..1),x=-1..1) = evalf(int(int(g(x,y),y=-1..1),x=-1..1));Exercises2. Let R be the region with x in NiM3JCIiIiIiIw== and y in NiM3JCIiIiIiJA==. Estimate the integral of NiMsJiokKSUieEciIiMiIiJGKCokKSUieUdGJ0YoRig= over R by evaluating a Riemann sum with 10 subintervals in each of x and y. 3. Let R be the region with x inNiM3JCwkJSNQaUchIiIiIiE= and y in NiM3JCIiISomJSNQaUciIiIiIiMhIiI=. Estimate the integral of NiMtJSRzaW5HNiMqJiUieEciIiIlInlHRig= over R by evaluating a Riemann sum with 10 subintervals in each of x and y.