Ryerson Crest Ryerson Header

MTH 207 Lab Lesson 20

Integration


Up to Main Lab Page Next Lesson - Numerical Integration Previous Lesson - Taylor Series

Integration

Maple has the ability to do symbolic integration using the int command. Maple can do either definite (with limits) or indefinite (symbolic) integration.

For definite integration with respect to the variable x the syntax is

int( < expression >, x = < range > )
For indefinite integration with respect to the variable x the syntax is
int( < expression >, x)
expression is the expression to be integrated.
x is the variable of integration.
range gives the limits of integration as a range. Thus "x = 1..2 " will find the integral from 1 to 2.

Note that the indefinite form does not include a constant of integration.
In some cases Maple will return a function which is unknown to you.

For example:
> int(x^2, x = 0..2);
> int(t^3, t = 0..2);
> int(x^2, x);

  1. Use Maple to find the following integrals with the given limits.
    1. x^5 + 3*x^4 - 14*x^2 + 15*x + 45, from 0 to 12134.
    2. x^2*exp(x), from 0 to 1.
    3. arcsin(x)/sqrt(1-x^2), from 0 to 1.
  2. Use Maple to find the following indefinite integrals. In each case do a plot of the function together with its integral.
    1. x^2*exp(x).
    2. sin(x)*exp(x).
    3. 1/(x-x^2).

Closed Form Solutions

An explicit function F (x) which is a solution to an integration, problem i.e. F (x) = int(f (x), x) is called a closed form solution. For example F (x) = x2 is a closed form solution to int(2 * x, x). Most of the theory section of this course is devoted to methods of finding closed form solutions to integrals.

However there are many integrals for which no closed form solution is known.
For example try
> int(exp(x^2)*(sin(x)), x);
If Maple cannot find a closed form solution it will return the original function call.

In some cases the integral is of particular interest. Often in this case we define a function which is the solution to this integral.

Consider the function f (x) = (1/sqrt(2*Pi)) * exp(-(t^2)/2). This function represents the normal distribution with mean 0, standard deviation 1.
> plot((1/sqrt(2*Pi)) * exp(-(t^2)/2), t = -3 .. 3);

The area under the curve from a to b represents the proportion of the population which lies in the interval from a to b.
It would be useful to know the proportion of the population wich has score x or less on the distribution.
> F := x -> int((1/sqrt(2*Pi)) * exp(-(t^2)/2), t = -infinity .. x);
> F(0);
> F(1);
F(0) = ½ tells us that ½ the population lies blow the mean.
F(1) would give the proportion of the population which is below 1.

We also could ask what proprtion of the population lies within a standard deviation (1) of the mean (0).
> int((1/sqrt(2*Pi)) * exp(-(t^2)/2), t = -1..1);

Note how these both give the answer in terms of the function erf.
The problem is that no one knows a closed form solution for these kinds of integrals.
But this function is obviously very important in statistics, thus we define the error function, erf, to be
erf(x) := 2 * int( F(sqrt(2) * x), x)
An alternate definitioin is
erf(x) := int((2/sqrt(Pi)) * exp(-x^2), x);
Tus erf(x) is defined to be the solution to this integral.
> int((2/sqrt(Pi)) * exp(-x^2), x);

In our previous examples Maple returned the answer in terms of the error function. But we want to know a specific number. Lets try evalf.
> evalf(int((1/sqrt(2*Pi)) * exp(-(t^2)/2), t=-1..1));
Hey! It worked! We now know that in a normal ditribution 68.26894920% of the popultaion lie within a standard deviation of the mean.

The question is how did Maple figure this out? The answer is numerical integration. We can estimate the value of any (definite) integral by using numerical techniques.

  1. Find the proportion of a population modeled by a normal distribution with mean 0 and standard deviation 1 which lies within the following ranges.
    1. -20..20.
    2. less than 0.5.
    3. Within half a standard deviation of the mean.


Up to Main Lab Page Next Lesson - Numerical Integration Previous Lesson - Taylor Series Top of this Lesson


Maintained by: P. Danziger, March 1998