Math 162 Maple Labs
by Prof. Saleski
Math 162: Maple Labs

Quick review of Maple
To launch Maple 10 from the XP labs (339 and 342 DH) or from any I.S. lab select:
Programs ---> Loyola Software ---> Math and Computer Science ---> Maple10
Create a new worksheet by selecting: File ---> New ---> Worksheet Mode
Once Maple 10 has been started, computations may be executed immediately. Commands are typed to the right of the prompt; a semicolon is placed at the end of the command, and then it is evaluated by pressing ENTER. If a colon is placed at the end of a command, the resulting evaluation is not displayed.
To type comments, begin each line with the symbol #.
Lab 1 (Due: February 15, 2006) Submit your LAB I solutions to the Math 162 Blackboard Digital Dropbox by selecting Course Tools and then Digital Dropbox. (You may “Add” your assignment to the Dropbox where it will be saved, and later select “Send” when you are ready to submit your assignment for grading.) Your file name for each lab must include your last name, first name, and lab number (for example, DylanBobLab1).
To study Solids of Revolution, we will employ the Student[Calculus1] package provided by Maple.
> with(Student[Calculus1]):
Given the function:
. Sketch and find the volume of the solid that results from rotating about the y-axis the region bounded by this curve and the x-axis from x = 0 to x = 3. Run the following Maple commands:
> VolumeOfRevolution( exp(-x^2), x=0..3, axis = vertical, output = plot,
volumeoptions = [style = wireframe, color=blue], axes = boxed);
> VolumeOfRevolution(exp(-x^2), x=0..3, axis=vertical, output=integral);
> evalf(%);
Next, let us rotate the same region about the x-axis.
> VolumeOfRevolution( exp(-x^2), x=0..3, axis=horizontal, output=plot,
volumeoptions = [style = wireframe, color=blue], axes = boxed);
![]()
> VolumeOfRevolution(exp(-x^2), x=0..3, axis=horizontal,output=integral);
> evalf(%);
Next, suppose that we wish to rotate the region bounded by two curves y = f(x) and y = g(x) from x = a to x = b about an axis.
> VolumeOfRevolution( 4*x-x^2, x^2, x=0..2, axis=vertical,output=integral);
> evalf(%);
If we wish to rotate our region about the axis x = -3, then we make the following change:
> VolumeOfRevolution( 4*x-x^2, x^2, x=0..2, axis=vertical,distancefromaxis = -3, output=plot,volumeoptions = [style = wireframe, color=blue], axes = boxed);
Exercises:
1. Plot the sphere of radius 5 centered at the origin and compute its volume.
2. Plot a cone with base radius 8 and height 13 and compute its volume.
3. Given the function g(x) =
. Find the volume of the solid that results from rotating the curve about the x-axis between x = 0 and x = 4. Plot.
4. Rotate the curve y= - x ln x between x = 0 and x = 1 about the line y = 2 and find the volume of the resulting solid. Plot.
5. Rotate one arch of the curve y = sin2 x about the x-axis and find its volume. Plot.
6. Suppose that the curve y = 1/x2 is rotated about the x-axis from x = 1 to x = ¥. Is it possible to compute the volume of this solid of infinite length? Explain! Plot if possible.
Lab 2 (Due: March 1, 2006) (Problems chosen from Thomas’ Calculus.)
1. Let us define the sine-integral function as follows:
This function has important applications in optics.
(A) Plot the integrand (sin t)/t for t > 0. Is the Si function everywhere increasing or decreasing? Do you think that Si(x) ever achieves the value of 0 when x > 0? Check your answers by graphing Si(x) for 0 < x < 25.
(B) Do you believe that limit of Si(x) as x ® ∞ exists? Explain.
2. (A) Evaluate the integrals:
,
, and
. What pattern do you observe?
(B) Guess the result of
and check using Maple.
(C) Guess a general formula for
and check your conjecture using Maple.
3. (A) Evaluate the integrals:
,
, and
.
(B) What pattern emerges? Predict the formula for
and check using Maple.
(C) Guess a general formula for
(n>2) and check using Maple.
4. Let
.
(A) Is Maple able to evaluate In?
(B) Using Maple, evaluate I1, I2, I3, I5, I7.
(C) Evaluate In using the following trick: Substitute x = p/2 – u in the integral. Add the new and old integrals together, and noting that cos(p/2 – u) = sin u, sin(p/2 – u) = cos u, evaluate the sum. Now find In.
Now, let us resolve rational functions into partial fractions using Maple:
Example:
> f := 1/(x2-25)
> convert (f, parfrac, x);
> g:= (x4 – 19) / (x-1)3;
> convert (g, parfrac, x);
5. Using Maple, find the partial fraction decomposition of each of the following rational functions:
(A) f = x / (x3-x2-6x)
(B) g = (4x5+13x3+11)/[(x-1)(x-2)(x-3)(x-4)]
(C) h = (x8+1)/(x8-1)
In general, parfrac seeks to factor over the integers. If we wish to allow, for example, the square root of 2 to be part of our factorization, then we would use the command convert(f, parfrac, x, sqrt(2));
(D) Find the partial fraction decomposition of the following function allowing the cube root of 2 to appear in the factorization:
G = 1/(x3-2)
Lab 3 (Due: March 28, 2006) Improper Integrals
(A) Evaluating Improper Integrals.
We may evaluate improper integrals of either the first or second kind using Maple. For example:
> int(exp(-x^2), x = -infinity..infinity);
> int(1/x, x=1..infinity);
> assume(p>1): # The assume routine sets variable properties and relationships between variables.
> int(1/x^p, x = 1..infinity);
> assume(q>1):
> int ( 1/(x*(ln(x))^q) , x = exp(1)..infinity);
> # When we make assumptions about a variable, thereafter it prints with an appended tilde (~) to indicate that the variable carries assumptions.
> assume (q>1);
> int ( 1/(x*ln(x)*ln(ln(x))^q) , x = 9..infinity);
> int(tan(x), x=0..Pi/2);
> int(1/sqrt(1-x^2), x = 0..1);
> int(1/log(x), x = 2..infinity);
> int(1/sqrt(x), x = 0..1);
> int((x^2+x^7+ln(ln(x))^49) / (1 + 4*x^9 + exp(-x)), x = 5..infinity);
> evalf(%);
> int (sinh(x) / (x^3*exp(x)), x = 1..infinity);
> int(cos(x)^5, x = 0..infinity);
> int(sin(x) * exp(-x), x = 0..infinity); # What is the geometric significance of this answer? Sketch!
(B) Torricelli's Trumpet or Gabriel's Horn
Evangelista Torricelli (1608 - 1647), a student of Galileo, made a discovery that amazed him. Let's examine what occurred.
Let us rotate the curve y = 1/x from 1 to infinity about the x-axis, thus obtaining an infinite solid of revolution. Let us call this solid the "horn of Gabriel", after the messenger of God in the old and new testaments.
Exercises: (1) Using disks or shells, compute the volume of this solid. Is this volume finite or infinite?
(2) The formula for surface area of a solid of revolution obtained by rotating the curve y = f(x) about the x-axis from x = 1 to x = b, is given by:
Calculate the surface area of the horn of Gabriel. Is this surface area finite or infinite?
(3) Why was Torricelli amazed? Describe the paradox.
(C) The Gamma Function
Many important functions in applied mathematics and statistics are defined in terms of improper integrals. Perhaps the most famous of these is the gamma function, defined by:

