Other Improvements in Maple 15 - Maple Programming Help

Other Improvements in Maple 15

Introduction

Maple 15 includes additional enhancements for in the core areas of mathematics and Maple programming, and more support for application areas from physics to control design.  These improvements include:

 • The introduction of Bell polynomials
 • A new package for computing with magmas
 • Improvements to the DynamicSystems package
 • New commands for working with Arrays and other data structures
 • Improvements to the Maple debugger
 • A new Maple Programming Guide

The Bell polynomials

 • New in Maple 15, BellB, IncompleteBellB and CompleteBellB respectively represent the Bell polynomials, the incomplete Bell polynomials - also called Bell polynomials of the second kind - and the complete Bell polynomials. The BellB polynomials are defined in terms of the Stirling numbers of the second kind as

$\mathrm{BellB}\left(n,z\right)={\sum }_{k=0}^{n}\mathrm{Stirling2}\left(n,k\right){z}^{k}$

 • For the definition of the IncompleteBellB polynomials see IncompleteBellB. The CompleteBellB polynomials are in turn defined in terms of the IncompleteBellB polynomials as

$\mathrm{CompleteBellB}\left(n,{z}_{1},{z}_{2},\mathrm{...},{z}_{n}\right)={\sum }_{k=1}^{n}\mathrm{IncompleteBellB}\left(n,k,{z}_{1},{z}_{2},\mathrm{...},{z}_{n-k+1}\right)$

 • The Bell polynomials appear in various applications, including for instance Faà di Bruno's formula

$\frac{{ⅆ}^{n}}{ⅆ{x}^{n}}f\left(g\left(x\right)\right)=\sum _{k=0}^{n}{f}^{\left(k\right)}\left(g\left(x\right)\right)\mathrm{IncompleteBellB}\left(n,k,g\prime \left(x\right),g\prime \prime \left(x\right),\mathrm{...},{g}^{\left(n-k+1\right)}\left(x\right)\right)$

 where ${f}^{\left(k\right)}\left(g\left(x\right)\right)$ represents the ${k}^{\mathrm{th}}$ derivative of $f\left(x\right)$ evaluated at $g\left(x\right)$; the exponential of a formal power series

$ⅇ{}^{\sum _{n=1}^{\mathrm{\infty }}\frac{{a}_{n}{z}^{n}}{n!}}=\sum _{n=0}^{\mathrm{\infty }}{z}^{n}\mathrm{CompleteBellB}\left(n,{a}_{1},\mathrm{...},{a}_{n}\right)$

 and as coefficients in the following exponential generating function

