Math 161 Maple Labs
by Prof. Saleski
MAPLE LABS: MATH 161
>
>
Lab I (Getting Started)
Lab II (Tangent Lines)
Lab III (Derivatives)
Lab IV (Continuity vs Differentiability; implicitly defined functions)
Lab V (Implicit Differentiation)
Lab VI (Search for extrema)
Lab VII (Mean Value Theorem)
Lab VIII (Anti-derivatives)
Lab IX (Definite integrals and Area)
Without laboratories men of science are soldiers without arms.
- Louis Pasteur (1822-95)

Introduction to Maple
To launch Maple 11 from the XP labs (339 and 342 DH) or from any I.T.S. lab select:
START --- > All Programs ---> Maple 11 ---> Maple11
(If Maple is not already installed on the machine, then choose: START --- > Loyola Software --- > Math and Computer Science --- > Maple11)
Create a new worksheet by selecting: File ---> New ---> Worksheet Mode
Once Maple 11 has been started, computations may be executed immediately. Commands are typed to the right of the prompt; a semicolon is usually placed at the end of the command, and then the command 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: September 19, 2007): Answer each of the following questions using Maple as a tool.
Submit a hardcopy of your LAB I solutions on September 19. While your work is in progress, you may save copies by going to the Blackboard Digital Dropbox: Select Course Tools, then Digital Dropbox, where you “submit” the file that you wish to be saved. When you reopen a Maple file, make sure that the file suffix is mws (for Maple Work Sheet).
Exploring basic commands of Maple: Type in each of the following commands. Try to predict the output.
> 13 + 44;
> 2/3 + 3/5 ;
> 12345*67890;
> % + 13;
> # What role does % play here?
> 2* %;
> # What role does % play here?
> evalf( 1/3 + 1 /4);
> evalf( exp(1) );
> # Explain the difference between exp(1) and evalf(exp(1)).
> evalf (Pi*15); # What happens if you were to type pi in place of Pi?
> sin(Pi/6);
> tan(Pi/6);
> evalf(%); # What is the role of evalf ?
> 3*4^(1/2) + 5;
> simplify(%); # How does simplify differ from evalf ?
> p := x^2 + 5*x + 6;
> factor(p);
> factor (x^6 - 64);
> factor(x^2 - 10*x*y + 21*y^2);
> ifactor(123456);
> arcsin(1/2); # Is the answer in degrees or in radians?
> arcsec(13);
> evalf(%);
> gcd(45, 933); # What is the meaning of gcd ?
> lcm(18,34); # What is the meaning of lcm?
> convert(72*degrees, radians);
> convert(Pi/12, degrees); # What is the role of convert ?
> solve (x^2 - 10*x + 21 = 0);
> solve (sin(x) = cos(x));
> solve (x^6 = 2); # How many of these solutions are real numbers?
> evalf(%);
> expand((x+y+z)^3);
> with(plots): # This command invokes the plot library. See what happens if you omit the colon at the end of the line?
> plot ( x * sin(1/x) , x = -0.4 .. 0.4 );
> plot ( x * exp (-x) , x = -1 .. 5 );
> # To display the graphs of two or more functions, we use braces to signal the beginning and end of our list of functions.
> plot ( {x^2 - x, 6 - x^2}, x = -5 .. 5 );
> plot ({sin(Pi*x), cos(2*Pi*x), 0.15*x}, x = 0..2*Pi);
# What happens if you specify the y-range of the graph as well? For example:
> plot (x^3, x=0..5, y=0..4); # Experiment with other graphs of your choice.
Practice Exercises (notto be submitted):
(A) Solve the equation x4 – 20x3 + 130x2 - 300x + 189 = 0.
(B) Sketch the graph of the function y = x cos x over the interval [0, 10].
(C) Sketch the pair of functions y = ln(x) and y = x1/2 on the same pair of axes over the interval (0,25].
(D) Determine where the two parabolas y = x2 - 3x - 4 and y = 1 - 3x2 intersect. (Determine each coordinate to the nearest hundredth.)
Plot their graphs on the same set of axes.
Exercises (to be submitted):
(1) In finding the slope of the tangent line to y = x5 at P = (2, 32), we need to expand (2+h)5, subtract 32, and then divide by h. Perform these operations using Maple. Then determine the slope by “guessing” what happens as h ® 0 (this last step without using Maple).
(2) Plot the graph of the polynomial y = x(x-4)(x-6)(x-9). (Hint: Let x vary from -1 to 11). When is this polynomial positive? What is its limiting behavior as x goes to infinity?
(3) Sketch the graph of y = sech(x). Does this function appear to be even or odd? What is its limiting behavior?
(4) Plot the graph of the rational function
letting x vary from -15 to 15 and y vary from -7 to 25 and setting discont = true in the plot command. What happens if you remove discont = true? What happens if you remove the y range?
(5) Sketch the graph of the entropy function h(x) = - x ln x, where 0 < x < 1. Can you determine approximately where (i.e., for which x value) this function achieves a maximum value?
(6) Plot the graph of the rational function
letting x vary from -2 to 8 and y vary from -20 to 20 and setting discont = true in the plot command. What is the apparent limiting behavior as x® ¥ ?
(7) Find (a) the zeroes, and (b) the singularities of the function ![]()
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
Graphing Tangent Lines

Lab 2 (Due: Wednesday, 26 September 2007):
Let us suppose that we wish to graph the function y = sin x and its tangent line at x = p/4 on the same set of axes. Consider the following sequence of Maple commands. Type this into a Maple worksheet and observe what happens.
> f := x -> sin(x); # This defines the function f.
> m := limit( (f(Pi/4 + h) – f(Pi/4)) / h, h = 0); # Limit of Newtonian difference quotient.
> tangentLine := x -> m*( x – Pi/4) + f(Pi/4); # Follows from point-slope form of straight line.
> plot( {f(x), tangentLine(x) }, x = 0..Pi); # Here we plot two graphs on the same pair of axes.
Notice that we have represented f and tangentLine as functions in Maple. (Maple distinguishes between “expressions” and “functions.” If f were represented as an expression, then f(a) would make no sense in Maple.)
I For each of the following functions find the equation of the tangent line at the given point and graph both the original function and its tangent line on the same set of axes. Use only the Newtonian difference quotient to compute the slope of the tangent line; do not use the more convenient rules of differentiation. (In at least one exercise, Maple may fail to deliver the appropriate limit. If this happens, then compute the difference quotient for small non-zero values of h (for example, h = 0.1, 0.01, 0.001, etc.)
(A) y = sinh(x), x = ln 3
(B) y = (x2 + 3)2(x-3), x = 0.55
(C) y = 3sin(4x) – 4cos(7x), x = p/8
(D) y = x2 sin(4/x), x = 1
II Using Maple, evaluate each of the following limits, if it exists. At times you may need to use evalf(%) to approximate numerically the value of your limit.
(A) 
(B) ![]()
(C) ![]()
(D) 
(E)
(Note: In Maple, we may express |x| as abs(x).)
III A grapefruit is dropped from the top of a 100 meter tower. Its height above ground after t seconds is 100 - 4.9t2 meters.
(A) Find the average velocity of the grapefruit during the first 2 seconds of its fall. (Use proper units and appropriate sign.)
(B) How fast is the grapefruit falling 2 seconds after it is dropped? (Here you are asked for the instantaneous velocity of the grapefruit. Use the Newtonian difference quotient and then take a limit.)
IV A normal line to a curve y = f(x) at the point P = (a, f(a)) is defined to be a straight line that passes through P and is perpendicular to the tangent line to y = f(x) at P. For each of the following two exercises, find the equation of the normal line to the given curve at the given point and graph all three functions (the original curve, the tangent line and the normal line on the same pair of axes).
(A) y = ln(x+4), x = -1
(B) y = (sin x)4, x = p/6
Note that perpendicular lines appear to be perpendicular only if one unit on the x-axis equals one unit on the y-axis. To create such a graph, use the scaling = constrained option inside the plot command. Also, colors can be specified inside the plot command. For example:
> plot({sin(x), cos(x)}, x = 0..5, scaling = constrained, color = [red, blue]);

Computing Derivatives

Lab 3 (Due: Wednesday, October 3, 2007): In this lab we study the Maple differentiation operators for expressions and for functions. Since Maple treats functions and expressions differently, we must learn to carefully distinguish between the two.

Let f(x) = sin 2x. Suppose that we wish to graph f and df/dx on the same pair of axes. First, let us define an appropriate Maple expression.
> f := sin(2px); # this is an expression in Maple
> fDerivative := diff(f, x);
> plot( {f, fDerivative}, x = 0..2, y = -3..3); # specifying the y range is optional
Next, let us define an appropriate Maple function.
> restart:
> g := x → sin(sin(2px); # this is a function in Maple
> gDerivative := D(g);
> plot( {g(x), gDerivative(x)}, x = 0..2, y = -3..3);
Spend a few minutes observing the differences in syntax between these two sets of commands.
For each of the following functions, graph the function and its derivative on the same pair of axes. In PART A, use functions only. In PART B, use expressions only. Choose the domain carefully so that we can easily distinguish between f and its derivative. (You may need to experiment before finding an appropriate domain.)
PART A (Functions only):
(1) y = sinh x
(2) y = - x ln x
(3) y = tan x
(4) y = x4 – x2 + 4x – 1
5) y = 3x + sin 4x
PART B (Expressions only):
(1) y = exp(-x2)
(2) y = x sin x
(3) y = 5/(1+4(3)-x)
(4) y = x ex
Oftentimes we will need to solve equations using Maple. Consider the following example: Determine when the tangent line to the function y = x + 4 sin x is horizontal. Let us explore the following solution:
> restart:
> h := x → x + 4sin(x);
> eqn := D(h) = 0;
> pointOfHorizontalTangent := fsolve(eqn);
Let us plot the graph of y = h(x).
> plot(h(x), x = 0..50);
Notice that there are many points (actually infinitely many) at which the tangent line is horizontal, yet Maple has captured only one (which happens to be the smallest non-negative x that satisfies the equation). Since the graph suggests that there is a root between x = 3 and x = 10, we can capture this root as follows:
> pointOfHorizontalTangent2 := solve(eqn, x = 3..10);
See if you can capture several additional points at which h has a horizontal tangent.
PART C. For each of the following functions find one or more points at which the tangent line is horizontal. Graph the function to make sure that your answers make sense.
(1) y = - x ln x
(2) y = (x-2)(x-3)2(x-4)4
(3) y = x sin x
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

Lab 4 (Due: Friday, October 12, 2007): In this lab we will explore a bit of theory, and also learn how to plot curves that are defined implicitly.
PART A(This exercise is due to G. Thomas.) Karl Weierstrass’ example of a continuous function that is nowhere differentiable is given by an infinite series

Infinite series will be explored in Math 162. However, we can learn a great deal about an infinite series by examining its first few terms. In the case of the famous Weierstrass example, let
![]()
(A1) By plotting f for a suitable domain (or several different domains), observe how the graph of f is “wiggly” and “bumpy.”
(A2) Next, graph the derivative of f on another set of axes. Make a couple of observations.
PART B (Also drawn from our text) By graphing each of the following functions, determine if it appears to have a continuous extension to x = 0. If so, determine (by observation) a good candidate for the extended function’s value at x = 0. If the function does not appear to have a continuous extension, can it be extended to be continuous at x = 0 from the right or from the left? If so, what do you think the extended function’s value(s) should be?
(B1) ![]()
(B2)
(Note: In Maple, absolute value of x is represented by abs(x).)
(B3) ![]()
(B4) ![]()
PART C
(C1) (This question uses no Maple.) Let f(x) = 3x + sin(4px) and g(x) = cos(3px) + 8 – x2. We wish to argue that the graphs of f and g intersect somewhere between x = 0 and x = 3. Toward this end, let h(x) = f(x) – g(x). Using the Intermediate Value Theorem, explain why f and g must intersect when x = c for some number c between 0 and 3.
(C2) Using Maple, estimate the value of such a number c. (Actually there are three roots of h on the interval [0,3].)
PART D Oftentimes we wish to graph a function that is implicitly defined. For example, the circle at center (1,2) and radius 4 is given by the equation (x-1)2 + (y-2)2 = 16. (If one solves for y in terms of x, then one must choose between the upper semi-circle or the lower semi-circle. This is not a choice that one may wish to make.) To graph the given circle using Maple, consider:
> ![]()
>
>
> ![]()
>

>

(D1) Plot the parabola y2 – x = 0.
(D2) Plot the folium of Descartes: x3 + y3 = 9xy.
(D3) Plot the curve: y2 = x2 + sin xy.
Soon we will learn how to compute the derivative of a function that is implicitly defined. In particular, we will be able to show that, at the point (2,4), the folium of Descartes has as its tangent line, 5y = 4x + 12, and as its normal line, 4y = 26 – 5x.
(D4) Plot on the same set of axes the folium of Descartes together with its tangent and normal lines at the point (2,4).
(D5) Plot the curve |x| + |y| = 1, without using the grid option. Next, use the grid option grid = [300, 300] and notice the difference.
I'm very well acquainted, too, with matters mathematicalI understand equations, both the simple and quadraticalAbout binomial theorem I'm teeming with a lot o' newsWith many cheerful facts about the square of the hypotenuse With many cheerful facts about the square of the hypotenuseWith many cheerful facts about the square of the hypotenuseWith many cheerful facts about the square of the hypotenuse I'm very good at integral and differential calculusI know the scientific names of beings animalculousIn short, in matters vegetable, animal, and mineralI am the very model of a modern Major-General - Gilbert and Sullivan: Pirates of Penzance

Lab 5 (Due: Wednesday, October 24, 2007):
Let us revisit the folium of Descartes, this time, computing the derivative using the Maple implicitdiff command, and also specifying different colors for the tangent and normal lines.
> ![]()
> 
> 
> 
> ![]()
> 
> 
> 
> 
> 
For each of the following implicitly defined curves, graph the curve, the tangent line to the given point P, and the normal line on the same set of axes. (These exercises appear in Chapter 3 of G. Thomas.)
1. The “devil’s curve,” studied by Gabriel Cramer, is defined by: y4 – 4y2 = x4 – 9x2. Let P = (3, 2).
2. The “cissoid of Diocles” (circa 200 B.C.) is given by: y2(2-x) = x3. Let P = (1, 1).
3. x3 – xy + y3 = 7, P = (2, 1).
4. y3 + cos xy = x2 , P = (1, 0).
5. xy3 + tan(x+y) = 1, P = (p/4, 0).
6. 2y2 + (xy)1/3 = x2 + 2, P = (1, 1).
Curve sketching and the search for local extrema

Lab 6(Due: Wednesday, November 7, 2007):
Consider the problem of sketching the curve y = (x-1)2(x3+3x+1) and identifying local and global extrema as well as inflection points. We may employ Maple as follows:>
>
>![]()
>![]()
>![]()
>
>![]()
>![]()
NOTE: diff(f, x$n) computes the nth derivative of the expression f
> ![]()
> 
> 
> # f has no global extrema
> ![]()
Exercises: For each of the following curves, locate all local/global extrema and inflection points.
(1) y = x4/4 – x3/3 – 4x2 + 12x + 20
(2) y = x2/3(x2 – 1) on the interval [-1,2].
Note: In Maple, you will need to enter x2/3 as (x2)1/3, otherwise negative inputs are not accepted.
(3) y = x5e3x
(4) y = 4 exp(- (x-5)2 / 3)
(5) y = (x5 - 3x + 1)/(x2 + 3)
(6) y = x2 + 3 cos x on the interval [0, p]
Department Home Page Loyola Home Page

Lab 7 (Due: Wednesday, November 21, 2007 but collected Monday, November 26): In this lab we apply Rolle’s Theorem and the Mean Value Theorem to several particular functions.

(A) Let g(x) = x3 - 7x + 6. Check that g satisfies the hypotheses of Rolle's Theorem for the interval [-3,2]. Graph g. How many points x = c do there appear to be in the interval [-3,2] for which g'(c) = 0? Find all such points. Graph g together with the tangent line(s) to g at each (and all) of these points.
(B) Let f (x) = (5x6 - x5 + 2x4 - 3x) sin(px). Check that f satisfies the hypotheses of Rolle's Theorem for the interval [0,1]. Graph f. How many points x = c do there appear to be in the interval [0,1] for which f '(c) = 0? Find all such points. Graph f together with the tangent line(s) to f at each (and all) of these points.
(C) Let g(x) = cos(3x) / (x2 + 1) be defined on the interval [0, p]. Find all points x = c for which the MVT is satisfied. Graph (on the same set of axes) the function y = g(x), the line passing through the end points (0,g(0)) and (p,g(p)), and all the tangent lines at the points x = c which you have found.
(D) Suppose that Albertine drives from Paris to LeHavre, leaving Paris at time t = 0, and arriving in LeHavre at time t = 3.3 hours. Her position (in km) at time t is given by h(t) = 11.3(t + t1.3 + t1.5)(2.51 + cos t). How far has Albertine traveled? Find Albertine's average velocity over her journey from Paris to LeHavre. Using the MVT, find a point, t*, at which her instantaneous velocity equals her average velocity. Plot all relevant graphs on the same pair of axes (i.e., Albertine’s position function, the line connecting the end points of her position function, and the tangent line to her position function at the special point t*).

Anti-derivatives
Lab 8 (Due: Friday, November 30, 2007): Consider the following Maple code.
> f:= cos(x);
> antiDerivf:= int(f, x);
> plot({f, antiDerivf, antiDerivf+1, antiDerivf+2, antiDerivf+3, antiDerivf-0.7}, x=0..10);
> Digits:=4;
> # Find an antiDerivative, g, of f satisfying g(3) = 5.
> C:= 5 - subs(x=3, antiDerivf);
> C := evalf(C);
> # Thus g(x) = antiDerivf + 4.859 is the antiderivative that we seek.
> plot({f, antiDerivf+4.859}, x = 0..10);
Recall that the Mean Value Theorem guarantees that any two anti-derivatives of f must differ by a constant. Thus, in order to find a particular anti-derivative of f that passes through a specified point P = (a,b), it is sufficient to find any anti-derivative, say g, and then solve for the constant C for which y = g(x) + C passes through the specified point (that is, C = b – g(a)).
Solve each of the following four exercises.
(A) Let f(x) = x ln x. Find an anti-derivative of f that passes through the point P = (e, 3). Graph both functions on the same set of axes.
(B) Let f(x) = cos5(4x). Find an anti-derivative of f that passes through the point Q = (p, 5). Graph both functions on the same set of axes.
(C) Suppose that the velocity function of Charlotte the spider (living on the x-axis) is given by v(t) = t3/(1+t2) + cos t. (Here distance is measured in meters and time in hours.) If Charlotte was born at time t = 3 hours at position x = 5 meters, determine Charlotte’s position at time t = 25 hours.
![]()
(D) Assume that Mad Max is driving along the y-axis and that his acceleration function at time t is given by
a(t) = t3(2 + sin 5t) + ln (4 + t). (Here distance is measured in kilometers and time in hours.) If at time t = 0, Max is located at y = 5 km, and his velocity is 34 km/hr, where is Max at time t = 1 hour? At t = 3 hours? When might he be arrested for speeding?
Definite integrals

Lab 9 (Due: Monday, December 10, 2007):
Consider the following Maple code for computing areas or definite integrals.
> ![]()
> 
Next consider the following:
> ![]()
> 
> ![]()
> 
> 
(Problems from G. Thomas.) For each problem below you are given a specified function f and an interval [a,b]. Let F(x) = definite integral of f(t) from t = a to t = x. Answer each of the following questions:
(1) Plot the functions f and F together over [a,b].
(2) Solve the equation dF/dx = 0. What can you see to be true about the graphs of f and F at points where dF/dx = 0? Is your observation supported by the FTC? Explain.
(3) Over which intervals (approximately) is the function F increasing/decreasing? What is true about f over those intervals?
(4) For each function below, calculate df/dx and plot it together with F. What can you see to be true about the graph of F at points where df/dx = 0? Is your observation supported by the FTC? Explain.
(a) f(x) = x3 – 4x2 + 3x, [0, 4]
(b) f(x) = 2x4 – 17x3 + 46x2 – 43x + 12, [0, 9/2]
(c) f(x) = sin (2x) cos (x/3), [0, 2p]
(d) f(x) = x cos (px), [0, 2p]