This function is defined for x > 0.
Exercises: (4) Plot the graph of y = G(x) over the interval [0.5, 6]. (Let GammaFunction denote the improper integral above as an expression that depends upon t.)
(5) By calculating G(1), G(2), G(3), G(4), and G(5), guess a formula for G(n) when n is a positive integer.
(6) Calculate G(1/2), G(3/2) and G(5/2).
(7) Show that G(x+1) = xG(x) for all x > 0.
(8) Maple has a built-in function, GAMMA(x), that represents the gamma function given above. This makes it easier for us to invoke the gamma function. Stirling's formula states that

(Recall that two functions f and g are said to be asymptotic (and written f ~ g) if the limit of f(x)/g(x), as x tends toward infinity, equals 1.) Using the formula for G(n) that you obtained in part (B), verify Stirling's formula by graphing the quotient of the two functions.
(D) Normal Distribution
A function p(x) is said to be a probability density function (or pdf) if:
- p(x) is defined for all real x
- p(x) > 0 for all x
- the (improper) integral of p over the real line equals 1.
Exercises: Show that each of the following functions is a probability density function. Plot the graph of each pdf as well.
(9) p1(x) = (1/(3sqrt(2p)) exp(-(x-11)2/18) defined for all x.
(10) p2(x) = (1/sqrt(2p)) exp(-(x-15)2/2) defined for all x.
A pdf is often used to model a random event. For example, let us consider the following probabilistic model. Suppose that R is the amount of rainfall (in inches) in Alphaville during one year. (R is called a random variable.) Then the probability that a < R < b is given by the area under the pdf, p2, from x = a to x = b.
Exercises: (11) Find the probability that the amount of rainfall in Alphaville is more than 16 inches during a year.
(12) Find the probability that the amount of rainfall in Alphaville is less than 13 inches during a year.
(13) The mean value (or average value) of a random variable with pdf p(x) is given by the (improper) integral of xp(x) over the real line. Find the mean value of the random variable R defined above.
(14) The variance of a random variable with pdf p(x) is given by the (improper) integral of (x-m)2p(x) over the real line, where m denotes the mean value of the random variable. Find the variance of R.
(15) Suppose that the amount of snowfall, S, (in inches) during one year in Betaville is given by the pdf p1(x) defined above. Find the mean value and the variance of S.
Lab 4 (Due: May 3, 2006) Taylor Series
I Power Series.
(A) Radius and Interval of Convergence.
Suppose that we wish to find the radius of convergence or the interval of convergence of a power series

Normally, we use the ratio test or the root test. Consider the following examples:
Let an = 1/n! and let c = 0.
> t := n -> x^n /factorial(n);
> ratio := abs(t(n+1)/t(n));
> ratio := simplify(%);
> limit(ratio, n = infinity);
Note that since the limit is always 0, the interval of convergence is (-infinity, infinity).
Next, consider the example an = 1/n, c = 3.
> restart;
> t := n -> (x-3)^n / n;
> ratio := abs(t(n+1)/t(n));
> ratio:= simplify(%);
> ratioLimit := limit(ratio, n = infinity);
> ratioLimit := simplify();
> solve (ratioLimit <= 1, x);
Thus the radius of convergence is 1. To investigate endpoint behavior: If x = 4, then the series is harmonic and thus diverges. If x = 2, then the series is alternating and converges by Leibniz's rule. Thus the interval of convergence is [2, 4).
Next, consider the series

We will let

Again, we apply the ratio test:
> restart;
> t := n -> (-1)^n*x^(2*n+1) / 7^n;
> ratio := abs(t(n+1)/t(n));
> ratio := simplify(%);
> ratioLimit := limit(ratio, n = infinity);
> ratioLimit := simplify(%);
> solve (ratioLimit <= 1, x);
Thus the radius of convergence is sqrt(7). To investigate endpoint behavior, let x = sqrt(7).
> subs( x = sqrt(7), t(n));
> simplify(%);
Note that the atoms do not tend toward 0, and thus the series diverges. Similarly show that the series diverges when x = - sqrt(7).
Hence the interval of convergence is (-sqrt(7), sqrt(7)).
(B) Computing power series.
Recall that the power series expansion of a continuously differentiable function f(x) about x = c is given by the infinite series

To find the terms up to but not including the kth power of x-c, we use the command series(f(x), x=c, k). For example:
> series (sin(x), x = 0, 7);
> series (cos(x), x = Pi, 8);
> series (exp(x), x=1, 15);
> series(ln(x), x=1, 7);
> series (sinh(x), x=0, 14);
> series (arctan(x), x=0, 15);
(C) Taylor and Maclaurin polynomials.
Recall that the nth degree Taylor polynomial of a function at x = c, is given by:

If c = 0, then such a polynomial is called the nth degree Maclaurin polynomial of f.
We can use the convert command to obtain Taylor polynomials from the infinite power series of f. For example:
> # Let us obtain the 13th degree Taylor polynomial of sec x about x = p/4.
> seriesSec := series(sec(x), x=Pi/4, 14); # This gives us all terms up to and including the 13th.
> Taylor13 := convert(seriesSec, polynom);
> Digits := 3;
> evalf( Taylor13);
Let us compare the graph of a function with that of one of its Maclaurin polynomials:
> s1 := series(sin(x), x=0, 6);
> Mac5 := convert(s1, polynom);
> plot ({s1, Mac5}, x = -4..4);
Exercises:
1. Find the 8th degree Maclaurin polynomial of tanh(x).
2. Find the 7th degree Taylor polynomial of ex about x = 1.
3. Find the 9th degree Maclaurin polynomial of ln(1+x).
4. Plot the graph of y = ex along with the first three Maclaurin polynomials of ex on the same set of axes.
II Infinite products.
In mathematics, infinite products play an important role, although perhaps not quite as important as infinite series. Analogous to infinite series, an infinite product is the limit of a sequence of partial products. Capital pi is used to indicate a product. For example,

denotes the product: a(1)a(2)a(3)...a(n). If we wish to define an infinite product, we could let p(n) = a(1)a(2)a(3)...a(n) and define the infinite product to equal the limit of p(n) as n increases without bound, if the limit exists. Of course, if the limit does not exist, we say that the infinite product diverges. Let us examine a few examples.
> restart;
> a := n -> 1-exp(-n);
> p := n -> product(a(k), k=1..n);
> product(a(n), n=1..infinity);
> evalf(%);
> plot (p(n), n = 4..50);
> restart;
> a := n -> 3^(n/3^n);
> p := n -> product(a(k), k=1..n);
> product(a(n), n=1..infinity);
> evalf(%);
> plot (p(n), n = 1..25);
> restart;
> a := n -> 1-1/exp(exp(n));
> p := n -> product(a(k), k=1..n);
> product(a(n), n=1..infinity);
> evalf(%);
> plot (p(n), n = 4..50);
Exercise: 5. Examine the infinite products defined by a(n) = 1 + 1/n and b(n) = 1 + 1/n2. Graph each sequence of partial products. Does either infinite product converge? If so, what is its limit?
I see men as trees, walking.
- St. Mark, 8:24
A fool sees not the same tree that a wise man sees.
- William Blake
All theory, dear friend, is gray, but the golden tree of actual life springs ever green.
- Johann Wolfgang Von Goethe


