Mathematical and Statistical Application – Maple – Common FAQs

I am a new Maple user and I do not know how to program in Maple. What should I do?

Maple’s syntax is very intuitive and not complicated. The best way to learn how to use Maple is to take “The New User’s Tour.” The “New User’s Tour” presents the fundamental Maple commands that every user should be aware of. The tour covers many areas of Maple, including: The Maple Worksheet Environment, Numerical Calculations, Algebraic Computations, Graphics, Calculus, Differential Equations, Linear Algebra, Finance and Statistics, Programming, and Online Help. The tour is easy to proceed through, and it can take up to two hours if all topics are examined.

In order to start The New User’s Tour you should click on the help icon and choose New User’s Tour from the menu on the left of the help window.

How do I get help I can actually use?

Instead of trying to follow the numerous Help menus, try entering “?yourtopic” to go directly to the help page you want. For example, to get help with the integration command “int” enter “?int” at the Maple prompt. You will find working examples for each command at the bottom of the help page for the command.

Why does Maple work for other people but act crazy for me?

One possible reason is that the background wallpaper you have chosen is so busy it uses up hardware of operating system resources that Maple need to work. Maple works best with a plain background.

How do I print my session?

Click on File > Print from the menu.

I opened a worksheet that I saved before, but now Maple doesn’t know the values of the variables I used. Why?

When you open a Maple worksheet you must execute it to get the variables defined. You can do this by stepping through the commands from the beginning, or by clicking on Edit > Execute > Worksheet.

Why did my graph turn out empty or blank?

There are several possible answers to this question

  • Answer 1: You forgot to specify a range on the independent variable.
  > f:=2-x;
  > plot(f); WRONG
  Plotting error, empty plot
  > plot(f,x=-1..1); CORRECT
  • Answer 2: You might be plotting a quantity that isn’t defined. For example, you might have defined Y but then asked Maple to plot y. Maple is case-sensitive, and many strange behaviors are the result of typing a variable name in the wrong case.
  • Another way a plotted quantity can be undefined is if you didn’t use the assignment operator “:=” to define it.
  > y=sin(x); WRONG
  > plot(y,x=-1..1);
  Plotting error, empty plot
  • Answer 3: There might be a scaling problem, as in this example. Here the numbers get so big that all of the points Maple calculates before the last one are negligible compared to the last point in the plot, so they are all lost in the x-axis and no curve appears.
  > plot(exp(x^2),x=0..10);
  • Answer 4: The quantity you are trying to plot might contain variables other than the independent variable in the plot.
  > g:=x^2-3*a;
  > plot(g,x=-1..1);
  Plotting error, empty plot
  • Here both “a” and “x” are variables in the definition of “g”. In order to plot a function Maple needs to compute numerical values for it at different values of “x”, and that’s impossible until all of the other quantities in the function have been given numerical values. In this example, assigning a value to “a” fixes the problem.
  > g:=x^2-3*a;
  > a:=1;
  > plot(g,x=-1..1); Now this command works

How do I undefine a variable to put it back to being a variable?

To undefine “x”, enter:

  x := 'x';

To restart Maple with its memory cleared, enter “restart”.

When I enter the same command repeatedly, why does it do something different each time?

Some commands change the internal state of the calculation, so the results have to be different each time. For example, if x is 1, entering x:=x+1; repeatedly obviously yields values of x that count up.

A less obvious way that a command can do different things at different times it is used is if it includes the % reference to the previous result. Then, the result from the command will depend on what the previous result was. It is less confusing to assign a name to a result you want to use again, rather than referring to it with %.

Why doesn’t my function definition work?

