Programming and Connectivity - Maple Help

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

 • 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.14MiB, alloc change=35.01MiB, cpu time=143.00ms, real time=143.00ms, gc time=9.35ms
 $\left({61146083}\right){}\left({652931}\right){}\left({2889419049474073777}\right){}\left({2281}\right)$ (1)
 > Usage(ifactor(33!+1),output='all');
 ${\mathrm{Record}}{}\left({\mathrm{realtime}}{=}{0.193}{,}{\mathrm{cputime}}{=}{0.193}{,}{\mathrm{gctime}}{=}{0.06415700000}{,}{\mathrm{gcrealtime}}{=}{0.06424999237}{,}{\mathrm{bytesused}}{=}{7405784}{,}{\mathrm{bytesalloc}}{=}{-3153920}{,}{\mathrm{output}}{=}\left({67}\right){}\left({143446529}\right){}\left({175433}\right){}\left({101002716748738111}\right){}\left({50989}\right)\right)$ (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.002}{,}\left({4379593820587205958191075783529691}\right){}\left({67411}\right)$ (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]));
 $\left[{3}{,}{c}{,}{2}\right]$ (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 := ;
 ${A}{≔}\left[\begin{array}{cc}{w}& {x}\\ {y}& {z}\end{array}\right]$ (6)
 > subs[inplace](x=Pi,A);
 $\left[\begin{array}{cc}{w}& {\mathrm{\pi }}\\ {y}& {z}\end{array}\right]$ (7)
 > A;
 $\left[\begin{array}{cc}{w}& {\mathrm{\pi }}\\ {y}& {z}\end{array}\right]$ (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.