Docsity

Approximating Integrals with Riemann Sums using Maple's student library, Study notes of Mathematics

Toggle sidebar
bg1
Illustrating sums that approximate integrals
(leftbox, leftsum, value, rightbox, rightsum)
In Maple's " student" library, there are several commands that can be used to illustrate
the computation of integrals via Riemann sums. To use these commands, you must first
enter the command:
> restart:
> with(student):
The colon at the end of the line surpresses the output (if you use a semicolon, you will get
a list of all of the commands available in the student library).
We demonstrate the use of the commands by working through the following example: Use
Riemann sums to compute:
> Int(1/t,t=1..2);
ó
ô
ô
ô
õ
1
2
1
t dt
Recall that the " Int" command with a capital I is used to get Maple just to type integrals.
It does not evaluate them -- the " int" command with a small i does that. But the form of
the two int (for integral) commands is the usual verb(what,how); form of many Maple
commands. Before the comma, you enter the (name of the) expression to be integrated
("Integrate what?") and after the comma you give the name of the variable and the range of
integration ("Integrate it how?").
We will illustrate only the left-hand sums. Maple has three relevant commands: " leftbox
", which draws pictures, " leftsum", which gives summation notation for the area under
the left boxes, and "value", which computes the sums (evalf can also be used). So, as we
approximate the above integral using 10 rectangles which touch the curve on the left, we
can have Maple illustrate the boxes by typing:
98
pf3

Partial preview of the text

Download Approximating Integrals with Riemann Sums using Maple's student library and more Study notes Mathematics in PDF only on Docsity!

Illustrating sums that approximate integrals

(leftbox, leftsum, value, rightbox, rightsum)

In Maple's " student" library, there are several commands that can be used to illustrate

the computation of integrals via Riemann sums. To use these commands, you must first

enter the command:

> restart:

> with(student):

The colon at the end of the line surpresses the output (if you use a semicolon, you will get

a list of all of the commands available in the student library).

We demonstrate the use of the commands by working through the following example: Use

Riemann sums to compute:

> Int(1/t,t=1..2);

ó

ô

ô

ô

õ

1

2

t

dt

Recall that the " Int" command with a capital I is used to get Maple just to type integrals.

It does not evaluate them -- the " int" command with a small i does that. But the form of

the two int (for integral) commands is the usual verb(what,how); form of many Maple

commands. Before the comma, you enter the (name of the) expression to be integrated

("Integrate what?") and after the comma you give the name of the variable and the range of

integration ("Integrate it how?").

We will illustrate only the left-hand sums. Maple has three relevant commands: " leftbox

", which draws pictures, " leftsum", which gives summation notation for the area under

the left boxes, and "value", which computes the sums (evalf can also be used). So, as we

approximate the above integral using 10 rectangles which touch the curve on the left, we

can have Maple illustrate the boxes by typing:

> leftbox(1/t,t=1..2,10);

1 1.2 1.4 1.6 1.

1

t

2

0

The syntax of leftbox matches that of int, except it has a third argument which

specifies the number of boxes to be used to approximate the integral.

Notice that in this case, the sum of the areas of the boxes gives an overestimate of the area

under the curve because the curve is concave up.

To calculate the sum of the areas of the boxes, use the command

> leftsum(1/t,t=1..2,10);

S

i = 0

9

i

In this expression, Maple has numbered the ten boxes from 0 to 9, and the area of the ith

box is equal to 1/10*(1/(1+i/10)). Notice that 1/10 is

D

t and the other factor is the

value of the function 1/t at the left side of the box. To calculate the sum, we can ask Maple

for: