Application Center - Maplesoft

App Preview:

A first-exposure-to-Maple showing a simple plot of some inverse functions

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application



Calculus II -- worksheet 1

A first-exposure-to-Maple showing a simple plot of some inverse functions  

Author: Carl Devore  <>

13 February 2002


Second-semester calculus students who are first-time users of Maple.


 1.  Basic features of the worksheet environment.

 2.  Expressions, operators, plotting, names, lists, assignments

 3.  Mirror-image 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.


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,

Int(x^2,x) = x^4/4+C .

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 command-input 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`;

`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

>     x^2;


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 pretty-printing ).   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.

>    x^2:

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 f(x) = x^2 .   I will take the expression x^2  and assign it to the variable f.

>    f:= x^2;

f := x^2

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:

>    `x^2`:= x^2;

`x^2` := x^2

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 x^2 .

>    f;


I can combine f with something else, and it will still substitute x^2 .

>    f+1;


Note that Maple sometimes has its own idea about the order to print an expression in...

>    1+f;


...but, of course, this is mathematically equivalent to what you typed.

Multiplication is expressed in Maple with *, just like in almost all computer languages.

>    2*f;


You must always use * for multipliction.  Juxtaposition cannot be used to indicate multiplication:

>    2x;

Error, missing operator or `;`

Fortunately, Maple gives a warning in this case.  But...

>    x2;


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.


>    x+1/2*x; (x+1)/(2*x); x+1/(2*x); (x+1)/2-x;





Note that several commands can be placed on one line.

To continue with the mathematical example, the inverse of x^2 , for x  > 0, is sqrt(x) .  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.

>    g:= sqrt(x);

g := sqrt(x)

The   plot command

Let's plot f over the interval [0,4].      

>    plot(f, x= 0..4);     

[Maple Plot]

Note that the scaling on the y -axis is not the same as on the x -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);

[Maple Plot]

Perhaps you would like to also limit the extent of the vertical axis:

>    plot(f, x= 0..4, y= 0..4, scaling= constrained);

[Maple Plot]

Once again, the "y" has no pre-defined 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);

[Maple Plot]

This graph shows the mirror-image 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]);

[Maple Plot]

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 { } (curly-braces) 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 y = x  to the graph.  As a function, this is f(x) = x .  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]);

[Maple Plot]

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]);

[Maple Plot]

The command may be getting too long to fit nicely on one line.  Any command can be divided by using Shift-Return (or Shift-Enter) 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]

[Maple Plot]

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 mirror-image property of inverse functions`

[Maple Plot]

The plot command is probably the most useful and versatile command that you will use in this course.


An expression of the form x -> x^2 is what Maple calls an operator.   This corresponds to the usual mathematical notion of a function .

>    F:= x-> x^2;

F := proc (x) options operator, arrow; x^2 end proc

In ordinary math texts, the above would be expressed as F(x) = x^2 .  In other words,  F:= x-> x^2 is the Maple syntax for defining F to be the squaring function.

>    F;


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  ...

>    eval(F);

proc (x) options operator, arrow; x^2 end proc

... or you can just evaluate the operator at an arbitrary (unassigned) variable:

>    F(y);


It does not matter what unassigned variable that you use:

>    F(x);


Try to predict the output of each of the following lines.

>    F(2);


>    (x-> x^3)(2);


So we see above that the operator does not need to be given a name.

>    (x-> x^3)(a+b);


>    F(a+b);


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 x^2 , meaning that the letter x is intrinsically linked to f, whereas no particular variable name is intrinsically linked to our new F.  

>    g:= x-> sqrt(x);

g := sqrt

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, 2^2  was automatically simplified to 4 a few lines above.

>    h:= x-> x;

h := proc (x) options operator, arrow; x end proc

>    plot( [f(x), g(x), h(x)], x= 0..4, y=0..4, scaling= constrained, color= [red,red,black]);

[Maple Plot]

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]);

[Maple Plot]

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 mirror-image property of inverse functions`
    ,titlefont= [TIMES,ROMAN,16]
    ,axes= boxed

[Maple Plot]

Getting Help

You can get help about any command by typing ?<command-name> at an arrow:

>    ?plot

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 cut-and-pasted into your worksheet.  You can go directly to the examples by using ???

>    ???plot

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

>    ?plot,options

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  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".