Frequently asked questions
This page deals with questions asked about Maple V Release 4 and 5, Maple 6 and 7.


Suppressing error messages when saving files to libraries

Question: When saving files to a Maple library using the savelib function, each time calling savelib in Maple 6 & 7, I get the following error message:

Answer: This is because Maple tries to find a help data base file (maple.hdb) in the directory containing the library you want to save files to. However, despite these messages, all files are correctly stored to the library.

Either you create a help file, or if you do not want to create an online help, download the following small ZIP file put the maple.hdb dummy file into the directory containing the library you would like to save files to. For example, if the directory is called `e:/maple7/xyz` put the maple.hdb file into directory `e:/maple7/xyz`. Do not copy the dummy maple.hdb file to the main Maple library lib !

Changing the color sequence assigned to multiple curves in one plot in Maple

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

Answer: 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 one after another to the curves. The following works with Maple V Release 4 through Maple 7.

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

> plot([$(1 .. 7)], x);
The RGB values of the colors (names) defined in Maple are included in the `plot/colortable` table.
> eval(`plot/colortable`);

  table([MAGENTA = [1.00000000, 0., 1.00000000], 
        BLACK = [0., 0., 0.], 
        WHEAT = [.84705882, .84705882, .74901961],
        blue = [0., 0., 1.00000000],
        turquoise = [.67843137, .91764706, .91764706],
        SIENNA = [.55686275, .41960784, .13725490],
        NAVY = [.13725490, .13725490, .55686275],
        ORANGE = [.80000000, .19607843, .19607843], 
        grey = %1,
        magenta = [1.00000000, 0., 1.00000000],
        CYAN = [0., 1.00000000, 1.00000000],
        GOLD = [.80000000, .49803922, .19607843],
        BROWN = [.64705882, .16470588, .16470588],
        green = [0., 1.00000000, 0.],
        maroon = [.55686275, .13725490, .41960784],
        plum = [.91764706, .67843137, .91764706],
        CORAL = [1.00000000, .49803922, 0.],
        VIOLET = [.30980392, .18431373, .30980392],
        red = [1.00000000, 0., 0.],
        cyan = [0., 1.00000000, 1.00000000],
        PINK = [.73725490, .56078431, .56078431],
        coral = [1.00000000, .49803922, 0.], gray = %1,
        aquamarine = [.43921569, .85882353, .57647059],
        KHAKI = [.62352941, .62352941, .37254902],
        violet = [.30980392, .18431373, .30980392],
        MAROON = [.55686275, .13725490, .41960784],
        RED = [1.00000000, 0., 0.],
        sienna = [.55686275, .41960784, .13725490], 
        GRAY = %1,
        pink = [1, .752941176, .7960784314],
        wheat = [.84705882, .84705882, .74901961],
        TURQUOISE = [.67843137, .91764706, .91764706],
        tan = [.85882353, .57647059, .43921569],
        YELLOW = [1.00000000, 1.00000000, 0.],
        navy = [.13725490, .13725490, .55686275],
        WHITE = [1.00000000, 1.00000000, 1.00000000],
        GREEN = [0., 1.00000000, 0.], white = [1, 1, 1],
        AQUAMARINE = [.43921569, .85882353, .57647059],
        brown = [.64705882, .16470588, .16470588],
        BLUE = [0., 0., 1.00000000],
        gold = [.80000000, .49803922, .19607843], 
        GREY = %1,
        TAN = [.85882353, .57647059, .43921569],
        khaki = [.62352941, .62352941, .37254902],
        yellow = [1.00000000, 1.00000000, 0.], 
        black = [0, 0, 0],
        PLUM = [.91764706, .67843137, .91764706],
        orange = [.80000000, .19607843, .19607843]

  %1 := [.75294118, .75294118, .75294118]
We use this table to define a new sequence of color assignment. At first, lets 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);

R5 plots not displayed properly on Diamond Viper 770 (NT 4.0)

Question: My Diamond Viper V 770 VGA card (running a Riva TNT2 graphics processor) does not properly display colors and wireframes in 3D plots. Currently I run version 4.00.1381.0401 of the Viper 770 driver.

Answer: If you change the color depth of the Viper V770 card to 256 colors, colors and wireframes are correctly displayed. You can change the depth in real time, without having to restart NT 4.0 at all.

Diamond releases new drivers for its Viper V770 card at:

Fixing the R5.0 array output bug

Question: When defining an array, e.g.
> A:=array(1 .. 2, 1 .. 2, -1 .. 1,
>    [[[1, i] ,[3, 4]], [[5, 6], [7, 8]]]);

A := array(1 .. 2, 1 .. 2, -1 .. 1, [
    (1, 1, -1) = 1
    (1, 1, 0) = i
    (1, 1, 1) = A[1, 1, 1]
    (1, 2, -1) = 3
    (1, 2, 0) = 4
    (1, 2, 1) = A[1, 2, 1]
    (2, 1, -1) = 5
    (2, 1, 0) = 6
    (2, 1, 1) = A[2, 1, 1]
    (2, 2, -1) = 7
    (2, 2, 0) = 8
    (2, 2, 1) = A[2, 2, 1]
and clicking into the above output with a mouse or moving the cursor into that output, Release 5.0 for Windows NT 4.0 and Windows 95 crashes, i.e. terminates immediately with an error. I observed this problem both with the original (November 97) release and also with the EC 1 patch installed.

Answer: The bug has been fixed in Maple V Release 5.1. In Release 5.0, proceed as follows:

Assign value 2 to interface/prettyprint:

> interface(prettyprint=2);
The default is 3 (editable math). This different setting works at least in R5 for NT 4.0. It should also do with Windows 95.

A much more sophisticated solution is fixing the `print/array` function that controls how arrays are output. R5 crashes when browsing through the call to the array function. Joe Riel has written a patch of `print/array` that substitutes the call to `array` with a call to `ARRAY` if interface/prettyprint is set to 3:

See ?interface for information on interface settings, and Maple initialization file for information on how to automatically assign the new default to interface/prettyprint in the Maple initialization file.

Functional operator

Question: Why isn't it possible to define a derivative like this:
> f1 := x -> diff(x^2, x);

Answer: At first this seems to work:

> f1(x);

However, if a numeric expression is passed to f1, Maple returns an error:

> f1(1);
Error, (in f1) wrong number (or type) of parameters in function diff

Internally functional expressions are converted to a procedure:

f1 := proc(x)
   diff(x^2, x)

So if you pass a numeric for x to f1, the parameter x is substituted by that numeric in the body of the procedure:

f1 := proc(2)
   diff(2^2, 2)
Because the second argument to diff now is not an indeterminate (a name), Maple returns an error:
> diff(4, 2);
Error, wrong number (or type) of parameters in function diff

Question: Sometimes, when solving a system of differential equations with several parameters I find it convenient to set the equations up as a function of the parameters. However, if a function has a comma in it the evaluation stops. For example, if

> ic := (a,b,c) -> 1+a, 2+b, 3+c:


> ic(1,1,1);

On the other hand,

> ic := (a,b,c) -> {1+a, 2+b, 3+c};

returns the expected result.

Answer: Because of precedence (see ?precedence), Maple interprets the expression

> ic := (a, b, c) -> 1+a, 2+b, 3+c;
as follows:
> ic := BEGIN
           BEGIN (a, b, c) -> a+1 END , 
           BEGIN b+2 END , 
           BEGIN c+3 END
        END ;
So ic actually is assigned a sequence containing the expressions
(a, b, c) -> a+1   # a functional expression
b + 2              # a term
c + 3              # a term
If called with the arguments (1, 1, 1) Maple does the following:

(1 , 1, 1) -> 1 + 1
2 + b(1, 1, 1)
3 + c(1, 1, 1)
Concerning the terms b + 2 and c + 3 Maple appends the sequence of arguments to the indeterminated b and c which makes sense for b and c can be assigned anonymous functions later during a Maple session. See ?precedence for more information on binding strengths of Maple operators.

Question: Why can't I define a function as follows ?

> f(x) := exp(2*x);

> f(x);
Answer: With the assignment

name(arguments) := expression;

Maple V puts an entry to the remember table of name. Since name is not assigned a procedure yet, Maple V also assigns one to name which just returns the function call to name:

> interface(verboseproc = 3);

> print(f);

If f is called with its argument x Maple V at first searches for an entry to the index x in the remember table of f,

> op(4, eval(f));

and if it finds one the entry (here: exp(2*x)) is returned. If there is no entry in the remember table the procedure body is evaluated.

So at first glance the definition f(x) := exp(2*x) seems to work in the above example. However, if f is called with another argument - say 2 - the function call is returned for the body of f


evaluates to


> f(2);


Question: With non-transcendental functions solve just returns one solution if it finds one.
> restart:

> ans := solve(sin(x), x);

If the environment variable _EnvAllSolutions is set true (default is false), Maple returns a general solution containing the place holders _N, _Z, and/or _B.

> _EnvAllSolutions := true:

> ans := solve(sin(x), x);

Why can't I use subs to replace _Z1 with another expression ?

> subs(_Z1=1, ans);

Answer: If called with trigonometric functions, a help procedure to solve loads the table Invfunc to memory dealing with general solutions of trigonometric expressions. Listed below is the table entry for sin in Invfunc:

sin = proc (x) 
   local _Z1, _B1; 
   option `Copyright (c) 1993 Gaston Gonnet, \
      Wissenschaftliches Rechnen, ETH Zurich. All rights reserved.`; 
   if x = 1 then 
   elif x = -1 then 
   elif x = 0 then 
Since _Z1, _B1 are declared local - and not global - they can not be substituted within the command line mode. Use subs combined with indets and op:
> subs(op(indets(ans))=1, ans);

Question: I defined a polynom,

> restart:

> p :=  a*x^2 + b*x + c;

and assigned x the value 5.

> x := 5;
> p;
If I substitute
> subs(x=3, p);
I get the following result:

Why doesn't Maple change the factor 25 of x2 to 9 ?

Answer: Actually

subs(x=3, p)
subs(5=3, p),
so only the factor 5 to b is substituted with 3 because of Maple's full evaluation rules. [Question taken from Maple User Group, April 1997]

Question: Does subs recognize power rules ?

Answer: No, use algsubs or student/powsubs instead.

> restart:

> p := x^4+x^2+c;
> subs(x^2=u, p);
> algsubs(x^2=u, p);

You can sort this polynom with sort:

> sort(");


Question: Do I have to change the value of Digits if I enter very small or very large numbers ?

Answer: At first, Digits only affects floating-point numbers. Furthermore, Digits only becomes important if Maple calculates with floats.

Internally a floating-point number is represented in Maple V by a pair of two integers, the mantissa and the exponent (see ?float):

mantissa * 10exponent

Digits only affects the mantissa. With the op function you can determine how Maple V converts a float:

> restart:

> Digits := 4:

> z1 := 0.0000125000001;
> op(z1);

125000001 is the mantissa, -13 the exponent. Since both the mantissa and the exponent are integers, there are no limitations to their `length`.

However, if you calculate with a float, the setting of Digits becomes important for all digits following the Digitsth cipher of the float are cut off.

> z1*2;

> op(");

So to avoid inaccuracies when calculating with floating-point numbers, set Digits to a higher value. Note that this slows down numerical computations.

Installing packages

Question: How can I install packages for Maple V ?

Answer: First you have to create a new subdirectory in the Maple directory, e.g. called /syrup if the package is called Syrup. Copy the package usually containing the files maple.ind and maple.lib (and maybe the help data base maple.hdb) into that directory. Do not copy them to /maple/lib ! You would overwrite the main Maple Library and would have to install Maple V again.

Then you have to assign the path to that new subdirectory /syrup to the global variable libname in the Maple session. It is convenient to put the path to the new directory at the beginning of the sequence assigned to libname.

> libname := `e:/maplev4/syrup`, libname;

When a library function is called at the first time Maple V searches all libraries pointed to by libname from left to right. If it finds a library containing the function it loads the latter to memory and stops the search. So if the same function is also included in another library pointed to by libname, it is skipped. This allows one to define patches to main Maple Library functions - the original code of those functions patched is not loaded.

It is helpful to include the assignment

> libname := `path to new subdirectory`, libname;

to the Maple Initialization file in order to load that assigment automatically at start-up or restart of Maple V.

Note: In Maple V Release 4 and 5.X, libname also tells the kernel where to search for help data bases.

Maple initialization file

Question: Can I customize my Maple working environment (load packages, define variables, etc. automatically at startup) ?

Answer: You can put assignments, procedures, packages, macros and anything else that is possible in Maple V into the Maple initialization file (maple.ini in DOS, .mapleinit in Linux) located in the subdirectory /lib (in Linux: home directory) . This initialisation file is - if it exists - automatically loaded at startup or after a restart during a Maple session, so that you do not need to input various statements in order to prepare your Maple session every time.

For example, if you want Maple to load short forms of the functions included in the plots package, assign Digits a changed default value, define a variable called 'h' with h=1e-8 and Euler's constant e (this is important in Maple V Release 4 and 5 where E is no longer predefined), you have to type in:

# the character ` is the so-called back quote (ASCII control code 96)
`plots/init`:=proc() end:  # Enter this line only if you are using Release 3
Also you can abridge Maple commands as follows for use in all worksheets:
In addition text can be displayed during interpretation of the initialization file:
print(`I am a Maple string.`);
`I am a Maple string.`;
Note: In Release 3 you may display text with the Maple command print or by entering a string followed by a semicolon. Also in R3, text generally is not displayed at the very first start of Maple V but after the command restart is entered during a Maple V session thereafter. The display command lprint cannot be used in Release 3 initialization files.

In Release 4 and 5.X you may use the two commands print, lprint and strings to display text during startup. Contrary to Release 3, text is also printed when you start Maple V the first time (i.e. load the Maple program).

Click the following link to see a sample Maple V4/5.X initialization file.

You may even include read statements in the initialization file which reads Maple statements from other Maple text files (like the call command in the DR-DOS/Open DOS/NOVELL DOS 7's batch language). Also you can call other text files from the text file read by the initialization file.

Reference: Joe Riel has written a very useful and interesting documentation on the internals of Maple V: Administering Maple V.

Question: After I have installed the Release 5 Windows EC 1 patch, the Maple initialization file located in the /lib subdirectory is not read automatically any longer.

Answer: This problem has been reported for R5 running in Windows 95 and NT 4.0. There are the following situations:

  1. R5 is started from the program manager (/windows/progman.exe). The working directory must be pointed to the subdirectory where the Maple ini file is located, or: the ini file must be moved to the directory defined as the working directory.
  2. R5 is started from the Windows start menu. Move the ini file to the /bin.wnt directory of the Maple V R5 directory, e.g. /maplev5/bin.wnt or /programs/maplevr5/bin.wnt. This is the default working directory.
After you have made the proper adjustments, the ini file should be read again after startup or a restart. Note that if you assign a new directory to currentdir, even after a restart R5 cannot find the Maple ini file since currentdir is not reset to the original default.


Question: Often when trying to plot graphs of functions I get the error message:

Error, (in plot) invalid arguments


Error, empty plot

Answer: plot needs the name of the domain and if specified the name of the range to be of type name, so there must be no other expression assigned to them other than themselves. These error messages usually occur if the domain or range names carry a numeric value before plot is used, like:

> x := 1:

> plot(sin(x), x=-7 .. 7, -2 .. 2);
Error, (in plot) invalid arguments
Solution: Unassign both the range (and domain) name(s) before you call plot:
> x := 1:

[.... other statements ....]

> x := 'x':

> plot(sin(x), x=-7 .. 7, -2 .. 2);

Plots: Floating Point Overflow

Question: I can't find any answer for an unexpected difficulty: when I try to draw an object [...], I get the message : "Floating Point Overflow. Please shorten axes ". What does this mean, and what can I do about that ?

Answer: The error means that the plot structure that you wanted to draw may contain one or more very large or very small points that cannot be plotted. If, for example, the structure contains a point p with two coordinates x and y, where abs(x) > (very_large) or abs(y) > (very_large) or x = 'undefined' or y = 'undefined', then the error occurs.

User-defined data types

Question: How can I define my own data types in Maple V ?

Answer: That's quite easy. Just assign a procedure that handles the specific type checking to a name with the following syntax:

`type/name of the type`

An example: In Maple V there is no type checking for irrational values.

> `type/irrational` := proc(expr: {algebraic, list, set})   
>    local exprlist, n;
>    if type(expr, {list, set}) then
>       exprlist := expr
>    else
>       exprlist := [expr]
>    fi;
>    for n in exprlist do
>       if not type(n, 'constant') or type(n, float) or 
>          type(n, rational) or type(n, integer) or 
>             has(n, {'I', 'true', 'false', 'FAIL', 'infinity', 'undefined'}) then
>                RETURN(false)
>       fi
>    od;
>    true
> end:
Now the new type can be used immediately:
>type(sqrt(2), irrational);

Printing problems

Question: If I try to print a worksheet containing plots, my Epson Stylus Color prints all lines with plotoption thickness=1 regardless what value for thickness is passed to the plot function. Is there a solution to this problem ?

Answer: This is a bug in Release 4, currently there is no patch available for this problem. There are also problems with text printed in light color: they are not printed to paper, as well.

Background color of R4 help files

Question: How can I change the default background color of R4 help files ?

Answer: Before changing that color, exit Maple V. Then load the file /windows/maplev4.ini or /winnt/maplev4.ini into a text editor and search for the following entry in the [Options] section of that ini file:

HelpBGColor=192 192 192
These three integers define the RGB value of the background color, you can change them according to your preferences, e.g. a white background color can be defined via:
HelpBGColor=255 255 255
Now save the changes and restart Maple V again.

System initialization failure

Question: I could work with Release 4 without any problems. At start-up, suddenly I get the following error message:
System error, system initialization file not found
I use Windows NT 4.0.

Answer: This problem has also been reported with the Windows 95 operating system. The problem is that at startup, Release 4 is unable to assign the path to the main Maple Library located in subdirectory /lib to the global variable libname. The main Maple Library contains a file named sysinit.m that is called during the start-up phase and because libname could not be assigned, the file cannot be found. Why this problem occurs is unknown to me, there does not seem to be any reason, but here is how to solve the problem:

The main Windows directory (in NT 4.0 /winnt) includes a special initialization file called maplev4.ini for the GUI version of Release 4. In the [Options] section of the file, there is an entry "MapleLib=". Add the path to the main Maple Libray to this line. If the library is located in directory e:/maplev4/lib for example, the assignment should look like the this:

Make sure you use single back slashes to separate the directory names. Now R4 should work flawlessly again.


Question: I have been trying to read a function from a Maple library which definitively has been saved to that library. However, when readlibing it, Maple always returns an error:

c:/maplev4/update, e:\maplev4\lib
Error, could not find `utils/entry`

Answer: This behavior occurs in R3, R4, and R5. Here two things are important:

  1. The path to the library from which the function shall be read must be included in libname (this also halts true if you are calling readlib with two arguments, see ?readlib). However, since readlib obviously remembers whether a call to it resulted in an error, you first have to restart Maple before trying to read the function again:
    > restart:
    > libname;
    c:/maplev4/update, e:\maplev4\lib
    > readlib(`utils/entry`);
    Error, could not find `utils/entry` in the library
    > libname := `c:/maplev4/utils`, libname;
    libname := c:/maplev4/utils, c:/maplev4/update, e:\maplev4\lib
    > readlib(`utils/entry`);
    Error, could not find `utils/entry` in the library
    Do not forget to reassign libname after Maple has been restarted. The next statements are successful:
    > restart:
    > libname := `c:/maplev4/utils`, libname;
    libname := c:/maplev4/utils, c:/maplev4/update, e:\maplev4\lib
    > readlib(`utils/entry`);
    proc(a::name, b::name) ... end

  2. If you use readlib with two arguments - the first the name of the function and the second the complete path to the library function -, you have to specify the path to the respective library (second argument) exactly like it is assigned to the environment variable libname. An example:
    > restart:
    > libname := 
    >    `c:/maplev4/utils`, 
    >    `c:/maplev4/update`, 
    >    `c:/maplev4/lib`;
    libname := c:/maplev4/utils, c:/maplev4/update, c:/maplev4/lib
    > readlib(
    >    `utils/entry`, `c:\\maplev4\\utils/utils/entry.m`);
    Error, could not find `utils/entry`
    Here the path to the utils package has been assigned to libname using slashes (`c:/maplev4/utils`), so Maple could not find the function for in the call to readlib, the path to the library function has been given using backslashes (`c:\\maplev4\\utils/utils/entry.m`). This also applies if you are using capital letters in libname and small letters in readlib - or vice versa:
    > restart:
    > libname := 
    >    `C:/maplev4/utils`, 
    >    `c:/maplev4/update`, 
    >    `c:/maplev4/lib`;
    libname := C:/maplev4/utils, c:/maplev4/update, c:/maplev4/lib
    > readlib(
    >    `utils/entry`, `c:/maplev4/utils/utils/entry.m`);
    Error, could not find `utils/entry`

R5 help databases in R4

Question: Whenever I start R4, I get the following error message:

Answer: This error occurs for there is a Release 5 help database in the path(s) assigned to libname. Help databases always have the file name maple.hdb. When libname is assigned a path to a directory that includes a R5 help database, which may also happen at the startup of R4 when reading the initialization file, it searches for keys to be added to the R4 online help system. Because R5 help databases - and R5 libraries - are incompatible to R4, the error occurs.

I cannot start R3 in NT 4.0

Question: Since I changed to a new PC with an Intel Pentium III 450 MHz CPU and 128 MBytes of RAM, I cannot start start R3 in Windows NT 4.0/SP 3 any longer. I get the following error message:

`Division by zero or overflow`.

I tried to start R3 via the old program manager, the start/run menu of the NT task bar and also via the DOS shell.

Answer: At first I thought that the 128 MBytes RAM were the culprit. It turned out that quite obviously the PC is too fast for R3. This only matters during the startup phase of R3, after that I have not yet found any problems.

Andre Poenitz, TU Chemnitz, could provide an answer to why R3 does not start: `... As far as I can remember, the culprit is a loop that on fast CPUs is run in zero time units, and a successive division by these zero units.`

During startup of R3, the PC must be slowed down by running another application that keeps the CPU quite busy. So I wrote two DOS batch files that initiate a process, e.g. a do od-loop in R5 for some seconds and after one or two seconds - while the do od-loop is still running - start R3 through another process. Start this workaround by executing the r3.bat batch file in a shell, the program manager, or by a link on the desktop.

-------- begin r3.bat --------------------------------------------

rem start a separate process and run a do od loop in R5 for
rem some seconds
start r3-2.bat
rem call the QBASIC program sleep.bas that waits for one second
rem (it does not keep CPU busy, so it cannot be used instead 
rem of the do od-loop). This makes sure that R3 is started while 
rem the do od-loop is already running.
qbasic /run c:\tools\batch\sleep.bas
rem start R3
start /b c:\maplev3\bin\wmaple53.exe

-------- end r3.bat ----------------------------------------------

-------- begin r3-2.bat ------------------------------------------

rem runs R5 command line version with a do od loop and exits 
rem thereafter
e:\maplev5\bin.wnt\cmaple -b e:\maplev5\lib -c"to 2000000 do od:" -cquit

-------- end r3-2.bat --------------------------------------------

-------- begin sleep.bas -----------------------------------------


-------- end sleep.bas -------------------------------------------
You may need to adapt the stop value of the do od-loop and the sleep period (see r3.bat file) to the characteristics of your PC.

This works in 90+ percent at the first attempt to start R3.

back E-mail

Author: Alexander F. Walz,
Original file location: