Calculus With Maple
Calculus With Maple
Mr. Maple
with assistance from
Dr. Larry K. Norris
Preface
The Pictures
The pictures of portions of Maple worksheets are taken from Maple worksheets
on a MacIntosh Power PC. Hence the corresponding pictures that you will see
on Sun workstations and PCs in the computer labs will vary a little from those
in this manual, but the difference will not matter for the purposes of these
notes.
In the NCSU Catalog course listing for the calculus courses MA 141, MA 241
and MA 242, one finds the statement that students taking calculus at NCSU
are required to learn to "use computational tools". At the present this
statement means that students in the calculus courses are required to
complete the "NCSU Maple Basics" Lessons and Homework.
The Hyperlinks
During your next several semesters as you work your way through the calculus
sequence of courses - MA 141, MA 241, MA 241 and MA 341 - you will discover
the answer to this question in full detail. But to get started you need an
introduction to Maple that will give you an overview of what Maple is all about,
and that is the purpose of this chapter. You can think of Maple as a package
of software tools such as Microsoft Office98, which contains the Microsoft
programs (1) Word, (2) Excel, (3) PowerPoint, (4) Explorer and (5) Express:
In contrast Maple contains (1) a Graphics Tool, (2) a Computation Tool, (3) a
Programming Tool, and (4) a Spreadsheet:
In the following pages you will discover the many different ways Maple will be
helpful to you in your study of calculus.
1.1 Maple Basics
The first thing you need to know about Maple is that everything is centered
around the Maple worksheet. The worksheet is the canvas upon which you do
your work. When you start up the Maple program the M aple window appears
on your screen. Have a look at the sample Maple window below. The Maple
program uses a standard screen format, namely it divides the Maple window
into two parts, the top menu bar, and the bottom worksheet window . The
top menu bar always stays put, while the bottom worksheet window changes
whenever you change from one worksheet to another. The worksheet window
is where you type in and enter your commands, and it is where Maple gives you
the results. In this sample the author has loaded the plots package with the
command with(plots):, and then used the plot3d command to plot a portion of
the
very large, and consequently most of Maple is not stored in active memory.
Maple divides itself into pieces called packages, and the plots package
mentioned
above is one of Maple's packages. The following illustration shows the
Maple commands that become available once the plots package is loaded in
memory with the with(plots) command.
• The filename ends with the extension .mws. Always add this
extension to your filenames to help you find your files later.
• There are no blank spaces in the filename. Here we use underscores
to connect words. You will sometimes have problems with your files if
you leave blank spaces in the filenames, so from the very beginning of
your Maple work you should decide to never put blank spaces in
Maple worksheet filenames.
Let's go back to the Maple window and have a closer look at the Maple menu
bar. If you click on one of the words along the top row of the menu bar you will
launch a
popup menu with various choices closely related to the word you selected.
Here, for example, is the popup menu obtained by clicking File.
Let's now return to the sample Maple worksheet and look at the symbol
used to end each line.
Figure 3. The colon versus the semi-colon.
You'll notice that the first line ends in a colon, and there is no discernable
Maple output associated with that command. On the other hand the third line
in Figure 3 ends with a semi-colon, and the output is the graph of the
function. Figure 2 also shows the Maple output when the command with(plots)
is followed by a semi- colon. These examples illustrate the
• All command lines, except lines that begin with a question mark ?
must end with either a colon or semi-colon.
• If a command line ends with a colon, then the output of that
command is suppressed.
• If a command line ends with a semi-colon, then the output of that
command is displayed.
The text in black in the above picture is inside a text field. No Maple
commands can be issued from within a text field. When you need to make
comments in a Maple worksheet you can switch an execution group to a text
field as explained in the above picture, and then enter text. Or you can begin a
line inside an execution group with the # symbol, which tells Maple that the
follow line is a comment line, and Maple should simple ignore it.
The Maple package provides an extensive HELP facility that all Maple users
become acquainted with soon after beginning to experiment inside a Maple
worksheet. Learning to use the Maple program will require practice since you
will be learning a new language that has a specific sy ntax. For example, we
have already learned that Maple knows that you are issuing a command when
a line inside an execution group ends with a colon or semi-colon. But what
should you do if you happen to FORGET the syntax for a specific
command? The sequence of commands in the worksheet pictured below
illustrates a situation that can occur for a new Maple user.
Figure 4. Maple Error Messages
After loading the plots package the author of this worksheet has tried to plot
the graph of the function f (x) = x 2 + 2x + 1 on the interval [-2,2]. The author also
has chosen to use the normal x-y axes plot option for the plot. Unfortunately
the author has also forgotten the correct order in which to input the
information into the plot command. This is again a Maple syntax problem.
Maple has issued, in default color purple , the following error message:
In Figure 4 above we observe that the student was not phased by this
problem. Since he couldn't remember the correct syntax, he ordered up the
help window with the maple command
|> ?plot
What happened next was that Maple opened the help window for the Maple
command plot. A portion of that help window is shown here in Figure 5.
Figure 5. A portion of the help window for the plot command.
This help window is typical of all Maple help windows. It has the name of the
Maple command at the top followed by a brief description of the action
associated with that command:
Next on the page is the list of Calling sequences , followed by the list of
Parameters, which is followed by a Description section. The Calling sequences
tell you the ordering of the inputs, and the Parameters tell you the names of
the inputs for the command. Notice that there are two calling sequences for
the plot command, and this is typical of most Maple commands. There are
typically two or more forms of the calling sequence for any Maple command.
The Description section describes various aspects of the command.
The first form of the calling sequence for the plot command, plot(f,h,v), in
Figure 5, tells us one way to call the plot command:
Inside plot() we would:
• Enter the function first, followed by a comma
• Next enter the horizontal range, followed by a comma
• Finally enter the vertical range. This argument is optional, which means
that you can enter it, or leave it out.
The second form of the plot command, plot(f,h,v,…), has the three arguments
f,h,v followed by a series of three dots: … . This is Maple's shorthand for a
series of standard plot options available to the user of the plot command. The
statement below in Figure 6 occurs in the Description section of the plot help
window, but further down so that it is not visible in Figure 5. It alerts the
reader that the "remaining arguments", signified by … , are described in the
plot[options] help window . In fact the reference to plot[options] is in green,
signifying that you can
click on this link and go directly to the help window for plot[options]. Notice
the syntax: option = value. For example, the option for normal axes in the
plane is: axes = normal. There are many other options that you will learn
about in the NCSU Maple Basics Lessons, and you can read about them in the
plot help window.
The student who was working on this worksheet, after reading the help
window, realized that he had placed the inputs in an incorrect order. He then
retyped the command with the horizontal range before the plot option of axes
= normal, entered the command and obtained the plot shown in Figure 5.
• You can get the help window for Maple command <command> by entering
[> ?<command> in a Maple execution group. For example, [> ?plot .
• You can get searchable help windows by clicking on the Help button on the
top menu bar and then selecting the type of help you need.
One of the most basic things that you will do over and over again inside Maple
worksheets is to assign names to various expressions. That is, you will
name the objects that you want to manipulate in the worksheet. The way that
you notify Maple that you are making a name assignment is to use the
assignment operator, which is a colon followed by the equality sign. For
example, if you want to give the name f to the expression x2 − x +10 in Maple
you would make this assignment as shown in Figure 7. The assignment is
made in red, and Maple replies with the output in blue. On the next command
line the name f is entered with the command|> f; and Maple replies with the
value of f, namely x − x +10 . For as long as you do not delete the active
2
memory Maple will remember that the name f has the value x2 − x +10 .
The next picture shows the text part of the help window for the assignment
statement. Note that lhs means left hand side, etc.
You will make extensive use of this operation in your Maple homework where
you will be asked to assign your answers to specific names for automatic
grading by a computer. See the section NCSU Maple Basics Homework for
more about this.
One of the most useful ways to study functions and equations is to study them
visually, and Maple contains a powerful graphical tool to plot the graphs of
functions of 1 and 2 variables, as well as the graphs of equations in 2 and 3
variables. The plot shown in figures 1 and 2 above is an example of a Maple
plot. As you progress through your calculus courses you will learn to use
Maple’s plotting tools to help you do your work. Of course you will be expected
to learn to sketch by hand a certain number of “special cases”, but the
majority of your sketching will be done with Maple. Why? Because it is simply
too time consuming and too difficult (impossible in general) to sketch the graph
of a complicated function or equation by hand. By learning to use Maple to do
your plotting for you, you will greatly extend your ability to study functions and
equations. You will be able to get a look at the graph of a function or equation
in just a few seconds, namely in the time it takes to enter the appropriate plot
commands in a Maple worksheet. One uses:
• plot( ) to plot the graph of functions of 1 variable
• plot3d( ) to plot the graph of functions of 2 variables
• implicitplot( ) to plot the graph of an equation in x and y
• implicitplot3d( ) to plot the graph of an equation in x, y and z
You will begin to learn the syntax of these commands in detail starting with
your 3rd MA 141 Maple lab.
Maple is well known for its ability to perform a wide variety of complicated
mathematical calculations and manipulations. In the calculus sequence of
courses you will learn to use Maple to do all your basic calculations, after you
master the conceptual basis for each calculation. You will use Maple to:
Maple organizes its computational tools into packages. You have already seen
above in Figure 2 the list of commands in the plots package. Below we show
the commands in the commonly used student, linalg (linear algebra) and
DETools packages.
4. Maple as a Programming Language
|> ?if
or
|> ?do
will launch the h elp screens for these commands.
In the computer labs around the NCSU campus you will find two types of
computers: Sun workstations using the UNIX operating system and personal
computers (PCs) using the WindowsNT operating system. There are also a few
Macs around campus, but we will not comment on these. If the UNIX and/or
WindowsNT operating systems are new to you please read the appropriate
subsection below for a brief introduction to these systems. The laptop
computers that you will be using in the Maple labs all use the WindowsNT
operating system.
The campus-wide local area network is named the Unity network. Every
student and faculty member at NCSU has an individual account on Unity, with
login ID composed of the concatenation of the following three strings:
jajohns3
where the 3 indicates that Mr. Johnson is the third NC State student whose
login ID ought to be jajohnso. Since login IDs must be unique, these students
are distinguished by replacing the last letter in the ID with a unique number.
When you log into a Sun workstation a default “desktop” will open
automatically for you. A small window, called an xterm window, will
appear in the middle of the screen. From this window you can issue
commands, start up programs (such as Maple), and start up a web
browser to get on the internet. You will get acquainted quickly with
UNIX once you start working with it, but to get you started we have listed
below a few of the more common commands you will need.
You should explore the mouse buttons to find the many options
available to the user with a single click of the mouse. In particular the
middle mouse button will allow you to open an editor, a web browser, the
Maple program, and other useful programs.
When you execute the command ls in an xterm window you will list the
contents of your home directory. You might begin by creating a new
directory in your home directory for all your Maple work. If you issue the
command
• mkdir Maple_work
/afs/eos/users/j/jlsmith/Maple_work
~/
You can store all of your work with Maple lessons and Maple homework
in this directory.
Since you will most certainly be working on both UNIX workstations and
WindowsNT PCs, you’ll need to know how to save files so that you can
get to them on both systems. We have already discussed the students
“home directory” above in part 5.1. You need to know that to save a file
to this home directory from a PC you need to save the file in the k-drive.
Everything that you will need to do your Maple work in your course can be
obtained from the Calculus with Maple web page at the URL
[Link]
Here are some of the links you will find on that web page:
You should click on the above link (if you haven't already) and begin to explore
the Calculus with Maple homepage. The next two sections will tell you about
the Maple lessons and Maple homework.
The core of the program is a series of 5 Maple Labs in each of the courses in
the sequence, together with a set of homework exercises for each lab, to be
completed and submitted electronically by the students. Each lab is composed
of a self-contained discussion, in Maple worksheet format, of a topic relevant to
the course. The material explains in detail how one uses Maple to in some
cases "better understand a calculus concept", in other cases to "use the
computational power of Maple to solve difficult problems", and in still yet other
circumstances to "use the programming and/or graphical power of Maple to
help solve calculus problems".
• In MA 242 the student uses Maple to simplify and carry out many of the difficult
and time consuming tasks associated with multivariable calculus. The labs
address some of the major problems that students often have in MA 242. In
particular Maple Labs #2 and #3 show the student how to do the "geometrical
part" of double and triple integration. This is done by showing the student how to
use the graphical power of Maple to write down the description of 2D (lab #2)
and 3D (lab #3) regions, in set notation, thus supplying the student with the limits
of integration for double and triple integrals. Lesson #4 discusses parametric
surfaces, while Lab #5 shows the student how to set up procedures to evaluate
surface, surface area and flux integrals.
Once you have studied a Maple lesson in the Maple lab you will be ready to
begin your Maple homework assignment. You will obtain your Maple
homework worksheet from the homework link for your course on the Calculus
with Maple homepage at the URL
[Link]
Your Maple homework is going to be graded by a computer, and in order for
your homework to be graded properly you will need to assign your answers
to specific names in the homework worksheet. Below is a sample problem
taken from the 2nd MA 242 Maple lesson. You can ignore the "details" of the
solution as we want to concentrate only on how to assign your solutions to
specific names. Note that in the statement of the problem you are asked to
assign your solution expressions to the names ans1 and ans2 according to
the given template. In the "solution" there is some work done in Maple,
followed by some text in which the region R is written down in set notation.
Notice the last line of the text that reads "Finally we assign the answers to
this problem as follows:" Although the student has already written down the
set description of the region R, the work is not done until the answers are
assigned to the specific names ans1 and ans2 . You'll need to pay close
attention to the instructions in each problem, as the names you will assign to
your answers will vary from problem to problem.
Here are the specific instructions that will appear at the top of your Maple
homework worksheets. They are printed here so that you can begin to think
about these special instructions now.
• Do not add, remove, or change the titles of the sections (Problem 1, Problem
2, etc.)
• Do not use a version of Maple older that Maple V release 5.
• Read all problems carefully and follow their instructions exactly.
• Make sure that your answers are assigned to the names specified in the
problem.
• Only use the restart command at the very beginning of the problem, if at all.
Make sure your commands work properly in sequence, and that no errors
occur
when your worksheet is executed. You can check this by using the
"Execute->Worksheet" command under the Edit menu, and then looking at
the results.
• Only submit your Maple homework from a computer in a campus computer
lab. You may have various problems if you submit your homework from a
personal computer. If you complete your homework from a personal
computer, you should email the assignment to your campus Unity account,
and then submit the file.
Before submitting your first homework you should read the tutorial on
submitting homework that is located on the Calculus with Maple homepage.