Here are examples of correct and incorrect ways to define functions.

  • Two correctways to define functions.
    • One way is by assigning a formula to a name. If you use this method you can refer to f, BUT referring to “f(x)” yields nonsense.
   > f:=2-x; CORRECT
   > plot(f,x=-1..1); CORRECT
   > solve(f=0,x); CORRECT
   > f(x); WRONG 
    • Another way is by using an arrow. If you use this method you can refer to f(x), BUT referring to just “f” only yields “f”, not the function.
   > f:=x->x^2; CORRECT
   > f(x); CORRECT
   > f(1); CORRECT
   > plot(f(x),x=-1..1); CORRECT
   > solve(f(x)=0,x); CORRECT
   > f; WRONG
  • Two incorrectways to define functions.
    • This way assigns the formula to the name “f(x)”, but for f(1) and similar expressions Maple just returns the same thing you type in.
   > f(x):=2-x; WRONG
    • Another INCORRECT way of defining a function is an assertion rather than an assignment, so it doesn’t change the value of f at all, and for “f” Maple will just return the name “f” rather than 2-x.
            > f=2-x; WRONG

What does “invalid arguments” mean?

  • Here are some examples illustrating this problem.

Here “x” already equals 3, so it doesn’t make sense to use it in an assertion like “2*x=1”, and plotting “2*x” is just plotting “6”.

  > x:=3;
   ... various other calculations, 
   during which you forget that 
   ... you gave x a value
  > solve(2*x=1,x);
   Error, (in solve) invalid arguments
  > plot(2*x,x=-1..1); No complaint is written out, 
   but the plot is just the line 

Putting x back to a symbol solves the problem.

  > x:='x';
  > solve(2*x=1,x); Now these commands work as expected.
  > plot(2*x,x=-1..1);

Notice that the quote marks are single regular quote marks, not double (“) or back-quote (`) marks.

  • Another example, this error message means you supplied too many or too few arguments to the command, or arguments of the wrong kind.
  > solve(g=0,x,x=-1..2);
  Error, (in solve) invalid arguments

In this example the problem is that the “solve” command does not expect an interval over which to search for solutions (it’s “fsolve” that can do that). Removing the extra parameter fixes the problem.

  > solve(g=0,x);
  • Here “solve” can handle (some) inequalities, but “fsolve” can’t.
  > fsolve(g>0,x);
  Error, (in fsolve) invalid arguments

What does “unexpected” mean?

Here are some examples to illustrate such a syntax error.

In this case, it is caused by a typing error; there is an extra right parenthesis after the “2”.

  > fsolve((1-x)/x^2),x);
  `)` unexpected

Removing it fixes the problem.

  > fsolve((1-x)/x^2,x); 

In this case, the problem is that the “:=” has a blank separating the “:” and the “=”.

  > y : = sqrt(4);
  `: =` unexpected

Removing it fixes the problem.

  > y := sqrt(4); 

In this case, the problem is that the variable name “by” is a word reserved by Maple for another meaning.

  > by:=3;
  `:=` unexpected

Here’s a list of such reserved words:

  by do done elif else end fi for from if in local 
  od option options proc quit read save stop then 
  to while

Why doesn’t Maple recognize the standard mathematical function name I gave it?

> y := SQRT(4);
  • use Pi rather than pi to get 3.141etc
  • use exp(1) rather than e to get 2.718etc
  • use I rather than i to get the square root of minus 1

When drawing multiple curves in one plot, Maple always uses a sequence of colors that I would like to change. How is this done?

The global environment variable _COLORRGB determines the colors Maple uses to draw multiple curves in one plot. The variable contains a sequence of six RGB values which are assigned to the curves one after another.

  > restart:
   [1.0, 0., 0.], [0., 1.0, 0.], [1.0, 1.0, 0.], [0., 0., 1.0], [1.0, 0., 1.0], [0., 1.0, 1.0]

These are red (R), green (G), yellow, etc.

The following statement draws 7 horizontal lines indicating the default colors (with the seventh curve, Maple uses the first color again). The RGB values of the colors (names) defined in Maple are included in the `plot/colortable` table. We use this table to define a new sequence of color assignment. At first, let’s abbreviate the table name with macro.

  > macro(ct = `plot/colortable`);




The new color sequence shall be (this time 7 values):

  > L := [blue, red, black, cyan, brown, green, yellow]:

Assigning _COLORRGB:

  > for i in L do
  > _COLORRGB := _COLORRGB, ct[i]
  > od:

The result shows that Maple accepts the new setting.

  > plot([1, 2, 3, 4, 5, 6, 7], x);

Additional help

More on Maple

Research Computing home page