The Maple Command and Command-line Options - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : System : External Functions : maple

The Maple Command and Command-line Options

Calling Sequence

maple -a -A assertLevel -B -b libname -binary operatingSystemName -c mapleCommand -cw -D macroDef -e errorBreak -F -f file -h -I includePath -i initFile -km kernelMode -L logFile -l latexOption -nocloud -P -q -s -T resourceLimit -t -U macroName -u -w warnLevel -x -z --setsort=orderNumber --historyfile=histFile --historysize=histSize --secure-read=speclist --secure-noread=speclist --secure-write=speclist --secure-nowrite=speclist --secure-extcall=speclist --secure-noextcall=speclist --secure-readspec=filelist --secure-writespec=filelist --secure-extcallspec=filelist --secure-syscall=flag --secure-mode=flag --init-reserve-mem=memorysize --init-commit-mem=memorysize file

Description

• 

Maple has the ability to algebraically manipulate unbounded integers, exact rational numbers, real numbers (with arbitrary precision), symbolic formulas, polynomials, sets, lists, equations, arrays, vectors, and matrices. It can solve systems of equations and differentiate and integrate expressions.

Examples

• 

In the following examples, the Maple output is displayed below the corresponding input expressions.

p := x^2 - x - 2;

p:=x2x2

(1)

q := (x+1) ^ 2;

q:=x+12

(2)

s := p/q;

s:=x2x2x+12

(3)
  

Differentiate with respect to x.

diff(s,x);

2x1x+122x2x2x+13

(4)

normal(s);

x2x+1

(5)

x := 3^50;

x:=717897987691852588770249

(6)
  

Re-evaluate s with a value substituted for x.

s;

717897987691852588770247717897987691852588770250

(7)
  

Re-evaluate to a 40-digit floating point approximation.

evalf[40](s);

0.9999999999999999999999958211332927043850

(8)
  

Compute an indefinite integral.

int(1/(y^4+1),y);

142arctany21+182lny2+y2+1y2y2+1+142arctany2+1

(9)

Maple Interfaces

• 

The name of the command that invokes Maple depends on your operating system and chosen interface, worksheet (graphical user interface) or command line (character-based interface).

• 

Maple provides users with two worksheet interfaces. Both have access to the full mathematical engine of Maple.

  

By default, worksheets open in the enhanced and more modern Standard Worksheet. The Classic Worksheet, available on 32-bit Windows and 32-bit Linux platforms, has the traditional Maple worksheet look and uses less memory.  Changing the Maple worksheet file association can be performed through your operating system.

  

If your system has less than the recommended amount of physical memory, it is suggested that you use the Classic Worksheet version of Maple.

  

In UNIX, use the maple command to start the Command-line version (that is, UNIX shell interface), the xmaple command to start the Standard Worksheet version (X Windows), or the maple -cw command to start the Classic Worksheet version (X Windows).

  

In Windows, use the cmaple command to start the Command-line version (that is, DOS console mode), the maplew command to start the Standard Worksheet version, or the cwmaple command to start the Classic Worksheet version. The Standard Worksheet version is set up as an icon on your desktop during Maple installation.  You can also access all versions in the Start menu.

  

On the Macintosh, use the maple command to start the Command-line version or the xmaple command to start the Standard Worksheet version. The Classic Worksheet version is not available on the Macintosh.

• 

In Maple, expressions are entered and read from an input region. To display results in an output region, press the Enter key while the cursor is in the input region.

Options

• 

The -a (assertion) option tells Maple to check all assertions.  This is equivalent to specifying kernelopts(assertlevel=1) at the beginning of the session.

• 

The -A (Assertion level) option sets the degree of assertion checking. The -A option must be followed by the integer 0, 1, or 2. This is equivalent to specifying kernelopts(assertlevel=N), where N is 0, 1, or 2, at the beginning of the session.

• 

The -B option tells Maple that the default system and toolbox libraries should be added to the 'libname' variable used to specify where Maple looks for code repositories.  By default -B is implicitly specified.  It is most commonly used in addition to -b to append to or rearrange the library search order.

• 

The -b (library) option tells Maple that the following argument specifies the pathname of the directory that contains Maple libraries or the full path of the .lib or .mla file of a single Maple library. This initializes the Maple variable 'libname'. By default, 'libname' is initialized with the pathname of the main Maple library (for example, /usr/local/maple/lib) as well as your current directory. Some sites customize the maple shell script to redefine the library pathname. For example,