${ⅇ}^{\left({ⅇ}^{t}-1\right)z}=\sum _{n=0}^{\mathrm{\infty }}\frac{\mathrm{BellB}\left(n,z\right){t}^{n}}{n!}$

 Examples
 > BellB(n, z) = sum(Stirling2(n, k)*z^k, k=0..n);
 ${\mathrm{BellB}}{}\left({n}{,}{z}\right){=}{\sum }_{{k}{=}{0}}^{{n}}{}{\mathrm{Stirling2}}{}\left({n}{,}{k}\right){}{{z}}^{{k}}$ (1)
 > eval((1), n = 4);
 ${{z}}^{{4}}{+}{6}{}{{z}}^{{3}}{+}{7}{}{{z}}^{{2}}{+}{z}{=}{{z}}^{{4}}{+}{6}{}{{z}}^{{3}}{+}{7}{}{{z}}^{{2}}{+}{z}$ (2)
 • For illustration purposes consider the generic sequence of five variables ${z}_{j}$
 > Z := z[1], z[2], z[3], z[4], z[5];
 ${Z}{≔}{{z}}_{{1}}{,}{{z}}_{{2}}{,}{{z}}_{{3}}{,}{{z}}_{{4}}{,}{{z}}_{{5}}$ (3)
 > IncompleteBellB(4, 2, Z);
 ${4}{}{{z}}_{{1}}{}{{z}}_{{3}}{+}{3}{}{{z}}_{{2}}^{{2}}$ (4)
 > IncompleteBellB(5, 3, Z);
 ${10}{}{{z}}_{{1}}^{{2}}{}{{z}}_{{3}}{+}{15}{}{{z}}_{{1}}{}{{z}}_{{2}}^{{2}}$ (5)
 • These are the first 5 elements of the convolution operation involved in the computation above, proportional to the 5th element of this following sequence (see IncompleteBellB)
 > IncompleteBellB:-DiamondConvolution(5, 3, [Z]);
 ${0}{,}{0}{,}{6}{}{{z}}_{{1}}^{{3}}{,}{36}{}{{z}}_{{1}}^{{2}}{}{{z}}_{{2}}{,}{60}{}{{z}}_{{1}}^{{2}}{}{{z}}_{{3}}{+}{90}{}{{z}}_{{1}}{}{{z}}_{{2}}^{{2}}$ (6)
 • At ${z}_{j}=1$ for all $j$, the following identity holds
 > IncompleteBellB(n, k, 1, 1, 1, 1, 1, 1, 1) = Stirling2(n, k);
 ${\mathrm{IncompleteBellB}}{}\left({n}{,}{k}{,}{1}{,}{1}{,}{1}{,}{1}{,}{1}{,}{1}{,}{1}\right){=}{\mathrm{Stirling2}}{}\left({n}{,}{k}\right)$ (7)
 > eval((7), {n=7, k=4});
 ${350}{=}{350}$ (8)
 • For ${z}_{j}=j!$ for all $j=1..n-k+1$, the following identity, here expressed in terms of the inert form %IncompleteBellB and the inert sequence %seq, holds
 > %IncompleteBellB(n, k, %seq(j!, j=1..(n-k+1))) = binomial(n,k)*binomial(n-1,k-1)*(n-k)!;
 ${?}{=}\left(\genfrac{}{}{0}{}{{n}}{{k}}\right){}\left(\genfrac{}{}{0}{}{{n}{-}{1}}{{k}{-}{1}}\right){}\left({n}{-}{k}\right){!}$ (9)
 > eval((9), {n=8, k=3, %seq = seq});
 ${?}{=}{141120}$ (10)
 > value((10));
 ${141120}{=}{141120}$ (11)
 • The value of $\mathrm{CompleteBellB}\left(5,Z\right)$ is obtained by adding the values of $\mathrm{IncompleteBellB}\left(5,k,Z\right)$ for $k=1..5$ as explained in the CompleteBellB
 > CompleteBellB(5, Z);
 ${{z}}_{{1}}^{{5}}{+}{10}{}{{z}}_{{1}}^{{3}}{}{{z}}_{{2}}{+}{10}{}{{z}}_{{1}}^{{2}}{}{{z}}_{{3}}{+}{15}{}{{z}}_{{1}}{}{{z}}_{{2}}^{{2}}{+}{5}{}{{z}}_{{1}}{}{{z}}_{{4}}{+}{10}{}{{z}}_{{2}}{}{{z}}_{{3}}{+}{{z}}_{{5}}$ (12)

Magma

 • The new Magma package was added to allow you to manipulate small magmas represented by their Cayley tables.  The package supports enumeration of small magmas, isomorphism testing, and a selection of predicates that permit you to determine properties of small magmas.
 > with( Magma ):
 > Enumerate( 4, 'quandle' ); # count quandles of order 4
 ${7}$ (13)
 > L := Enumerate( 2, 'output' = 'list' ); # list all isomorphism class of 2-element magmas
 ${L}{≔}\left[\left[\begin{array}{cc}{1}& {1}\\ {1}& {1}\end{array}\right]{,}\left[\begin{array}{cc}{1}& {1}\\ {1}& {2}\end{array}\right]{,}\left[\begin{array}{cc}{1}& {1}\\ {2}& {1}\end{array}\right]{,}\left[\begin{array}{cc}{1}& {1}\\ {2}& {2}\end{array}\right]{,}\left[\begin{array}{cc}{1}& {2}\\ {1}& {1}\end{array}\right]{,}\left[\begin{array}{cc}{1}& {2}\\ {1}& {2}\end{array}\right]{,}\left[\begin{array}{cc}{1}& {2}\\ {2}& {1}\end{array}\right]{,}\left[\begin{array}{cc}{2}& {1}\\ {1}& {1}\end{array}\right]{,}\left[\begin{array}{cc}{2}& {1}\\ {2}& {1}\end{array}\right]{,}\left[\begin{array}{cc}{2}& {2}\\ {1}& {1}\end{array}\right]\right]$ (14)
 > select( IsCommutative, L ); # find the commutative ones
 $\left[\left[\begin{array}{cc}{1}& {1}\\ {1}& {1}\end{array}\right]{,}\left[\begin{array}{cc}{1}& {1}\\ {1}& {2}\end{array}\right]{,}\left[\begin{array}{cc}{1}& {2}\\ {2}& {1}\end{array}\right]{,}\left[\begin{array}{cc}{2}& {1}\\ {1}& {1}\end{array}\right]\right]$ (15)
 > CS := Enumerate( 5, 'associative', 'commutative', 'output' = 'list' ): # find all 5-element commutative semigroups
 > andmap( IsSemigroup and IsCommutative, CS ); # check
 ${\mathrm{true}}$ (16)
 > m1 := Array( 1 .. 3, 1 .. 3, [[1,2,3],[2,3,1],[3,1,2]], 'datatype' = 'integer'[4], 'order' = 'C_order' );
 ${\mathrm{m1}}{≔}\left[\begin{array}{ccc}{1}& {2}& {3}\\ {2}& {3}& {1}\\ {3}& {1}& {2}\end{array}\right]$ (17)
 > m2 := Array( 1 .. 3, 1 .. 3, [[2,3,1],[3,1,2],[1,2,3]], 'datatype' = 'integer'[4], 'order' = 'C_order' );
 ${\mathrm{m2}}{≔}\left[\begin{array}{ccc}{2}& {3}& {1}\\ {3}& {1}& {2}\\ {1}& {2}& {3}\end{array}\right]$ (18)
 > AreIsomorphic( m1, m2 );
 ${\mathrm{true}}$ (19)
 > unwith( Magma ):

