> restart;

>

A First Look At Maple , Part I

Motivation, commands, worksheets

Maple is one of several computer algebra systems currently available, and it is a very powerful and valuable tool in learning college mathematics. It has the ability, of course, to make precise and complicated numerical calculations; far more importantly, it can manipulate symbolic expressions and produce high-quality graphs. It has available large libraries of special commands and operations designed for use in calculus, linear algebra, statistics, and many other higher-level topics in mathematics. Our goal in this worksheet, and the ones which follow, is to introduce the system, with special attention paid to the precalculus student. That is, this worksheet and its immediate cousins are designed for students with a background in algebra but do not assume that calculus or any other more advanced undergraduate topics are familiar to the user. For worksheets specifically designed for students in Calculus I and succeeding courses, see the Center for Technology in Teaching Mathematics at www.uri.edu/math/Center.

Why computer algebra systems? Systems like Maple provide tools which are not currently easily available elsewhere. Graphing calculators are improving rapidly and provide much more power than the previous generations of scientific calculators, but the most reasonably-priced ones have significant limitations on their ability to perform symbolic manipulations. Moreover, the quality of graphics and the number of computational options available in computer algebra systems will almost surely continue to dwarf the corresponding abilities in hand-held instruments for some time.

Do I have to be a programmer? No and yes. Maple uses a specific syntax (a system of symbols and grammar) which must be employed. However, most of the rules and commands are written in a fashion very similar to the way they are expressed in your classes and textbooks. Most importantly, the syntax can be learned "on the fly" -- you do not have to learn great chunks of a language in order to start solving problems. Examples, the very informative "Help" menu, and a tutorial book or pamphlet are plenty to get you rolling on doing work in Maple.

What is a "worksheet"? A Maple worksheet, like the one you are reading, ordinarily consists of both text lines (like these) and Maple command lines (some of which will follow soon). Buttons on the toolbar above can be used to choose your desired input; the " T " button is for text input, and the adjacent " [ > " button will identify Maple command input. (It is also possible to put tidy mathematical expressions into the text portion of a worksheet, but that function will be relatively unimportant to us here. If you wish to learn more about this, consult your instructor or the various available resources.)

What will I see in these worksheets? This first worksheet provides a basic introduction part of Maple and computer algebra systems in general. The very important topics of functions, expressions, and the first elements of graphing are in the next worksheet, and the succeeding one has more information about graphs. Further worksheets will address various topics appropriate to study at a precalculus level.

Examples Before addressing specific topics within Maple, we begin with some examples which might suggest a little about some of the things Maple can do. It is to be emphasized that these merely scratch the surface -- about one angstrom deep. But they still may give some of the flavor of what may be available.

Many of the onerous tasks in Algebra II, those reviewed in the early days of most precalculus courses, can be handled easily by Maple. For instance, if we need to perform the multiplication [Maple Math] , not much work is involved. We type the appropriate command line and press the "Enter" key.

> expand((5*x^3-4*x^2+3.3*x-Pi)*(11*x^4-2*x^3+3.4*x^2-8*x+3*Pi));

[Maple Math]

>

At the end of any command line, a semicolon tells the system to execute the command and print the result at the next command line. If you do not need the result to be printed, use a colon instead of a semicolon; the system will execute the command and remember the result. Notice how the system can mix numerical and symbolic manipulation. If we need all numerics in any expression, that is easily available. The symbol " % " is used as a shorthand to refer to the most recently executed response to a command line, and is very handy in many situations.

> evalf(%);

[Maple Math]

>

The command indicates that the previous expression should be evaluated , with the " f " indicating that a floating point decimal approximation should be used for all possible terms. (The precision of such an approximation can be adjusted.) Since no numerical value for x was specified, it remained as a variable; but a numerical approximation to [Maple Math] was inserted throughout.

We often find ourselves faced with other algebra tasks which are routine in principle, but tedious in practice. Again, the system can provide help. Needing, say, to factor the expression [Maple Math] , we employ a self-explanatory command.

