Early Integration.

At least as many problems can be solved using integration as can be solved using differentiation, so we need to find out about it too.

Integration involves adding up, which Maple does with sum .

Learning to use the Maple words Sum and sum .

Sum is the passive form of sum, so you can set up an equation displaying and computing the sum of the first 100 positive integers.

> Sum(i, i=1..100)=sum(i, i=1..100);

[Maple Math]

>

Suppose we wanted to compute the sum of the arithmetic sequence

4 + 7 + 10 + 13 + .... + 301

First thing we need to figure out is the number of terms in this sum. Well, the common difference is 3 and the last term can be written as [Maple Math] where

> i = (301-4)/3;

[Maple Math]

So, there are 100 terms and we can sum this as

> Sum(4+i*3,i=0..99)=sum(4+i*3,i=0..99);

[Maple Math]

Exercise: Find the sum of the square roots of i, as i goes from 1 to 10.

If we proceed as before,

> Sum(sqrt(i),i=1..10)=sum(sqrt(i),i=1..10);

[Maple Math]

the sum is not computed. Use evalf to convert it to a decimal.

> Sum(sqrt(i),i=1..10)=evalf(sum(sqrt(i),i=1..10));

[Maple Math]

Exercise: Calculate the value of the following sum for n taking values 4, 8, 12 and n. What is the limiting value of the sum as n gets large?

> seq(Sum((1/2)^i,i=0..4*j)=sum((1/2)^i,i=0..4*j),j=1..3);

[Maple Math]

>

> Sum((1/2)^i,i=0..n)=sum((1/2)^i,i=0..n);

[Maple Math]

>

>

As n gets large, [Maple Math] goes to 0, so the whole sum goes to 2.

> Sum((1/2)^i,i=0..infinity) =limit(Sum((1/2)^i,i=0..n),n=infinity);

[Maple Math]

>

Riemann Sums with the student package

There are some useful words in the student package dealing with integration.

> with(student);

[Maple Math]
[Maple Math]
[Maple Math]
[Maple Math]

For example, middlesum and middlebox compute and display a regular Riemann sum where the mark is chosen as the midpoint in each subinterval. For example, to get the middle regular Riemann sum for x^2 from 0 to 1 with 10 subintervals,

> middlesum(x^2,x=0..1,10) = value(middlesum(x^2,x=0..1,10));

[Maple Math]

> middlebox(x^2,x=0..1,10);

[Maple Plot]

>

Two Area Problems

Exercise: Plot the ellipse [Maple Math] with a parametric plot. Estimate the area of the ellipse. Use the fact that it is four times the area under the graph of [Maple Math] for x between 0 and 2.

Solution:

A parameterization of the ellipse is to let [Maple Math] , as t goes from 0 to [Maple Math] .

> ellipse := [2*cos(t),sin(t),t=0..2*Pi];

[Maple Math]

> plot(ellipse,scaling=CONSTRAINED);

[Maple Plot]

The upper ellipse is the graph of the function

> f := x -> sqrt(1- x^2/4);

[Maple Math]

>

We can use leftsum and rightsum to estimate the area.

> for i from 1 to 5 do
left := 4*evalf(value(leftsum(f(x),x=0..2,25*i)));
right := 4*evalf(value(rightsum(f(x),x=0..2,25*i)));
print(left,right,right-left); od:

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

By inspecting the table of numbers, we see that area is between 6.24 and 6.31.

>

Exercise: For the function [Maple Math] , plot the function and determine the region R where the graph of f lies above the x-axis. Make the sketch of R and compute the endpoints of the base of R. Use student[middlesum] to find the area of the region R to within 0.1.

Solution:

First plot the function and calculate the endpoints of R.

> y := 10 - x^4 + 10*x;

[Maple Math]

> plot(y,x=-2..3);

[Maple Plot]

> sol := fsolve(y,x);

[Maple Math]

