Any number of Maple procedures, modules and other data can be stored together to form a library.
Maple libraries are stored either as a single .mla file or in a collection of two files (with the filename extensions .lib and .ind). The single file (for example, MyLib.mla) or two files (for example, MyLib.lib and MyLib.ind) are called a repository. The term library and the more accurate term repository are sometimes used interchangeably.
There can be more than one repository in a single directory.
The .lib file is where most of the data associated with a repository is stored. The .ind file is an index file that Maple uses to locate items in the repository. An .mla file combines both the index and data. The first 1024 bytes of a .lib or .mla file is the header that Maple uses to store repository attributes such as READONLY/WRITABLE mode and lookup priority (see march). This header also maintains other information such as unique numeric identifier for anonymous members and top-level names in the repository (see below). If using a .lib and .ind repository, both files must be present for Maple to use the repository.
To make a repository accessible to Maple, ensure that the directory in which it resides, or the full path and .lib or .mla filename are included in the global variable libname. This can be done by setting its value explicitly within Maple, or via the -b directory command-line option supported by batch-oriented user interfaces. The contents of a repository are automatically assigned once it is referred to by libname.
A repository consists of any number of data objects called members. Each member is a Maple expression encoded in a compact and email safe internal format. The internal format is not publicly documented and may change between releases of the Maple software.
A Maple repository can be manipulated in various ways by using the built-in march command. Using march, you can create and list a repository, compact it or re-index it. For details on how these operations are performed, see march.
Once you have created a repository, you can add new members to it by assigning the expression to be saved to a name, and then calling the procedure savelib with the names to be saved as arguments. The names under which the expressions are saved are used to identify the expressions in the repository. Saving an expression to a repository may involve the creation of other, anonymous repository members as well.
This example illustrates some typical manipulations of repositories in Maple.
Make a temporary workspace.
Define a utility to print an abbreviated repository listing.
Create an empty repository.
Create an expression to be stored in our empty repository. A typical Maple package has a structure similar to, but is much larger than this. (In practice, its definition is read from a source file, not entered inline.)
m ≔ module_export⁡a,b;a ≔ x→x^2;b ≔ x→x^3end module:
Ensure that savelib places m in the correct repository.
The listing of the repository now shows that the repository contains not only m, but also two anonymous members that have been given the numeric references 1 and 2.
The header of the maple.mla file contains the next available numeric identifier for the repository and is updated whenever something is saved to the repository that has no global name.
u := proc() local L; proc(x) L - x end end():
Download Help Document
What kind of issue would you like to report? (Optional)