Inv1_Intro1stTimeUse.mws
Calculus II  worksheet 1
A firstexposuretoMaple showing a simple plot of some inverse functions
Author: Carl Devore
<devore@math.udel.edu>
13 February 2002
Audience:
Secondsemester calculus students who are firsttime users of Maple.
Objectives:
1. Basic features of the worksheet environment.
2. Expressions, operators, plotting, names, lists, assignments
3. Mirrorimage property of the graphs of inverse functions.
4. Making plots look nice.
5. Getting help.
6. Avoiding a few of the common mistakes.
Note to Instructors:
I usually begin my very first Maple class with a blank worksheet, and I tell the students to type ?plot. I get them to figure out as much as they can on their own, with some guidance. It is only after the class is over that I send them this worksheet.
Worksheets
This document is an example Maple
worksheet
. The worksheet environment allows you to put neatly formatted text, computations, programs, and the programs' output, including graphics output, all in one neat document. This area of this document is a text field. You enter text here pretty much the same way as you do in any word processor, with
italics
,
boldface,
different fonts
, etc.
It's a pretty good word processor, but it's not as good as Microsoft Word for example. You could use Maple as a word processor to type out mathematical formulas in the standard notation without having Maple do any computations. For example,
.
Note that I intentionally put the wrong answer for the integral there. That is to emphasize that I was only using Maple as a mathematical word processor rather than using Maple to do mathematical computations.
Please click on "Help", then turn on "Ballon Help", and familiarize yourself with the various controls on the toolbars. Just ignore for now any options that you do not understand.
The fields that begin with ">" are where you enter commands or programs. These commandinput fields are referred to as
Execution Groups
by the controls on the toolbars. Several ">' may be grouped into a single execution group. The grouping is indicated by the fine square brackets in the left margin.
> 
`Your command could go here`;

Please expand the sections below by clicking on the boxes in the left margin. Then put your cursor on the first red command line and press Enter or Return to execute the command.
Expressions, Variables, and Assignments
Maple's response to the command is printed in blue (unless you asked for a plot), using somewhat standard mathematical notation. This particular command didn't ask Maple to do anything, so it just translates what you typed into mathematical notation and displays it (this process is referred to as
prettyprinting
). So we see that the symbol ^ is used to represent exponentiation. Every command either ends with a semicolon or a colon. Using a colon tells Maple to do the computations, but don't display the results.
The results of any command can be stored in a variable for later use by using ":=", and it is usually a good idea to do so. In this case, we wish to plot the function
. I will take the expression
and assign it to the variable f.
Unfortunately, all of the following commands are meaningful to Maple, and they all do different things. So Maple does not warn you when you enter one of the following commands, even though it is almost certainly not what you want:
f= x^2;
f: x^2;
f(x):= x^2;
Also note that capital and lower case letters represent different variables, just as in ordinary math notation.
One feature of Maple that makes it very sophisticated compared to other computer languages is that any string of characters, no matter how weird, can be made into a variable by enclosing it in backwards single quotes:
The three types of quote marks all mean something different to Maple, so, unfortunately, it usually won't warn you if you use the wrong type.
Now whenever I refer to f, Maple will substitute
.
I can combine f with something else, and it will still substitute
.
Note that Maple sometimes has its own idea about the order to print an expression in...
...but, of course, this is mathematically equivalent to what you typed.
Multiplication is expressed in Maple with *, just like in almost all computer languages.
You must always use * for multipliction. Juxtaposition cannot be used to indicate multiplication:
Error, missing operator or `;`
Fortunately, Maple gives a warning in this case. But...
That is just another variable name to Maple, so it is not an error. But it has nothing to do with multiplying.
Division is /. The standard order of operations is in effect: Parenheses first, then Exponentiations, then Muliplications and Divisions left to right, then Additions and Subtractions left to right.
Compare:
> 
x+1/2*x; (x+1)/(2*x); x+1/(2*x); (x+1)/2x;

Note that several commands can be placed on one line.
To continue with the mathematical example, the inverse of
, for
> 0, is
. This can be entered in Maple as sqrt(x) or x^(1/2). In either case, it is essential that you use the parentheses. Once again, Maple will usually not warn you if you forget the parentheses because the expression will still be meaningful to Maple without them 
it just won't be the meaning that you intended
. Also, all of the following bracketing symbols have different meanings to Maple: "()", "[]", "{}", "<>". You cannot use different bracketing symbols for nested parentheses.
The
plot command
Let's plot f over the interval [0,4].
Note that the scaling on the
axis is not the same as on the
axis. Unless you tell it otherwise, Maple chooses the scaling to fit as much of the graph as it can. Note how the interval from 0 to 4 is specified with two dots. The structure "0..4" is called a
range
in Maple, but you should associate it with the mathematical concept "interval" rather than the mathematical concept of range. We have to say "x=" before the range because the expression f is defined in terms of x. "x" is not automatically associated with the horizontal axis. So both of the following commands would have generated the same plot:
plot(x^2, x= 0..4);
plot(foo^2, foo= 0..4);
except that in the latter case, the horizontal axis would be labeled "foo".
If you want the same scaling on both axes, use the following additional argument to the plot command:
> 
plot(f, x= 0..4, scaling= constrained);

Perhaps you would like to also limit the extent of the vertical axis:
> 
plot(f, x= 0..4, y= 0..4, scaling= constrained);

Once again, the "y" has no predefined association with the vertical axis. The same plot could have been produced as plot(f, x= 0..4, foo= 0..4, scaling= constrained), except that the vertical axis would then be labeled "foo".
A
list
of objects can be created by enclosing them in square brackets. So you can plot a list of functions on the same axes like this:
> 
plot([f,g], x= 0..4, y= 0..4, scaling= constrained);

This graph shows the mirrorimage property of inverse functions. Notice how Maple assigns different colors to the different members of the list. You can change the colors by adding a "color" argument to the command.
> 
plot([f,g], x= 0..4, y= 0..4, scaling= constrained, color= [black,blue]);

The ordering of the list of colors of course corresponds to the ordering of the list of functions.
Caution:
Some Maple books, even somewhat good ones, show you to use { } (curlybraces) instead of [ ] (square brackets) for a multiple plot command. I strongly recommend that you never do this. With the curly braces, it is impossible to control the correspondence between plots and colors.
I want to add the line
to the graph. As a function, this is
. As far as the plot command is concerned, it is only the part after the equals that matters.
> 
plot([f,g,x], x= 0..4, y= 0..4, scaling= constrained, color= [red, red, black]);

I'd like to make the line dashed. The argument "linestyle" controls this: linestyle = 1 is solid, linestyle = 2 is dots and dashes, linestyle = 3 is dashes.
> 
plot([f,g,x], x= 0..4, y= 0..4, scaling= constrained, color= [red,red,black], linestyle= [1,1,3]);

The command may be getting too long to fit nicely on one line. Any command can be divided by using ShiftReturn (or ShiftEnter) rather than Return (or Enter).
> 
plot([f,g,x], x= 0..4, y= 0..4
,scaling= constrained
,color= [red,red,black]
,linestyle= [1,1,3]
);

It doesn't matter how you space the punctuation marks; the above shows my personal preference.
Finally, I'd like to add a title to the plot.
> 
plot([f,g,x], x= 0..4, y= 0..4
,scaling= constrained
,color= [red,red,black]
,linestyle= [1,1,3]
,title= `An example of the mirrorimage property of inverse functions`
);

The plot command is probably the most useful and versatile command that you will use in this course.
Operators
An expression of the form x > x^2 is what Maple calls an
operator.
This corresponds to the usual mathematical notion of a
function
.
In ordinary math texts, the above would be expressed as
. In other words, F:= x> x^2 is the Maple syntax for defining F to be the squaring function.
Note that the above line makes it appear as though F has not been assigned a value. To see value of an operator, you need to
eval
...
... or you can just evaluate the operator at an arbitrary (unassigned) variable:
It does not matter what unassigned variable that you use:
Try to predict the output of each of the following lines.
So we see above that the operator does not need to be given a name.
It is usually better to use the operator form to define a function rather than the simple expression form that I used in the plots above. For example, our f from above was merely the expression
, meaning that the letter x is intrinsically linked to f, whereas no particular variable name is intrinsically linked to our new F.
In this particular case, Maple has automatically simplified the expression "x > sqrt(x)" to "sqrt". Please do not get thrown off by this. There are certain automatic simplifications that you cannot prevent Maple from doing. For example,
was automatically simplified to 4 a few lines above.
> 
plot( [f(x), g(x), h(x)], x= 0..4, y=0..4, scaling= constrained, color= [red,red,black]);

Notice that we now have to use "f(x)" rather than "f" in the plot command. An alternative is to take off the x from "x= 0..4" and plot the function as functions.
> 
plot( [f,g,h], 0..4, 0..4, scaling= constrained, color= [red,red,black]);

Add a title and axes labels, each in their own font.
> 
plot([f,g,h], 0..4, 0..4
,scaling= constrained
,color= [red,red,black]
,labels= [`X`,`Y`], labelfont= [HELVETICA,BOLDOBLIQUE,12]
,title= `The mirrorimage property of inverse functions`
,titlefont= [TIMES,ROMAN,16]
,axes= boxed
);

Getting Help
You can get help about any command by typing ?<commandname> at an arrow:
For a beginning user, I think that the most useful part of the help pages is the examples. The textual material at the top is often too complicated for a new user to understand. The examples can be cutandpasted into your worksheet. You can go directly to the examples by using ???
However, I recommend that you briefly scan the textual material even if you can't understand it. Eventually you will understand it. You should look up the help for any unfamiliar command that you see in someone else's worksheet.
Once you are in a help window, you can use the hypertext browser at the top to navigate through the help. You may need to use your mouse to expand this section so that it is readable. I particularly recommend that you take the "New User's Tour." You can access this by clicking on "Introduction", which is the first entry in the first column.
Some commands have so many options that their help pages have subpages. "Plot" is such a command. To get help about the title, labels, fonts, etc., enter
If you do not know the name of the command that you want help with, try using "Full Text Search" from the Help menu.
The company that makes Maple has a website with thousands of example worksheets categorized by subject and level. The website is called the
Maple Applications Center and the URL is www.mapleapps.com. Note that the last sentence has a hyperlink right in the text. Once you are at the website, I recommend that you go to the tutorials and download and work through the "Intro to Maple for Physics Students" and "Maple Essentials".