> for i from 1 to 5 do
value(student[middlesum](y,x=sol[1]..sol[2],20*i))
od;

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

[Maple Math]

The area looks to be 41.7 to the nearest 0.1, using middlesum with 100 subdivisions.

Learning to use Int and int.

The fundamental theorem of calculus tells us that a definite integral of a continuous function f can be evaluated by first finding an antiderivative of f and then calculating the difference of its values at the endpoints: In symbols,

[Maple Math] provided [Maple Math] .

You can use the Maple word int to find antiderivatives, (aka indefinite integrals).

For example, to find an antiderivative of [Maple Math] , use int.

> Int(x^2 + cos(x/5),x)=int(x^2 + cos(x/5),x);

[Maple Math]

Notice that there is a passive form of int, Int , for typesetting purposes.

You can also use int to evaluate definite integrals. For example, if we want to plot the region under the graph of [Maple Math] for x between 0 and 2 and calculate its area.

> restart;

> f := x-> x^2 + cos(x/5);

[Maple Math]

> Int(f(x),x=0..2)=int(f(x),x=0..2);

[Maple Math]

> area := evalf(int(f(x),x=0..2));

[Maple Math]

>

We will use plots[polygonplot] to shade the region.

> ### WARNING: semantics of type `string` have changed
plots[polygonplot]( [ [2,0],[0,0],[0,f(0)],seq([x/10,f(x/10)] , x=0..20) ],color=gray,title= cat(`Area = `,convert(area,string)) );

[Maple Plot]

>

Exercises:

Exercise: For each of the functions below, Sketch the region under the graph and calculate the area of the region using the fundamental theorem of calculus.

a) [Maple Math] , for [Maple Math]

>

>

b) Under the arch of [Maple Math] which contains x=0. .

>

>

c) f(x) = piecewise( x<1, sqrt(x) ,x>=1,x^2); for x between 0 and 2.

[Maple Math]

>

>

Average value.

Modeling the flow of air in lungs:

The rate of change of the volume of air in the lungs can be modeled very roughly (according to some texts) by the function

> f := t -> 1/2*sin(2*Pi*t/5);

[Maple Math]

>

>

where volume is measured in liters and time is measured in seconds. So the actual volume of air in the lungs would obtained by integrating f. Here we are assuming there is no air in the lungs at time 0.

> Int(f(tau),tau=0..t) = int(f(tau),tau=0..t);

[Maple Math]

> F := unapply(int(f(tau),tau=0..t),t);

[Maple Math]

Let's plot the rate of airflow and the volume function to get a feel for their behavior.

> plot({f,F},0..10);


[Maple Plot]

>

Questions.

Question: Which is the rate of airflow function and which is its integral?

Question: What is the maximum volume of air in the lungs in this model? The minimum volume?

Question: When are the lungs half-full?

Question: What is the average rate of airflow in the lungs over the time interval [0,2.5]? [2.5,5]? [0,5]?

> ar := evalf(int(f(t),t=0..2.5)/2.5);

[Maple Math]

>

About .32 liters per second on average.

Question: What is the average volume of air in the lungs over the time interval [0,2.5]? [0,5]?

> av := evalf(int(F(t),t=0..2.5)/2.5);

[Maple Math]

>

About .4 liter air in the lungs on average.

Actually, there are different, perhaps more realistic models of the rate of airflow into the lungs. For example, consider this one,

> g := t -> (3/8-1/4*cos(4*Pi*t/5))*sin(2*Pi*t/5);

[Maple Math]

>

Problem: Using the function g to model the rate of airflow in the lungs, find the volume G of air in the lungs at time t. (Assume as before that G(0) = 0.) Plot both g and G over the time interval [0,10]. Describe qualitatively a difference that you note between this model and the model we looked at above. Calculate the maximum rate of airflow in this model. What is the maximum volume of air in the lungs in this model? What is the average volume of air in the tank in the time interval [0,5]

Two Area problems.

Table of Contents