Programming and Connectivity - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : System : Information : Updates : Maple 14 : Programming and Connectivity

Programming and Connectivity Changes in Maple 14

Maple 14 includes the following enhancements to programming facilities and connectivity to other tools.

 

Maple Toolbox included with Maple

Maple-NAG® Connector

Array of Bytes

Data Compression

Benchmarking

ListTools

Importing and Exporting MATLAB® Matrices

ExcelTools For Command-line Maple

In-place Substitution

Better Support for Anonymous Procedures

Task Programming Model

Task Model in External Call

RunWorksheet

Maple Toolbox included with Maple

• 

The Maple Toolbox for is now included with Maple. For detailed information about installation of the Maple Toolbox, see the Maple 14 Install.html file.

Maple-NAG® Connector

• 

The Maple-NAG® Connector is now included with Maple.  Users of the NAG library can now access the full functionality of the NAG C library from within Maple.  For detailed information about installation of the Maple-NAG Connector, see the Maple 14 Install.html file.

Array of Bytes

• 

The ArrayTools[Alias] command was extended to allow aliasing an array with a different datatype than the original.  This can be useful in conjunction with readbytes when reading mixed format binary files.  For example, readbytes can be used to load a file into a integer[1] byte Array.  Then, after determining that the first 100 bytes constitute the file's header, the remaining bytes can be aliased as an array of double precision (float[8]) floating-point numbers.  

Data Compression

• 

The StringTools package contains two new commands for data compression, Compress and Uncompress.  These apply zlib compression and expansion of sets of data including strings and byte arrays.

Benchmarking

• 

The CodeTools package contains the new command Usage which can be used to measure the time and memory usage resulting from an command execution similar to time but with much more flexible output control.

with(CodeTools):

Usage(ifactor(32!+1));

memory used=10.07MiB, alloc change=35.01MiB, cpu time=93.00ms, real time=93.00ms, gc time=4.92ms

6114608365293128894190494740737772281

(1)

Usage(ifactor(33!+1),output='all');

Recordrealtime=0.184,cputime=0.245,gctime=0.1314250000,gcrealtime=0.07033491135,bytesused=16371960,bytesalloc=39845888,output=6714344652917543310100271674873811150989

(2)
• 

CodeTools[CPUTime] and CodeTools[RealTime] can be used as shortcuts for calling Usage with options output=[cputime,output] and output=[realtime,output] respectively.

CPUTime(ifactor(34!+1));

0.001,437959382058720595819107578352969167411

(3)

ListTools

• 

The ListTools package contains the new commands FindMaximalElement, FindMinimalElement, SelectFirst, and SelectLast.  These are efficient implementations of common list manipulation tasks.

with(ListTools):

SelectFirst(type, [1., 1/2, 1, 5.1, 2, 11], integer);

1

(4)

FindMaximalElement([[1,a,4],[2,b,3],[3,c,2],[4,a,1]], (x,y)->lexorder(x[2],y[2]));

3,c,2

(5)

Importing and Exporting MATLAB® Matrices

• 

The ImportMatrix and ExportMatrix commands have been updated so that they can import and export MATLAB® binary files. MATLAB® Version 6 files without data compression or MATLAB® Version 7 files with compression are supported.

ExcelTools For Command-line Maple

• 

You can now import data from an Excel spreadsheet or export rtable data to an Excel spreadsheet while working in the command-line Maple environment, without having to run the Standard Worksheet interface. For more information on using the ExcelTools package, see ExcelTools.

In-place Substitution

• 

The subs command can now perform substitutions in-place in Arrays, Matrices, and Vectors. This functionality is specified by appending inplace as an index to the command name.

A := <w,x;y,z>;

Awxyz

(6)

subs[inplace](x=Pi,A);

wπyz

(7)

A;

wπyz

(8)

Better Support for Anonymous Procedures

• 

A new special parameter, thisproc, is available within procedures to facilitate recursive calling. Unlike procname, which refers to the name of the currently executing procedure, thisproc refers to the procedure itself, and thus can be used to make a recursive call within an anonymous procedure.

• 

A new procedure option, option procname, causes a procedure to inherit the name of the procedure that called it for the purposes of error reporting. Thus, an exception raised in an inner procedure can be made to appear to have occurred in the enclosing procedure.

Task Programming Model

• 

A new function has been added to the Task Programming Model.  The Return function allows a Task to stop the execution of the Task Model and return a particular value from Start.

Task Model in External Call

• 

We have added functions to the External Call API to allow external code to access the Task Programming Model.  Four new functions are available: MapleStartRootTask, MapleCreateContinuationTask, MapleStartChildTask, and MapleTaskReturn.

RunWorksheet

• 

A new command, RunWorksheet, has been added to the DocumentTools package.  This command executes a worksheet as if it were a procedure.  The worksheet must be saved on disk, and there is a mechanism for passing arguments.  The worksheet runs headless (no user interface) and modally (control does not return to the invoking worksheet until the called worksheet completes). It also runs in its own kernel.

• 

For Maple 14, this function should be considered experimental; its design may change in a future release.

See Also

Index of New Maple 14 Features

Language and System Updates in Maple 14