maple -b /usr/public/waterloo/maple/lib $*

  

More than one -b option can be specified. When several -b options are used, the first -b option overrides the default 'libname' setting, and subsequent -b options are appended to 'libname', forming a Maple expression sequence of directory names.  The -B option can be used to avoid overriding Maple system and toolbox libraries.

• 

On a machine whose operating system supports more than one runtime of Maple, the -binary option allows one to override the automatic platform detection and to specify the platform.

• 

The -c (execute command) option specifies a command that Maple is to execute on startup. It is only valid for Command-line versions of Maple. The command can be any valid Maple command, but it cannot contain blank characters. Multiple -c options can be specified.  Commands specified by -c options, and files specified by -i options, are executed in the order in which they are specified, after the initialization files have been read. Note: These commands are also reexecuted after a restart command. See restart.

• 

The -cw (classic worksheet) option runs the Classic Worksheet X Window version on supported UNIX platforms, instead of the default Command-line version or Standard Worksheet X Window version (launched with the maple -x or xmaple command). The Classic Worksheet provides a basic worksheet environment for older computers with limited memory.

• 

The -D (Define) option is used to predefine a macro for the Maple preprocessor (see $define). The -D option can be followed by a symbol, or a symbol, equal sign, and the definition of the symbol. Multiple -D options can be used to define multiple symbols.

• 

The -e (break on error) option tells Maple what to do when an error is encountered while reading a file. -e0 tells Maple to report the error and keep reading the file. -e1 (the default) tells Maple to stop reading the file (and to skip to the end) when a syntax error is encountered. -e2 tells Maple to stop reading and to skip to the end when any type of error is encountered. This behavior can also be changed in Maple by using the command interface(errorbreak = n) where n is 0, 1, or 2.

• 

The -F (no Filter) option prevents Maple from exiting when the standard input has been redirected from a file, and the end of the file is encountered. By default, Maple exits. If -F is specified, Maple instead continues interactively at that point.

• 

The -f (license file) option tells Maple to use the specified license file instead of the default one.

• 

The -h (help) option tells Maple to open the GUI help browser.

• 

The --historyfile option instructs Maple to use the specified file for persistent command-line history.  If the value "none" is given, then persistent history is disabled. The default history file is .maple_history in the user home directory.

• 

The --historysize option instructs Maple to retain the specified number of lines of command-line history.

• 

The -I (Include) option specifies directories to be searched for files specified in $include directives. Multiple directories can be specified, separated by commas. Alternatively, multiple -I options can be used to specify multiple directories.

• 

The -i (initialization file) option specifies additional files to be read after the standard Maple initialization files. It is valid only for the Command-line interface. Multiple -i options can be specified. Files specified by -i options, and commands specified by -c options, are executed in the order in which they are specified, after the normal initialization files have been read. If security is enabled, files specified by -i are automatically added to the list of readable files.

• 

The --init-reserve-mem option allows the size of the virtual memory map that Maple creates on start up to be specified.  This is also the maximum amount of memory that the Maple session will be able to use.  By default Maple creates a map slightly smaller than the amount of physical memory available on the machine.  By using this option that size can be changed.  By specifying an amount larger that physical memory, Maple will use swap space if necessary.  If --init-reserve-mem is given and a data limit is specified using the -T option.  The -T data limit will override the value specified using --init-reserve-mem.

• 

The --init-commit-mem option allows the size of the memory Maple allocates on start up to be specified.  This option can be used if Maple is executing a problem that is known to require a large amount of physical memory.  Instead of Maple growing its committed memory to that size, this option will force Maple to allocate the specified amount on start up.

• 

The -km p (or parallel kernel mode) option, which applies only to worksheet versions of Maple, is used to start Maple in the parallel server kernel mode. The parallel server mode enables each worksheet in a given Maple session to be independent of other worksheets. By default, the Standard GUI runs in parallel kernel mode, while the Classic GUI runs in single kernel mode.

• 

The -km q (or query (or mixed) kernel mode) option, which applies only to worksheet versions of Maple, is used to start Maple in the mixed server kernel mode. In the mixed server mode, for each worksheet in a Maple session, you can select whether it uses a (new) parallel kernel (that is, it is independent of other worksheets) or shares a kernel with one or more other worksheets.

• 

The -km s (or single kernel mode) option, which applies only to worksheet versions of Maple, is used to start Maple in the single server kernel mode. For example, if you assign a value to a variable in one worksheet, all other worksheets in the current session are affected by this new definition.

• 

The -L (Log file) option is used to create a log of all the library objects that are loaded in a Maple session. This is useful if you have developed a library of Maple routines, and want to determine which ones are actually used. As each object is loaded, its name is recorded in the specified log file. This file is not closed until the Maple session exits.

• 

The -l (latex) option causes Maple to run in LaTeX filter mode. This is useful in the production of books using (or about) Maple. The -l option is specified by a suboption specific to LaTeX filter mode. Multiple -l options can be used to introduce multiple suboptions. For more details, see latex_filter.

• 

The -nocloud option starts Maple without the MapleCloud palette. When this option is set, it is not possible to receive documents shared using the MapleCloud Document Exchange. This option can only be used in the standard GUI interface.

• 

The -P (Parse only) option causes Maple to read input, but not evaluate any expressions. This can be used to quickly check a file of Maple commands for syntax errors, and should be used in conjunction with -e0 so that Maple does not stop when an error is encountered. It is also useful in conjunction with the Maple preprocessor (see $include) to preview the preprocessing operations without actual execution.

• 

The -q (quiet) option suppresses the printing of the Maple startup message, various informational messages (bytes used messages and garbage collection messages), and the signoff message. Maple is better suited for use as a filter when these messages are suppressed.

• 

The -s (suppress initialization) option causes Maple to forgo reading initialization files when initiating a session.

• 

The --secure-read option adds the given file specifications to the inclusion list for readable files.  For more details see the EngineSecurity,CLIConfig help page.

• 

The --secure-noread option adds the given file specifications to the exclusion list for readable files.  For more details see the EngineSecurity,CLIConfig help page.

• 

The --secure-write option adds the given file specifications to the inclusion list for writable files.  For more details see the EngineSecurity,CLIConfig help page.

• 

The --secure-nowrite option adds the given file specifications to the exclusion list for writable files.  For more details see the EngineSecurity,CLIConfig help page.

• 

The --secure-extcall option adds the given file specifications to the inclusion list for loadable external libraries.  For more details see the EngineSecurity,CLIConfig help page.

• 

The --secure-noextcall option adds the given file specifications to the exclusion list for loadable external libraries.  For more details see the EngineSecurity,CLIConfig help page.

• 

The --secure-readspec option instructs Maple to read specifications for readable files from the given list.  For more details see the EngineSecurity,CLIConfig help page.

• 

The --secure-writespec option instructs Maple to read specifications for writable files from the given list.  For more details see the EngineSecurity,CLIConfig help page.

• 

The --secure-extcallspec option instructs Maple to read specifications for loadable external libraries from the given list.  For more details see the EngineSecurity,CLIConfig help page.

• 

The --secure-syscall option enables (or disables -- according to the flag) calls to the system, if security is enabled.  For more details see the EngineSecurity,CLIConfig help page.

• 

The --secure-mode option enables (or disables -- according to the flag) security in Maple. For more details see the EngineSecurity,CLIConfig help page.

• 

The --setsort=orderNumber option changes the sort order for Maple sets.  Specifying --setsort=0 causes sets to be ordered by the addresses of the underlying data structures contained in the set as was the only ordering prior to Maple 12.  The current default --setsort=1 is based on a "nice" mix of the size, id, and value of the data structures contained in the set.  Other values from --setsort=2 through --setsort=8 are variations of the default and can be used to purposefully introduce ordering differences into your code to test its robustness. This option can only be set at startup as different orderings cannot be mixed in the same session.  For more detail on the default ordering, see set.

• 

The -T (resource limiT) option is used to limit the amount of system resources that Maple can consume before execution is terminated. This option takes four parameters, separated by commas. The CPU time limit parameter specifies the maximum number of seconds of CPU time that the Maple process is to use. The data limit restricts the amount of memory, in kiloBytes, that Maple can use. The stack limit sets the maximum stack size, in kiloBytes. The core dump limit specifies the maximum size of core file that can be produced in the unlikely event of a core dump. You can specify any prefix of the four parameters, and omit the rest (for example, specify only the CPU and data limits).

• 

The -t (test mode) option causes Maple to change its configuration to one suitable for running the Maple test suite. Specifically, the prompt is changed to "#-->", prettyprinting is disabled, and all but the last "bytes used" messages are suppressed. The final "bytes used" message is printed to stderr. This option is not normally needed by Maple users.