DynamicSystems

 • The EquilibriumPoint command in the DynamicSystems package has been updated. A new option, evaluationlimit, was added.

DEtools

 • The DEtools package has two new commands, Closure and Desingularize.

PDEtools

 For examples on the developments described in this section, see What's New in Differential Equations (PDEs).
 • The following commands were significantly enhanced in their functionality: ConservedCurrents, D_Dx, DeterminingPDE, Eta_k, InfinitesimalGenerator, Infinitesimals, IntegratingFactors, InvariantEquation, and Solve.
 • In Maple 15, the entire set of symmetry commands of PDEtools:
 • automatically use textbook mathematical jet notation on input and output;
 • handle list of infinitesimals or the corresponding symmetry generator operators in equal footing;
 • understand different jet notations as representing the same mathematical objects;
 • return list of infinitesimals with infinitesimal labels in mathematical notation, unless your input contains infinitesimals without labels;
 • return results in the jet notation of the input you pass to them;
 • optionally return in any jet notation you request.
 • Nine new PDEtools:-Library commands were added to the library of tools to manipulate PDE systems and facilitate programming with them. These are: BuildFunctionFieldHint, ConstructTrivialSymmetry, GenerateInfinitesimalLabels, GetNew_Fn, GetNotation, GetProlongationValue, InfinitesimalGeneratorToList, and SortDerivatives.
 • Three new commands were added to PDEtools.
 – FunctionFieldSolutions is a new command that involves an innovative approach to computing exact solutions to DE systems involving mathematical functions, possibly inequations, ODEs, and also non-differential equations. In these cases, due to the presence of nonpolynomial objects, the original Maple approach by decoupling of the system using differential polynomial extensions, although powerful, sometimes fails in solving the problem. The new approach in FunctionFieldSolutions skips entirely that step and instead searches for solutions that can be written as a power series (with some upper bound degree $n$) in the mathematical functions and its derivatives (up to some upper bound differential order $m$), having for coefficients multivariable polynomials (with some upper bound degree $r$). In turn these polynomials have undetermined coefficients that get adjusted, resulting in the solution. To compute the key values of $n,m,r$ to construct these function field solutions, the new command maps the problem into one that can be tackled with the existing PDEtools:-Library:-UpperBounds (see PDEtools[Library]).
 – SymmetryCommutator is a new command to compute the commutator between two symmetries, given either as lists of infinitesimals or as infinitesimal generator procedures. This command is useful when studying the properties of a group of symmetries or when deriving the group constants or relations to make the group complete.
 – SymmetryGauge is a new command to gauge PDE symmetries. It is well known that an ODE symmetry can be rewritten in different ways (see Xgauge). It is not so well known, but the same happens with PDE symmetries. The ability to rewrite a symmetry is relevant for a number of purposes. First, that permits identifying that two apparently different symmetries are actually the same by rewriting them in evolutionary form (gauge $\mathrm{\xi }=0$). Second, symmetries that appear as dynamical ones can frequently be rewritten as pointlike, transforming the usability of the symmetry from perhaps very difficult into straightforward. Finally, depending on the form of the symmetry, by rewriting them it is frequently possible to simplify its form considerably so that invariants of canonical coordinates become computable and so the symmetry can be used to reduce the number of independent variables of PDE systems.

VectorCalculus

 • The VectorCalculus[Wronskian] command now takes a determinant option, which requests that the determinant of the Wronskian matrix of the input function be returned, as well as the Wronskian matrix itself.
 > with(VectorCalculus):
 > W, det := Wronskian( [sin(t), cos(t)], t, determinant );
 ${W}{,}{\mathrm{det}}{≔}\left[\begin{array}{cc}{\mathrm{sin}}{}\left({t}\right)& {\mathrm{cos}}{}\left({t}\right)\\ {\mathrm{cos}}{}\left({t}\right)& {-}{\mathrm{sin}}{}\left({t}\right)\end{array}\right]{,}{-}{{\mathrm{sin}}{}\left({t}\right)}^{{2}}{-}{{\mathrm{cos}}{}\left({t}\right)}^{{2}}$ (20)