> factor(6*x^3+4*x^2-24*x-16);

[Maple Math]

To simplify the expression [Maple Math] , we have much less work to do than if pencil and paper were our only tools.

> simplify(2/(x-2)+5*x/(x^2-3*x-10)-4/(x+1));

[Maple Math]

What happens if we ask for the factorization of an irreducible polynomial such as [Maple Math] ?

> factor(x^2-x-11);

[Maple Math]

>

Maple has returned our input, unchanged. When the system is asked to perform operations which are impossible, ill-defined, or which it does not understand, it often simply returns the input. In this particular example, Maple has assumed that the domain over which to factor the polynomial is the one implied by the style of the given coefficients. There are ways around this; for example, see the command lines which follow; other ways to approach this problem can be found in the "Help" topics.

> factor(x^2-x-11,real);

[Maple Math]

> factor(x^2-x-11.0);

[Maple Math]

>

To see how to adjust a command, how to specify details within it, and so forth, the "Help" menu is very informative. And if there are errors in the syntax of the commands, appropriate error messages will help you "de-bug" your command.

Let's explore a little using some of the ideas presented so far. To find the value of an expression for a certain specified value of a variable within it, we can use the " eval " command. For example, if we want to put w = 79 into the expression [Maple Math] , we command as follows.

> eval(11/(w^2-6*w+9),w=79);

[Maple Math]

>

If a decimal approximation is desired, we can obtain it now.

> evalf(%);

[Maple Math]

The level of precision can be chosen in the " evalf " command, with the system defaulting to so-called ten-place floating-point accuracy. Below we illustrate the option of choosing the level of accuracy -- the number of digits -- which is displayed; we also show that commands can be strung together before all are executed at once.

> evalf(Pi,4);evalf(Pi,35);

[Maple Math]

[Maple Math]

>

An amusing example suggests itself here. You may have encountered the transcendental number e which arises in many examples, including compound interest, population growth, and radioactive decay. Its value is given approximately below, using the fact that Maple recognizes it as the base of the exponential function it calls "exp", so e is known as [Maple Math] to the first power.

> evalf(exp(1),30);

[Maple Math]

Early in the 20th century, the mathematician Srinivasa Ramanujan remarked, " [Maple Math] is nearly an integer", and the (false) statement that in fact it is an integer has periodically reappeared as a hoax of sorts. Indeed, consider the following.

> evalf(exp(Pi*sqrt(163)),27);

[Maple Math]

>

Through 27-place accuracy, it appears to be an integer, 262,537,412,640,768,744. But if we ask for a little more ...

> evalf(exp(Pi*sqrt(163)),45);

[Maple Math]

>

... we see that in fact it is "nearly an integer". The purpose of this example is to point out the amazing capability of modern computers and systems like Maple to address seemingly impossible calculations in an instant -- and perhaps to get us all to reflect on how Mr. Ramanujan's abilities were, to say the least, extraordinary.

Solving Equations One of the common, and occasionally tedious, tasks in algebra courses is the solving of equations and, perhaps, systems of equations. Maple can take care of these with routine effort and reasonably simple commands. For example, to solve [Maple Math] for any one of its variables, we just ask. In the succeeding sequence of commands, we solve the equation for each of a , b , c , d , and x , respectively. Notice that even the complicated symbol-filled quadratic equation for the variable x is handled with ease.

> solve(3*x/(x-a)+b*x/c = d,a);

[Maple Math]

> solve(3*x/(x-a)+b*x/c = d,b);

[Maple Math]

> solve(3*x/(x-a)+b*x/c = d,c);

[Maple Math]

> solve(3*x/(x-a)+b*x/c = d,x);

[Maple Math]
[Maple Math]

If polynomial equations are to be solved, some care must be taken. The " fsolve " command will return approximate solutions, and it seeks only real ones unless instructed otherwise. For example, for finding the roots of the simple cubic [Maple Math] , consider the following commands and their results.