• 

The -U (Undefine) option is used to undefine a Maple preprocessor macro (see $undef) that was defined earlier on the command line by a -D option. The -U option must be followed by the symbol to undefine. Multiple -U options can be used to undefine multiple symbols.

• 

The -u (UNIX line endings) option forces non-UNIX versions of Maple to produce UNIX line endings on the standard output stream. This is generally only of use if you are using the Command-line version of Maple in conjunction with UNIX-like tools under Microsoft Windows.

• 

The -w (warning level) option specifies whether Maple should print certain warnings.  -w 0 turns off warnings. -w 1 enables library-generated warnings.  -w 2 enables library- and kernel-generated warnings.  -w 3 (the default) enables library-, kernel-, and parser-generated warnings.  -w 4 enables all warnings, that is library-, kernel-, parser-generated, and compatibility warnings.

• 

The -x option runs the Standard Worksheet X Window version on UNIX platforms and the Standard Worksheet version on Macintosh platforms, instead of the default Command-line version. The xmaple command is equivalent to the maple -x command.

• 

The -z option starts Maple with the default security settings enabled.  For more details see the EngineSecurity,CLIConfig help page.

• 

If a file is specified on the command line after the last option, that file is read by Maple. For the Command-line interface, the file must be a text file of valid Maple commands. For worksheet versions, the file must be a Maple worksheet file.

Return Values

• 

On exit, the Command-line version of Maple returns a return-code to the operating system. When invoked from a UNIX or Windows shell script, this return code can be tested to determine why Maple exited. The possible return codes are:

• 

0 - Maple exited normally, as a result of reaching the end of a Maple script if one was specified on the command line, or by executing a quit, done, or stop command.

• 

1 - An error occurred during initialization, and Maple was unable to properly start up.

• 

2 - A script specified on the command line (possibly by redirecting the standard input stream) ended prematurely. Usually this indicates a missing closing delimiter in the script, such as a parenthesis or an end keyword.

• 

3 - After successfully reading a script specified on the command line, Maple failed to re-open the standard input stream for interactive input. This can happen only if the -F option was specified.

• 

4 - While processing a script specified on the command line, an error was encountered. The severity of the error required to cause Maple to exit (instead of attempting to carry on) depends on the setting of interfaceerrorbreak. A setting of 1 will stop only on syntax errors. A setting of 2 will stop on any error.

• 

5 - The Maple kernel has unexpectedly terminated while executing a script or being used interactively.

• 

n - Any other return value can only occur if Maple executes a quitn, donen, or stopn function call, passing n as the desired return code. Typically (but depending on the underlying operating system and shell), any value in the range 0 to 127 is permitted. It is a good idea to avoid values 1 through 5 since they already have predefined meanings as described above.

Initialization Files

• 

Any number of statements can be placed in the initialization files. The effect is identical to that of entering statements in a Maple session.  Once all the statements in the initialization files are executed, the prompt appears and the Maple session begins.  It is recommended that all statements in the initialization files terminate with a colon (:) rather than a semicolon (;) to prevent any display.

• 

For information about initialization files on various operating systems, see the Create Maple Initialization File help page.

• 

Additional initialization files can be specified explicitly using the -i option as described earlier.

• 

The -s option suppresses the reading of all initialization files, including those specified by -i options.

System Environment Variables

• 

Under UNIX, Maple uses several system environment variables.  These  are generally  set  by  the  maple  script, so the user need not worry about them.

• 

The  MAPLE  variable  specifies  where  to  find  the  Maple library and help files, the help browser index, and various configuration files. If the  MAPLE  variable  is undefined, Maple uses "/usr/local/maple" as the default.

• 

The HOME variable is  used  to  identify  where  the  user's .mapleinit file is located.

• 

The PATH variable is used to locate auxiliary programs, such as the plot driver.

For Help

• 

For help with Maple commands and features, the Maple help system is the most comprehensive reference. Enter ?help at the Maple prompt for more information.

• 

Graphical versions of Maple also have a thoroughly indexed and searchable help system, letting you quickly find help pages of interest.

• 

If you have a question that you think is of a very  specific nature  and  not  of interest to others, send a message to your site  license  technical  administrator  (if your  site  has a site license).

• 

If your site does not have a site license, visit http://www.maplesoft.com/support.

See Also

colon, file, libname


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam