S ome Simple Maple Commands
The command
with(student):
must be on the first line.
The commands "
leftbox
,
middlebox
,
rightbox
draw pictures of the left , middle, and right Riemann Sums.
The arguments to these commands are the function, the left and right endpoints (written in Maple
as "x = -2 .. 2" has the meaning "x goes from -2 to 2". The last integer 4 is the number of rectangles to use.
The commands
leftsum, middlesum, rightsum
give the left, middle an right Reimann Sums in "Sigma"
notation.
The command
evalf(")
, gives the "numerical" answer to the commands above.
>
with(student):
Sec 5.1, Problem 4, Page 360
a) Graph the function f(x) = e^(-x^2), -2 <= x <= 2
b) Estimate the area under the graph of f using 4 approximating rectangles and taking the sample points to be
(i) right endpoint (ii) midpoints. In each case sketch the curves and the rectangles
c) Improve your estimates in part (b) by using 8 rectangles
>
leftbox(exp(-x^2), x=-2..2, 4);
leftsum(exp(-x^2), x=-2..2, 4);
evalf(");
>
middlebox(exp(-x^2), x=-2..2, 4);
middlesum(exp(-x^2), x=-2..2, 4);
evalf(");
>
rightbox(exp(-x^2), x=-2..2, 4);
rightsum(exp(-x^2), x=-2..2, 4);
evalf(");
Here Are the Solutions for 8 rectangles for the Left, Middle, and Right Riemann Sums. Given all at once.
>
leftbox(exp(-x^2), x=-2..2, 8);
leftsum(exp(-x^2), x=-2..2, 8);
evalf(");
middlebox(exp(-x^2), x=-2..2, 8);
middlesum(exp(-x^2), x=-2..2, 8);
evalf(");
rightbox(exp(-x^2), x=-2..2, 8);
rightsum(exp(-x^2), x=-2..2, 8);
evalf(");
We can draw and compute Reimann Sums for any number of boxes. Here we use n = 50.
>
leftbox(exp(-x^2), x=-2..2, 50);
leftsum(exp(-x^2), x=-2..2, 50);
evalf(");
Sec 5.1, Problem 6, Page 360
>
leftbox(1/(x^2), x= 1 .. 2, 10);
leftsum(1/(x^2), x= 1 .. 2, 10);
evalf(");
>
leftbox(1/(x^2), x= 1 .. 2, 30);
leftsum(1/(x^2), x= 1 .. 2, 30);
evalf(");
>
leftbox(1/(x^2), x= 1 .. 2, 50);
leftsum(1/(x^2), x= 1 .. 2, 50);
evalf(");
The Computer Has No Problem Computing the Left Riemann Sum for n = ten thousand (10,000).
>
leftsum(1/(x^2), x= 1 .. 2, 10000);
evalf(");