> solve(x^3-64=0,x);

[Maple Math]

> fsolve(x^3-64=0,x);

[Maple Math]

> fsolve(x^3-64=0,x,complex);

[Maple Math]

>

If you ask the system to perform the impossible, it indicates such as illustrated here.

> solve(x^5-3*x^4+2*x^2-8*x+13=0,x);

[Maple Math]

>

The response indicates that the system understands your question but is unable to obtain a symbolic solution. It may be that approximations are available, though.

> fsolve(x^5-3*x^4+2*x^2-8*x+13=0,x,complex);

[Maple Math]

>

Maple also can solve systems of equations and has many internal packages available. For details, consult your instructor or your other available resources. For now, we illustrate with a single example, the solving of the system [Maple Math] .

> solve({(a-2*b)/(a+2*b) = 5, 3*a+4*b = 11},{a,b});

[Maple Math]

>

Other remarks The " restart " command which you saw at the beginning of this worksheet tells Maple to clear the slate. If you have been doing other Maple work and wish to begin a new problem or project without carrying over definitions of expressions, functions, and the like, use that command.

Use your judgment; there may be times that you want to continue to use previously defined functions and previous results. But if you are in doubt, or if you know you want a fresh start with Maple not remembering any recent work, use the command.

Common word-processing techniques can be used in Maple to shorten your typing chores. Techniques like copy-and-paste, cut-and-paste, and drag-and-drop can all be used with Maple commands.

Some alertness is required when using the very useful " % " shorthand. Maple will interpret the symbol to refer to the output of the most recently executed command line. If you have been moving around your worksheet, changing some problems and not changing others, you must be careful that your " % " should indeed be applied to the last executed command line. For example, execute these two commands in order as they are typed:

> evalf(2.8^3);

[Maple Math]

> evalf(%^2);

[Maple Math]

>

The first found [Maple Math] and the second found the square of that result. Now locate the cursor at the end of the second command line and press "Enter" again. What happens? The last output of an executed command line had been 481.800304, Maple took that for the value represented by the "%" symbol, and squared it. If you are going through some work and repeating commands, especially ones using that shortcut, be sure you have re-executed any appropriate preceding commands so that Maple will be using exactly the outputs you wish.

Homework Problems

To do homework problems on this and future worksheets, open a new Maple worksheet by clicking on the blank page icon on the toolbar or by choosing "New" from the File menu. Enter your name, the title of the worksheet to which the homework corresponds, and numbers of consecutive problems all using the text mode. Usually, all you'll need to do to solve problems is to re-read the worksheet where they are given and carefully -- CAREFULLY -- follow the syntax from related examples. Do not skip commas, semicolons, and so forth, and be perfect with your mimicry of commands in the worksheet. As with most computer languages and input modes, Maple is utterly literal and will, for example, come to a halt over an issue like three dots instead of two. After using Maple to obtain solutions, plot graphs, and so forth, go back and explain your answers to whatever degree is appropriate. Insert your explanations into your worksheet using the text mode. Be sure to use proper grammar and complete sentences; with some of the onerous computation taken care of by the software, we all have more time available to be coherent with our work and results!

Problem 1. This problem concerns the equation [Maple Math] .

(a) Attempt to solve the equation directly using a single Maple command.

(b) Use Maple to factor the polynomial on the left-hand side of the equation and then use what you
know from algebra to complete the solution of the equation. Are your answers to (a) and (b)
consistent with each other?

Problem 2. Repeat Problem 1, except for the equation

[Maple Math] = 0. Include commentary on how answers appear similarly to, or differently from, those in Problem 1.

Problem 3. Simplify the following expression as much as is possible. [Maple Math] . Compared to your experience with such things in algebra classes, was that more enjoyable, or less so?

Problem 4. Solve the following equation for each of its variables in terms of the others. [Maple Math] .