Copyright 2001
Department of Mathematics
University of Georgia
Athens, Georgia
John Gosselin
Welcome to Maple - Part 1
What is Maple?
Maple is a modern computer algebra system that has excellent numerical, graphical and symbolic capabilities. You should treat Maple as a "super graphing calculator." If you are familiar with any of the TI graphing calculators (e.g. TI-81, TI-83 or TI-85), you will notice a great deal of similarity between Maple and these calculators. The major difference between Maple and these calculators is the fact that Maple has symbolic capabilities that are not available on these calculators. If you are familiar with either the TI-89 or TI-92 calculators, which have symbolic capabilities, then the similarity between Maple and these calculators becomes smaller. Two apparent advantages of Maple over any of these calculators is 1) the fact that Maple uses a larger computer screen with much higher resolution than a calculator and 2) the fact that Maple is also an editor that allows the user to create "reports" and print them out. At the calculus level, there is not much difference between the TI-89 and Maple. However, Maple goes much farther in its application to higher level mathematics in areas such as number theory, algebra and differential geometry. At this point you should think of using Maple in the same way you would use a graphing calculator.
Maple Worksheets
The file you are currently reading is called a Maple Worksheet . Maple worksheets are computer files with the extension ".mws". The file you are reading is currently on a server for the calculus labs. You can save a copy of this worksheet to your floppy under any name you like by clicking on File-Save As menu, selecting the a-drive, and then entering your name for the file. You should always give a maple worksheet a name with the extension ".mws". Once you have saved a file to your floppy disk, you can reopen it in Maple either in another lab or on your personal computer. Of course the other machine must have the Maple program installed. All UCNS labs on campus have Maple installed. Personal copies of Maple may be purchased from the UGA bookstore.
Project - Part 1
Write a brief paragraph about yourself. Give your instructor some information concerning your interests. In particular tell your instructor what you hope to accomplish during your stay at the University of Georgia.
Maple Notation and Syntax - Expressions
Maple has its own language and syntax. The Maple syntax for entering mathematical expressions is very similar to the syntax used on the TI calculators. In particular multiplication is indicated by the asterisk "*" (shift-8 on the keyboard) and exponentiation is indicated by the carat "^" (shift-6 on the keyboard). Division is indicated by the forward slash "/". For example the expression
would be entered in Maple as follows:
| > | (3+4)/5; |
The symbol
indicates that this is an
execution group
- i.e. a command or sequence of commands that can be executed. A new execution group can be inserted into a Maple worksheet as a new line by clicking on the
button in the toolbar at the top of the screen. An execution group can be insereted below the line containing the cursor with the keystroke Ctrl-j. An execution group can be entered above the line containing the cursor with the keystroke Ctrl-k As one enters an expression in an execution group, the characters appear in red with a different font. Every Maple command in an execution group must end either with a colon ":" or a semi-colon ";". To execute a Maple command, place the cursor anywhere in the command line and hit the return key. The output is returned in blue on the next line. Execute the above command. Notice that Maple has done something to the expression. If you entered the same expression on a graphing calculator and pressed the enter key, the output would most likely be returned as a decimal. Notice that if we enter one of the numbers in the formula above with a decimal then the Maple output is in decimal form.
| > | (3.0+4)/5; |
Just as with the graphing calculator, parentheses are very important to avoid ambiguities.
| > | 3+4/5; |
If we leave out the parentheses in the above expression, we get an entirely different answer. This is because the division is done before the addition. Maple prioritizes operations as follows: 1) parentheses 2) exponentiation 3) multiplication and division 4) addition and subtraction. This means that expressions in parentheses are evaluated first. Then any exponents are applied. Then any multiplications and divisions are applied. Finally any additions and subtractions are performed. If an expression contains more than one operation on the same level, the operations are carried out from left to right. The main point is that parentheses are essential for entering expressions correctly both in Maple and on the graphing calculator.
Note that square roots are entered as "sqrt(...)". For example
is entered as sqrt(3). Also the natural exponential function
is entered as exp(...). For example
would be entered as exp(2*x+1). The number
is entered in Maple as Pi. Note that the "P" must be capitalized.
Since Maple has great symbolic capability, if one enters
sqrt
(3)
on a command line, Maple simply returns
.
| > | sqrt(3); |
If an expression contains a number with a decimal point, Maple usually converts the output to decimal or "floating-point" form.
| > | sqrt(3.0); |
Maple also has a command evalf that will convert a numerical expression to floating-point.
| > | evalf(sqrt(3)); |
Maple has a command Digits: = n , where n is an integer, that lets one adjust the number of digits that appear in floating-point form. The default setting for the number of digits in floating-point numbers is 10.
| > | Digits:=20; |
Note that the "D" must be capitalized.
| > | evalf(sqrt(3)); |
Project - Part 2
Enter each of the following expressions in Maple in a separate execution group. Execute the command to check your work. Note that Maple may simplify or modify the output so that it does not appear exactly as you might expect.
Variable Assignments in Maple
Maple allows one to give names to various quantities and then subsequently refer to the quantity through the name. This process is referred to as "assigning variables". The simplest example of a variable assignment is that of assigning a variable name to a number. Suppose the number 2.3746 occurs lots of times in calculations being performed. Rather than typing this number repeatedly and allowing the likelihood of typos, it is convenient to assign this number a name or variable, say k , and refer to the number by typing " k " in all our calculations. Maple allows us to do this with the following command
| > | k:=2.3746; |
Note that variable assignments require the colon ":" before the equals sign. We can now compute more complicated expressions that involve the number k . For example
| > | (k+1)/(k+2); |
Once a variable assignment has been made, it can be used anywhere throughout the worksheet. At any given point in a worksheet, Maple has a collection of variable assignments in its memory. If you are uncertain about whether a particular variable assignment is valid, simply enter the name of the variable on a command line (with a semicolon, of course) and execute the command. If the output is merely the name of the variable, then nothing has been assigned to that variable. For if we want to know whether the variable y has been assigned a value, we enter and execute the following command
| > | y; |
Since the command returns " y ", nothing has been assigned to y .
Note that when a Maple worksheet is saved and then later reopened, all variable assignments are lost from memory. However the commands in which the variable assignments were made are still in the worksheet. In order to restore the variable assignments, one needs to re-execute the commands in which the variable assignments were made. It is usually easier to simply re-execute all the commands in the worksheet. This can be done automatically by clicking on Edit-Execute-Worksheet in the menu. You should get in the habit of doing this whenever you re-open a Maple worksheet.
Sometimes in a Maple worksheet there is the need to clear all variable assignments. Maple has a special command for doing this called "restart".
| > | restart; |
Now if we enter " k " on a command line and execute, the value of k has been removed:
| > | k; |
Functions in Maple
Functions can be defined in Maple from their formulas. Defining a function is a very special type of variable assignment. Suppose we want to define the function
. The following command accomplishes this:
| > | f:=x->x^2+3*x+1/x; |
Note that the arrow is formed by two keystrokes, the dash "-" followed by the greater than symbol ">" (shift period). This is one of the most important commands in the calculus lab. You should learn the form of this command. Recall that a function is a rule that assigns an output value to an input value. The above command indicates that
f
is being assigned the name of a function that sends the input value
x
to the output value
.
Once a function has been defined Maple supports the standard functional notation. This avoids having to retype the formula over and over again.
| > | f(2); |
| > | f(1)+f(2); |
| > | f(1.7); |
Project - Part 3
Define the function
. Determine the values of the function
f
when
x
= 2.6 and when
x
= 3.5. Use functional notation to determine the slope of the line passing through the points on the graph of
f
(
x
) corresponding to
x
= 2.83 and
x
= 2.85.
Note that we have defined
using two different formulas. Maple only remembers the
most recent
formula. If you use the same name for more than one function, this is an important fact to remember. The name of a function can contain more than a single character. For example we could give functions names such as
f
1,
f
2, slope, and so on.
Plotting a Function in Maple
Another very important command in Maple is the one for plotting the graph of a function. The standard form of such a command is
"plot(f(x),x=a..b,y=c..d)"
The above command has three basic components separated by commas. The first component is the function whose graph we wish to plot. One can enter either an explicit formula such as "x^2 + 3*x + 1/x" or one can enter "f(x)" where the function f has already been defined in Maple. The last two components control the viewing window. The second component "x=a..b" specifies the interval [ a , b ] in the x -direction. The third component "y=c..d" specifies the interval [ c , d ] in the y -direction. Of course a , b , c and d are real numbers.
| > | plot(f(x),x=-3..3,y=-5..5); |
The third component for the y -range is optional in a plot command. If the user does not specify a y -range, Maple determines the range or output values of the function over the x -interval specified and sets the y -range to the smallest interval containing all the y -values of the function being plotted over the specified x -range.
| > | plot(f(x),x=-3..3); |
Sometimes not giveing a y -range can lead to unexpected results.
| > | plot(1/(x+1),x=-3..3); |
Compare this with the following plot.
| > | plot(1/(x+1),x=-3..3,y=-10..10); |
Note that Maple appears to be plotting a
vertical asymptote
along with the graph of the function
. This is because Maple calculates the values of the function at lots of values of
x
between
a
and
b
and then connects the corresponding points in the plane with line segments. The apparent
vertical asymptote
is in fact a line segment connect two points in the plane lying on opposite sides of
x
= -1. There is a special plot option which one can set to avoid this.
| > | plot(1/(x+1),x=-3..3,y=-10..10,discont=true); |
For the time being you should just accept this option. Keep in mind that it has something to do with continuity of the function being plotted. You will study continuity in your calculus class.
Finally we note that it is easy to plot more than one function in Maple with a single command. Suppose we wanted to plot a set of three functions in the same window. Sets of objects in Maple are inclosed in curly braces "{..}" and separated by commas. For example
represents a set of the three functions
,
and
. To plot this set of functions we use the following command
| > | plot({x^2+1, sin(2*x), 3*x+2},x=-3..3,y=-10..10); |
Note that Maple gives each graph a different color. The user can specify the colors for the graphs by including a color option in the command. Maple recognizes the names of many standard colors. Note that the colors are listed within square brackets "[..]" and separated by commas.
| > | plot({x^2+1, sin(2*x), 3*x+2},x=-3..3,y=-10..10,color=[red,blue,green]); |
When objects are separated by commas between curly braces "{..}" one has created a set of objects with no ordering. On the other hand when objects are separated by commas between square brackets "[..]", one has created a list of objects with ordering. If we put our collection of functions inside square brackets, then we have ordered them.
| > | plot([x^2+1, sin(2*x), 3*x+2],x=-3..3,y=-10..10,color=[red,blue,green]); |
| > |
In this case we have a list of functions and a list of colors within our plot command. Now the color red is assigned to the first function in our list, the color blue is assigned to the second function in our list and the color green is assigned to the third function in our list. By using lists, one can completely control the assignment of colors to different functions.
Project - Part 4
Use the function in Part 3 of this project. Determine the equation of the line passing through the points on the graph of f when x = 2 and x = 3. You should express the equation of the line as a function of x and define it as a function. In calculus such a line is referred to as a secant line of the function f . Now plot both the function and secant line in the same window. Plot your function in red and your secant line in black. Choose the x and y ranges so that you have a good view.
Using Maple Help
Maple provides a wealth of help on a variety of topics. There are two standard ways of accessing Maple help. The first is through the Help-Topic Search menu item. You then type in a key work and Maple will give you a choice of topics related to that word. Double-clicking on one of the topics opens a Maple worksheet with help and information concerning the chosen topic. A second way to access Maple help is to enter and then execute a command of the form question mark followed by a key word. An example is the following
| > | ?plot; |
Project - Part 5
Use Maple help to learn about the thickness option for a plot. This is an option that will allow you to make your graphs thicker and easier to see. Replot your function and secant line making the the graphs thicker than those in Part 4.
Academic Honesty Statement:
Place the following statement (by copying and pasting) at the end of your report and sign it in ink. Your instructor will not grade your report unless this signed statement appears at the end of your report.
I understand that I may work with others if I give them credit in this statement. I also understand that I am required to write my report--that to copy all or part of someone else's report or to allow someone else to copy all or part of my report constitutes plagiarism, which is a serious violation of academic honesty.
I worked with (replace this parenthetical remark with first and last names of those with whom you worked) on this project. I wrote my own report. I did not copy any of this report from anyone else and I did not allow anyone else to copy any of this report.
Signed: