NAME: YOUR NAME GOES HEREMath 2130: Maple Homework #3Due: Monday (July 30th)Do not email me your answers. I want a paper copy.Please use "ctrl+delete" or "command+delete" to delete unused commands & command prompts. Clean your homework up before printing!You may find my Maple example pages about Double Riemann Sums and Multiple Integrals helpful.Initialization
Don't forget to evaluate these commands or the rest of the sheet will not work properly. Before you print out your homework, click on the triangle to collapse this section back down (so it doesn't print).restart;
with(plots):
with(plottools):
with(LinearAlgebra):
with(VectorCalculus):
#
# doubleRiemann computes Riemann sums for double integrals.
#
# f is a function Ex: f might be "(x,y) -> x^2 + y^2;"
# X and Y are variables with range Ex: X might be "x=0..4"
# The net volume under f restricted to the rectangle defined
# by X and Y's ranges is approximated using m * n rectangles
# (where m and n are positive integers).
#
# EvalType is a list describing the evaluation scheme. The
# default setting is midpoint rule. Ex: EvalType could be
# something like "[Left,Right]" in this case rectangles would
# be evaluated in their upper left hand corners.
# OutputType can be "Value" "RiemannSum" or "Plot". "Value"
# causes the function to return the riemann sum's value.
# "RiemannSum" causes the function to return an unevaluated
# double sum. "Plot" returns a plot of the rectangular boxes
# and the surface. The plot title states the exact and approximate
# values of the double integral.
# T and Tp are transparency settings for the boxes and graph
# respectively. 0 means opaque and 1 means totally transparent.
#
doubleRiemann := proc(f,X,Y,m,n,EvalType := [Midpoint,Midpoint],OutputType := Plot, T := 0, Tp := 0.95)
local i,j,a,b,c,d,xV,yV,Dx,Dy,xS,yS,x,y,rSum,approxVal,actualVal,pTitle,blocks,graph,points;
# grab variable names and range data: "x=a..b & y=c..d"
x := lhs(X); y := lhs(Y);
a := lhs(rhs(X)); b := rhs(rhs(X));
c := lhs(rhs(Y)); d := rhs(rhs(Y));
# compute delta x and delta y (lengths and widths of subrectangles).
Dx := (b-a)/m; Dy := (d-c)/n;
# x & y coords of box bases.
xV := [seq(a+i*Dx,i=0..m-1)];
yV := [seq(c+j*Dy,j=0..n-1)];
# Set delta x according to mid, right or left hand rule
if EvalType[1] = Midpoint then
xS := Dx/2;
elif EvalType[1] = Right then
xS := Dx;
elif EvalType[1] = Left then
xS := 0;
else
RETURN(cat("Invalid evaluation type: ",EvalType[1]));
end if:
# Set delta y according to mid, right or left hand rule
if EvalType[2] = Midpoint then
yS := Dy/2;
elif EvalType[2] = Right then
yS := Dy;
elif EvalType[2] = Left then
yS := 0;
else
RETURN(cat("Invalid evaluation type: ",EvalType[2]));
end if:
# return an unevaluated Riemann sum
rSum := Sum(Sum(f(a+i*Dx+xS,c+j*Dy+yS)*Dx*Dy,i=0..nops(xV)-1),j=0..nops(yV)-1);
if OutputType = RiemannSum then RETURN(rSum); end if:
# compute the Riemann sum
approxVal := sum(sum(evalf(f(xV[i]+xS,yV[j]+yS)*Dx*Dy),i=1..nops(xV)),j=1..nops(yV));
if OutputType = Value then RETURN(approxVal); end if;
# compute the actual value
actualVal := evalf(int(int(f(x,y),x=a..b),y=c..d));
# create the plot title
pTitle := cat("Actual value = ",convert(actualVal,string),"\134n Approximate Value = ",convert(approxVal,string));
# create plots of the boxes
blocks := {seq(seq(cuboid([xV[i],yV[j],0],[xV[i]+Dx,yV[j]+Dy,f(xV[i]+xS,yV[j]+yS)],color=gray,transparency=T),
i=1..nops(xV)),j=1..nops(yV))}:
# create plots of the evaluation points
points := {seq(seq(point([xV[i]+xS,yV[j]+yS,f(xV[i]+xS,yV[j]+yS)],symbol=diamond,symbolsize=10,color=red,transparency=T),
i=1..nops(xV)),j=1..nops(yV))}:
# create a plot of the graph itself
graph := plot3d(f(x,y),x=a..b,y=c..d,color=blue,transparency=Tp):
display(blocks,graph,points,title=pTitle);
end proc:#1 Use the "doubleRiemann" function defined in the initialization above to approximate the double integrals defined below.(a) Approximate the volume under LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYrLUkjbWlHRiQ2JlEiZkYnLyUnaXRhbGljR1EldHJ1ZUYnLyUrZXhlY3V0YWJsZUdRJmZhbHNlRicvJSxtYXRodmFyaWFudEdRJ2l0YW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HJldGNoeUdGNC8lKnN5bW1ldHJpY0dGNC8lKGxhcmdlb3BHRjQvJS5tb3ZhYmxlbGltaXRzR0Y0LyUnYWNjZW50R0Y0LyUnbHNwYWNlR1EmMC4wZW1GJy8lJ3JzcGFjZUdGTi1GOTYuUSI9RidGMkY8Rj5GQEZCRkRGRkZIRkovRk1RLDAuMjc3Nzc3OGVtRicvRlBGVUY4LUkobWZlbmNlZEdGJDYnLUYjNictSSNtbkdGJDYlUSIwRidGMkY8LUY5Ni5RIixGJ0YyRjxGPi9GQUYxRkJGREZGRkhGSkZML0ZQUSwwLjMzMzMzMzNlbUYnLUZnbjYlUSIzRidGMkY8RjJGPEYyRjwvJSVvcGVuR1EiW0YnLyUmY2xvc2VHUSJdRictRjk2LlEoJnRpbWVzO0YnRjJGPEY+RkBGQkZERkZGSEZKL0ZNUSwwLjIyMjIyMjJlbUYnL0ZQRl1wLUZYNictRiM2Jy1GZ242JVEiMkYnRjJGPEZqbkZgb0YyRjxGMkY8RmNvRmZvRjJGPA== using "doubleRiemann", a grid of LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYnLUkjbW5HRiQ2JVEiM0YnLyUrZXhlY3V0YWJsZUdRJmZhbHNlRicvJSxtYXRodmFyaWFudEdRJ25vcm1hbEYnLUkjbW9HRiQ2LlEoJnRpbWVzO0YnRi9GMi8lJmZlbmNlR0YxLyUqc2VwYXJhdG9yR0YxLyUpc3RyZXRjaHlHRjEvJSpzeW1tZXRyaWNHRjEvJShsYXJnZW9wR0YxLyUubW92YWJsZWxpbWl0c0dGMS8lJ2FjY2VudEdGMS8lJ2xzcGFjZUdRLDAuMjIyMjIyMmVtRicvJSdyc3BhY2VHRkktRiw2JVEiN0YnRi9GMkYvRjI= rectangles and lower lefthand rule. Also, make the doubleRiemann command output a plot (using '.5' and '.65' as the final two options in your "doubleRiemann" command yields a pretty plot). Then, using "int" commands, try to calculate the exact answer (Maple will kick back an unevaluated single integral). Use "evalf" to check that this matches the "actual value" shown in the doubleRiemann command.f := (x,y) -> ???:
'f(x,y)' = f(x,y);doubleRiemann(f,???);(b) Using the same function and rectangle as in part (a), find the smallest square grid (minimum LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYlLUkjbWlHRiQ2JlEia0YnLyUnaXRhbGljR1EldHJ1ZUYnLyUrZXhlY3V0YWJsZUdRJmZhbHNlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnRjIvRjZRJ25vcm1hbEYn of LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYnLUkjbWlHRiQ2JlEia0YnLyUnaXRhbGljR1EldHJ1ZUYnLyUrZXhlY3V0YWJsZUdRJmZhbHNlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnLUkjbW9HRiQ2LlEoJnRpbWVzO0YnRjIvRjZRJ25vcm1hbEYnLyUmZmVuY2VHRjQvJSpzZXBhcmF0b3JHRjQvJSlzdHJldGNoeUdGNC8lKnN5bW1ldHJpY0dGNC8lKGxhcmdlb3BHRjQvJS5tb3ZhYmxlbGltaXRzR0Y0LyUnYWNjZW50R0Y0LyUnbHNwYWNlR1EsMC4yMjIyMjIyZW1GJy8lJ3JzcGFjZUdGTkYrRjJGPA== rectangles) such that the double Riemann sum with midpoint rule gives an approximation matching the actual integral if both are rounded to 3 decimal places. [Hint: Increase LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYlLUkjbWlHRiQ2JlEia0YnLyUnaXRhbGljR1EldHJ1ZUYnLyUrZXhlY3V0YWJsZUdRJmZhbHNlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnRjIvRjZRJ25vcm1hbEYn by 5's. Try LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYnLUkjbW5HRiQ2JVEiNUYnLyUrZXhlY3V0YWJsZUdRJmZhbHNlRicvJSxtYXRodmFyaWFudEdRJ25vcm1hbEYnLUkjbW9HRiQ2LlEoJnRpbWVzO0YnRi9GMi8lJmZlbmNlR0YxLyUqc2VwYXJhdG9yR0YxLyUpc3RyZXRjaHlHRjEvJSpzeW1tZXRyaWNHRjEvJShsYXJnZW9wR0YxLyUubW92YWJsZWxpbWl0c0dGMS8lJ2FjY2VudEdGMS8lJ2xzcGFjZUdRLDAuMjIyMjIyMmVtRicvJSdyc3BhY2VHRklGK0YvRjI= then LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYnLUkjbW5HRiQ2JVEjMTBGJy8lK2V4ZWN1dGFibGVHUSZmYWxzZUYnLyUsbWF0aHZhcmlhbnRHUSdub3JtYWxGJy1JI21vR0YkNi5RKCZ0aW1lcztGJ0YvRjIvJSZmZW5jZUdGMS8lKnNlcGFyYXRvckdGMS8lKXN0cmV0Y2h5R0YxLyUqc3ltbWV0cmljR0YxLyUobGFyZ2VvcEdGMS8lLm1vdmFibGVsaW1pdHNHRjEvJSdhY2NlbnRHRjEvJSdsc3BhY2VHUSwwLjIyMjIyMjJlbUYnLyUncnNwYWNlR0ZJRitGL0Yy etc.] Use the doubleRiemann command to display this approximation as well as the corresponding double summation (unevaluated). [Use the option "RiemannSum" instead of "Value" or "Plot".]Does the lower lefthand rule with a grid of LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYnLUkjbW5HRiQ2JVEkMjUwRicvJStleGVjdXRhYmxlR1EmZmFsc2VGJy8lLG1hdGh2YXJpYW50R1Enbm9ybWFsRictSSNtb0dGJDYuUSgmdGltZXM7RidGL0YyLyUmZmVuY2VHRjEvJSpzZXBhcmF0b3JHRjEvJSlzdHJldGNoeUdGMS8lKnN5bW1ldHJpY0dGMS8lKGxhcmdlb3BHRjEvJS5tb3ZhYmxlbGltaXRzR0YxLyUnYWNjZW50R0YxLyUnbHNwYWNlR1EsMC4yMjIyMjIyZW1GJy8lJ3JzcGFjZUdGSUYrRi9GMg== rectangles get this close? ANSWER: It takes a grid of ??? x ??? rectangles to get the midpoint approximation to be that accurate. Lower lefthand rule and a grid of LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYnLUkjbW5HRiQ2JVEkMjUwRicvJStleGVjdXRhYmxlR1EmZmFsc2VGJy8lLG1hdGh2YXJpYW50R1Enbm9ybWFsRictSSNtb0dGJDYuUSgmdGltZXM7RidGL0YyLyUmZmVuY2VHRjEvJSpzZXBhcmF0b3JHRjEvJSlzdHJldGNoeUdGMS8lKnN5bW1ldHJpY0dGMS8lKGxhcmdlb3BHRjEvJS5tb3ZhYmxlbGltaXRzR0YxLyUnYWNjZW50R0YxLyUnbHNwYWNlR1EsMC4yMjIyMjIyZW1GJy8lJ3JzcGFjZUdGSUYrRi9GMg== rectangles ??? DOES or DOES NOT ??? match the actual value when rounded to 3 decimal places.#2 Consider the region LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYlLUkjbWlHRiQ2JlEiRUYnLyUnaXRhbGljR1EldHJ1ZUYnLyUrZXhlY3V0YWJsZUdRJmZhbHNlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnRjIvRjZRJ25vcm1hbEYn bounded below by LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYnLUkjbWlHRiQ2JlEiekYnLyUnaXRhbGljR1EldHJ1ZUYnLyUrZXhlY3V0YWJsZUdRJmZhbHNlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnLUkjbW9HRiQ2LlEiP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lY3V0YWJsZUdRJmZhbHNlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnLUkjbW9HRiQ2LlEiPUYnRjIvRjZRJ25vcm1hbEYnLyUmZmVuY2VHRjQvJSpzZXBhcmF0b3JHRjQvJSlzdHJldGNoeUdGNC8lKnN5bW1ldHJpY0dGNC8lKGxhcmdlb3BHRjQvJS5tb3ZhYmxlbGltaXRzR0Y0LyUnYWNjZW50R0Y0LyUnbHNwYWNlR1EsMC4yNzc3Nzc4ZW1GJy8lJ3JzcGFjZUdGTi1JJm1mcmFjR0YkNigtSSNtbkdGJDYlUSIxRidGMkY8LUYjNiYtRlU2JVEiMkYnRjJGPEYvRjJGNS8lLmxpbmV0aGlja25lc3NHRlcvJStkZW5vbWFsaWduR1EnY2VudGVyRicvJSludW1hbGlnbkdGW28vJSliZXZlbGxlZEdGNC1GOTYuUSIuRidGMkY8Rj5GQEZCRkRGRkZIRkovRk1RJjAuMGVtRicvRlBGZG9GMkY8(a) Fix the bounds of the "plot3d" commands below so that only the surface of the region E is shown. bottom := plot3d(1,x=0..3,y=-3..3,color=green):
top := plot3d(5-x^2-y^2,x=0..2,y=-3..3,color=red):
back := plot3d([1/2,y,z],y=-3..3,z=0..6,color=yellow):
display({bottom,top,back},axes=normal,labels=[x,y,z],orientation=[-40,60,-170]);(b) Compute the volume of LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYlLUkjbWlHRiQ2JlEiRUYnLyUnaXRhbGljR1EldHJ1ZUYnLyUrZXhlY3V0YWJsZUdRJmZhbHNlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnRjIvRjZRJ25vcm1hbEYn using all six different orders of integration. [Of course, you should get the same answer each time.]int(int(int(1,z=???..???),y=???..???),x=???..???);int(int(int(1,z=???..???),x=???..???),y=???..???);int(int(int(1,y=???..???),z=???..???),x=???..???);int(int(int(1,y=???..???),x=???..???),z=???..???);int(int(int(1,x=???..???),z=???..???),y=???..???);int(int(int(1,x=???..???),y=???..???),z=???..???);(c) Find the centroid of LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYlLUkjbWlHRiQ2JlEiRUYnLyUnaXRhbGljR1EldHJ1ZUYnLyUrZXhlY3V0YWJsZUdRJmZhbHNlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnRjIvRjZRJ25vcm1hbEYn.m := ???;Myz := ???;Mxz := ???;Mxy := ???;Centroid := (1/m)*<Myz,Mxz,Mxy>;