numelems

 • A new command, numelems, provides a single function to return the number of elements stored in any expression of type indexable.
 > numelems(<1,2;3,4>);
 ${4}$ (21)
 > numelems([1,2,3,4]);
 ${4}$ (22)
 > numelems(table({1=1,2=2,3=3}));
 ${3}$ (23)
 > numelems("abc");
 ${3}$ (24)

upperbound, lowerbound

 • New commands, upperbound and lowerbound, have been added to provide a simple function to find the upper and lower bounds of an rtable's dimensions.
 > M := <1,2,3;4,5,6>:
 > (m,n) := upperbound(M);
 ${m}{,}{n}{≔}{2}{,}{3}$ (25)
 > upperbound(M,1);
 ${2}$ (26)
 > upperbound(M,2);
 ${3}$ (27)
 > lowerbound(M,1);
 ${1}$ (28)
 > lowerbound(M,2);
 ${1}$ (29)

Array and Table Support in the member Command

 • The member command can now determine if an expression is contained inside an Array, Matrix, or Vector.
 > member(y, );
 ${\mathrm{true}}$ (30)
 • The member command also can be used to test membership in a table.
 > member(y, table([x,y,z]));
 ${\mathrm{true}}$ (31)

indices and entries Commands

 • A new pairs option has been added to both of the indices and entries commands. This allows extraction of index = value pairs from a table or rtable.
 > indices(<1,2;3,4>,'pairs');
 $\left({1}{,}{1}\right){=}{1}{,}\left({1}{,}{2}\right){=}{2}{,}\left({2}{,}{1}\right){=}{3}{,}\left({2}{,}{2}\right){=}{4}$ (32)

Array Type Check

 • Open-ended ranges are now allowed Array, Matrix, and Vector type checks.
 > type(<1,2;3,4>,'Matrix(1..,1..)');
 ${\mathrm{true}}$ (33)

EqualEntries command

 • The EqualEntries command compares elements inside two separate container structure. When comparing two container structures, the EqualEntries command returns true if the two structures are the same kind of structure, have the same number of elements, and contain the same elements in the same order, with some exceptions.

Packed Record Structure

 • The Record constructor function can now be called with the indexed name Record[packed], to produce a packed record.
 • Unlike a regular record, a packed record does not create a unique instance of each field name for each record instance. When working with thousands of similar records each with many fields, this can save a significant amount of memory.
 • Fields of packed records do not exhibit last-name evaluation. That is, the expression r:-a always produces a value, even if that value is a procedure, table, Matrix, Vector, or another record.
 • Similarly, it is not possible for a packed record field to not have a value. The assigned function will always return true, and unassigning a packed record field will set its value to NULL instead.

Testing Code

 • The new command CodeTools[Test] has been provided as a front-end to the verify command to facilitate the creation of suites of tests for projects written in Maple.
 > restart;
 > CodeTools[Test](int(x^2,x), x^3/3, label="Test Pass");
 Test Pass passed
 > CodeTools[Test](int(x,x^2), x^3/3, label="Test Fail");
 Test Fail failed  Received error: [int, "integration range or variable must be specified in the second argument, got %1", x^2]

Easy Repetition of Debugger Commands

 • The debugger commands cont, next, step, into, outfrom, and return can be followed by an optional positive integer specifying the number of times the command is to be repeated. For example, into 10 instructs to debugger to continue execution for the next 10 statements in the current procedure.

Updated Maple Programming Guide

 • The Maple Introductory Programming Guide and Maple Advanced Programming Guide have been combined into a single guide. The new Maple Programming Guide provides updated information and examples, including:
 – The latest Maple programming features
 – An overview of Maple's data structures
 – A new chapter on parallel programming
 • See the new Maple Programming Guide.

StringTools

 • The new StringSplit command has been added to the StringTools package. You use it to split a string at a fixed string.  It is similar to the RegSplit command but, since the pattern is a simple string rather than a regular expression, it uses a faster algorithm.
 > with( StringTools ):
 > s := Random( 10^6, 'lower' ):
 > time( StringSplit( s, "abc" ) );
 ${0.023}$ (34)
 > time( RegSplit( "abc", s ) );
 ${0.020}$ (35)
 > unwith( StringTools ):
 • The FormatMessage command supports automated pluralization. See StringTools[FormatMessage] for details.