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

Enhancements to Computational Algorithms in Maple 15

Maple 15 includes new and enhanced computational algorithms for both symbolic and numeric computing.

Optimization

 • A new sparse iterative interior point method has been added to Optimization[LPSolve]. The method is based on an algorithm developed by Dr. H. Wolkowicz at the University of Waterloo and colleagues. It provides a significant improvement in efficiency over the previously available active-set method when solving large sparse linear programs.

Polynomial Arithmetic

 • Multiplication, division and powering of high-degree dense polynomials are at least 4 times faster because of an improved implementation.  This implementation consumes at least 3/4 less memory than the ones in Maple 14.
 • The following examples shows efficient polynomial multiplication, powering, division and modulus operations:
 > f,g := seq(randpoly(x,degree=10^4,dense),i=1..2):
 > p := CodeTools[Usage](expand(f*g)):
 memory used=314.77KiB, alloc change=0 bytes, cpu time=6.00ms, real time=6.00ms, gc time=0ns
 > p := CodeTools[Usage](expand((5*x-3*y)^10000)):
 memory used=32.35MiB, alloc change=32.00MiB, cpu time=111.00ms, real time=112.00ms, gc time=7.66ms
 > n := prevprime(2^512):
 > f := Expand((1+x+y+z+t)^30) mod n:
 > CodeTools[Usage](Divide(f,1+x+y+z+t,'q') mod n);
 memory used=0.65MiB, alloc change=0 bytes, cpu time=6.00ms, real time=5.00ms, gc time=0ns
 ${\mathrm{true}}$ (1)
 • divide determines if the polynomial is not divisible immediately as shown in the second call to the command:
 > f,g := seq(randpoly([x,y,z],degree=30,terms=3000),i=1..2):
 > p := expand(f*g):
 > CodeTools[Usage](divide(p,f,'q'));    # computes quotient
 memory used=49.09KiB, alloc change=0 bytes, cpu time=1.45s, real time=265.00ms, gc time=0ns
 ${\mathrm{true}}$ (2)
 > CodeTools[Usage](divide(p+1,f,'q'));  # fails instantly
 memory used=0.61MiB, alloc change=0.61MiB, cpu time=2.00ms, real time=2.00ms, gc time=0ns
 ${\mathrm{false}}$ (3)
 • Unassign the names f, g, n, and p.
 > f:='f': g:='g': n:='n': p:='p':

Sparse Matrices

 • Support for various operations involving sparse matrices has been greatly improved.  Native support for hardware float multiplication, transpose, block copy, concatenation, and submatrix selection take almost no time to execute now.
 > M := LinearAlgebra[RandomMatrix](1000,storage=rectangular,density=.003,datatype=float):
 > time(Matrix(M,storage=sparse));
 # now .012s vs .200s in Maple 14
 > M1 := LinearAlgebra[RandomMatrix](1000,storage=sparse,density=.003,datatype=float):
 > M2 := LinearAlgebra[RandomMatrix](1000,storage=sparse,density=.003,datatype=float):
 > time(M1.M2);
 # now .004s vs .032s in Maple 14
 > time(Matrix(M1,transpose=true));
 # .000  vs 5.104
 > time(Matrix(M1,storage=rectangular));
 #  .008 vs 0.052
 > time();
 #  .000 vs 10.096
 > time();
 #  .000 vs 10.148
 > MD := LinearAlgebra[RandomMatrix](1000,shape=diagonal,datatype=float):
 > time(MD.M1);
 #  .000 vs .204
 > time(M1[..,1..500]);
 #  .000 vs 2.528
 > V1 := Vector([seq(2*i,i=1..500)]);
  (4)
 > time(M1(..,V1));
 #  .060 vs 2.624

High-Precision Algebraic Riccati Equations

 • High precision Algebraic Riccati Equation solving in the LinearAlgebra package
 • The commands CARE and DARE for solving the linear systems which represent continuous and discrete Algebraic Riccati Equations have been enhanced to work at higher than hardware double precision.
 > with(LinearAlgebra):
 > A := Matrix([[1.0, .2, 1.0], [0., .1, .45], [2.0, 2.3, 1.3]]);
 ${A}{≔}\left[\begin{array}{ccc}{1.0}& {0.2}& {1.0}\\ {0.}& {0.1}& {0.45}\\ {2.0}& {2.3}& {1.3}\end{array}\right]$ (5)
 > B := Matrix([[0, 1], [0, 0], [1, 0]]);
 ${B}{≔}\left[\begin{array}{cc}{0}& {1}\\ {0}& {0}\\ {1}& {0}\end{array}\right]$ (6)
 > Q := Matrix([[1, 0, 0], [0, 1, 0], [0, 0, 1]]);
 ${Q}{≔}\left[\begin{array}{ccc}{1}& {0}& {0}\\ {0}& {1}& {0}\\ {0}& {0}& {1}\end{array}\right]$ (7)
 > R := Matrix([[1.0, 0.], [0., 1.0]]);
 ${R}{≔}\left[\begin{array}{cc}{1.0}& {0.}\\ {0.}& {1.0}\end{array}\right]$ (8)
 > X := CARE(A, B, Q, R);
 ${X}{≔}\left[\begin{array}{ccc}{3.41350912431040}& {1.85810170520121}& {2.41829858578592}\\ {1.85810170520121}& {9.76324094274858}& {4.65230672399638}\\ {2.41829858578592}& {4.65230672399638}& {3.72188050348369}\end{array}\right]$ (9)
 > Digits:=20:
 > X := CARE(A, B, Q, R);
 ${X}{≔}\left[\begin{array}{ccc}{3.4135091243103892062}& {1.8581017052012091792}& {2.4182985857859171196}\\ {1.8581017052012091792}& {9.7632409427485836328}& {4.6523067239963752516}\\ {2.4182985857859171196}& {4.6523067239963752516}& {3.7218805034836886482}\end{array}\right]$ (10)

Parametric Solving

Solving Polynomial Equations with Case Discussion

 • New user-level functionality for building case discussions of the solutions of polynomial equations are now available as the new SolveTools[Parametric] command, and the new parametric option for the solve command.
 > SolveTools[Parametric]({a*x}, {x}, {a});
 $\left\{\begin{array}{cc}\left[\left\{{x}{=}{x}\right\}\right]& {a}{=}{0}\\ \left[\left\{{x}{=}{0}\right\}\right]& {a}{\ne }{0}\end{array}\right\$ (11)
 • By default these new commands return piecewise answers containing answers for the most general cases and the other branches containing inert function calls.
 > result := SolveTools[Parametric]({a*x^2-(b+a)*x+b}, {x});
 ${\mathrm{result}}{≔}\left\{\begin{array}{cc}{?}{}\left(\left\{{-}{x}{}{b}{+}{b}\right\}{,}\left\{{x}\right\}{,}\left\{{b}\right\}\right)& {a}{=}{0}\\ \left[\left\{{x}{=}{1}\right\}{,}\left\{{x}{=}\frac{{b}}{{a}}\right\}\right]& {a}{\ne }{0}\end{array}\right\$ (12)
 > result := eval(result, a=0);
 ${\mathrm{result}}{≔}{?}{}\left(\left\{{-}{x}{}{b}{+}{b}\right\}{,}\left\{{x}\right\}{,}\left\{{b}\right\}\right)$ (13)
 > value(result);
 $\left\{\begin{array}{cc}\left[\left\{{x}{=}{x}\right\}\right]& {b}{=}{0}\\ \left[\left\{{x}{=}{1}\right\}\right]& {b}{\ne }{0}\end{array}\right\$ (14)
 • The new solve option does some additional processing of the input, but uses the same backend as SolveTools[Parametric] and produces the same answers.  See the solve/parametric help page for more details.
 > solve( a*x^2-(b+a)*x+b, x, 'parametric');
 $\left\{\begin{array}{cc}{?}{}\left(\left\{{-}{x}{}{b}{+}{b}\right\}{,}\left\{{x}\right\}{,}\left\{{b}\right\}\right)& {a}{=}{0}\\ \left[\left\{{x}{=}{1}\right\}{,}\left\{{x}{=}\frac{{b}}{{a}}\right\}\right]& {a}{\ne }{0}\end{array}\right\$ (15)

Definite Summation

 • The sum command has been enhanced for the case of definite sums with parametric bounds. The behavior can be can be controlled via the optional keyword parametric.
 > sum(1/k, k=a..b);
 ${\sum }_{{k}{=}{a}}^{{b}}{}\frac{{1}}{{k}}$ (16)
 > sum(1/k, k=a..b, parametric);
 $\left\{\begin{array}{cc}{0}& {a}{=}{b}{+}{1}\\ {\mathrm{\Psi }}{}\left({b}{+}{1}\right){-}{\mathrm{\Psi }}{}\left({a}\right)& {1}{\le }{a}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{and}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{0}{\le }{b}\\ {\mathrm{\Psi }}{}\left({-}{b}\right){-}{\mathrm{\Psi }}{}\left({1}{-}{a}\right)& {a}{\le }{0}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{and}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{b}{\le }{-1}\\ {\mathrm{FAIL}}& {\mathrm{otherwise}}\end{array}\right\$ (17)
 • In addition to the sum command itself, the definite summation command SumTools[DefiniteSum][Definite] has been extended by a new option parametric.
 > with(SumTools):
 > DefiniteSum[Definite](binomial(2*k-3, k)/4^k, k=0..n, parametric);
 $\left\{\begin{array}{cc}\frac{\left(\genfrac{}{}{0}{}{{2}{}{n}{-}{1}}{{n}}\right){}\left({2}{}{n}{+}{4}\right)}{{{4}}^{{n}{+}{1}}}& {n}{\le }{0}\\ \frac{{3}}{{4}}& {n}{=}{1}\\ \frac{\left(\genfrac{}{}{0}{}{{2}{}{n}{-}{1}}{{n}}\right){}\left({2}{}{n}{+}{4}\right)}{{{4}}^{{n}{+}{1}}}{+}\frac{{3}}{{8}}& {2}{\le }{n}\end{array}\right\$ (18)
 • For the case of non-parametric definite sums, handling of removable singularities has been improved. By default, they will be removed, but this can be disabled by setting _EnvFormal to false.
 > sum(1/GAMMA(k), k=-1..5);
 $\frac{{65}}{{24}}$ (19)
 > _EnvFormal := false;
 ${\mathrm{_EnvFormal}}{≔}{\mathrm{false}}$ (20)
 > sum(1/GAMMA(k), k=-1..5);

Additional Improvements to SumTools

 • Two new commands have been added to the SumTools package and its subpackages: BottomSequence and SummableSpace.
 • The indefinite summation commands SumTools[IndefiniteSum][Indefinite], SumTools[IndefiniteSum][Hypergeometric], and SumTools[IndefiniteSum][Rational] were extended by a new option failpoints.
 • A new optional argument was added to the command SumTools[Hypergeometric][Gosper] to return the rational certificate in Gosper's algorithm.
 > with(SumTools[Hypergeometric]):
 > Gosper((-1)^k*binomial(n,k), k, 'r'); r;
 ${-}\frac{{k}{}{\left({-1}\right)}^{{k}}{}\left(\genfrac{}{}{0}{}{{n}}{{k}}\right)}{{n}}$
 ${-}\frac{{k}}{{n}}$ (21)
 • The command SumTools[Hypergeometric][DefiniteSumAsymptotic] was enhanced to handle bivariate rational functions.
 > DefiniteSum(1/(m^2+k^2)^2, m, k, 0..m);
 ${\sum }_{{k}{=}{0}}^{{m}}{}\frac{{1}}{{\left({{k}}^{{2}}{+}{{m}}^{{2}}\right)}^{{2}}}$ (22)
 > DefiniteSumAsymptotic(1/(m^2+k^2)^2, m, k, 0..m);
 $\frac{{\mathrm{\pi }}{+}{2}}{{8}{}{{m}}^{{3}}}{+}\frac{{5}}{{8}{}{{m}}^{{4}}}{-}\frac{{1}}{{24}{}{{m}}^{{5}}}{+}{\mathrm{O}}{}\left(\frac{{1}}{{{m}}^{{7}}}\right)$ (23)
 • The possible minimizations via the keyword option minimize in the command SumTools[Hypergeometric][SumDecomposition] were extended.

RegularChains

 • In Maple 15, the RegularChains library offers a variety of tools to compute the real solutions of polynomial systems. The three new commands RealTriangularize, LazyRealTriangularize, and SamplePoints deal with arbitrary semi-algebraic systems. That is, given any system $S$ of polynomial equations, polynomial inequations and polynomial inequalities (strict or large) these commands produce information about the real solutions of this system.
 • RegularChains[RealTriangularize] returns a full description of the real solutions of $S$: it computes a family of simpler systems such that a point is a solution of $S$ if and only if it is a solution of one of the simpler systems.  Each simpler system has a triangular shape and remarkable properties: for this reason it is called a regular semi-algebraic system and the set of the simpler systems is called a full triangular decomposition of $S$.
 • RegularChains[LazyRealTriangularize] allows the user to compute a triangular decomposition of $S$ in an interactive manner. This feature is particularly well adapted for systems that are hard to solve.  For such systems, LazyRealTriangularize returns the components of $S$ of maximum dimension together with unevaluated recursive calls, such that, when fully evaluated, these calls produce the other components of S (which are generally harder to compute).
 • RegularChains[SamplePoints] is even a lazier (and thus much cheaper) way of solving: it produces at least one sample point per connected component of the solution set of $S$. This way of solving is often sufficient in practical problems.
 • RegularChains[Display] is a new pretty-printing command that handles any object types in used in the RegularChains library.
 • RegularChains[ChainTools][Extend] is a new command that decomposes a triangular set into regular chains.
 • RegularChains[ParametricSystemTools][RealRootClassification] has two new output options, namely formula and samples.  These options allow you to obtain either a formal description or simply sample points of the computed set.
 > with(RegularChains):
 > R := PolynomialRing([z,y,x]):
 • The Zeck algebraic surface is defined by the following equation to which we added inequality constraints in order to select part of this surface
 > F := [x^2+y^2-z^3*(1-z) = 0, 5*y> 1, z<=2];
 ${F}{≔}\left[{{x}}^{{2}}{+}{{y}}^{{2}}{-}{{z}}^{{3}}{}\left({1}{-}{z}\right){=}{0}{,}{1}{<}{5}{}{y}{,}{z}{\le }{2}\right]$ (24)
 • Below is a complete description of the real solutions in terms of formulas
 > RealTriangularize(F, R,output=record);
 $\left\{\begin{array}{cc}{{z}}^{{4}}{-}{{z}}^{{3}}{+}{{y}}^{{2}}{+}{{x}}^{{2}}{=}{0}& {}\\ {2}{-}{z}{>}{0}& {}\\ {256}{}{{x}}^{{2}}{+}{256}{}{{y}}^{{2}}{<}{27}& {}\\ {5}{}{y}{-}{1}{>}{0}& {}\end{array}\right\{,}\left\{\begin{array}{cc}{4}{}{z}{-}{3}{=}{0}& {}\\ {256}{}{{y}}^{{2}}{+}{256}{}{{x}}^{{2}}{-}{27}{=}{0}& {}\\ {5}{}{y}{-}{1}{>}{0}& {}\\ {6400}{}{{x}}^{{2}}{<}{419}& {}\end{array}\right\$ (25)
 • Now we provide witness solutions
 > SamplePoints(F, R,output=record);
 $\left\{\begin{array}{cc}{z}{=}\left[\frac{{67}}{{128}}{,}\frac{{17}}{{32}}\right]& {}\\ {y}{=}\frac{{269}}{{1024}}& {}\\ {x}{=}{0}& {}\end{array}\right\{,}\left\{\begin{array}{cc}{z}{=}\left[\frac{{29}}{{32}}{,}\frac{{117}}{{128}}\right]& {}\\ {y}{=}\frac{{269}}{{1024}}& {}\\ {x}{=}{0}& {}\end{array}\right\{,}\left\{\begin{array}{cc}{z}{=}\frac{{3}}{{4}}& {}\\ {y}{=}\left[\frac{{83}}{{256}}{,}\frac{{21}}{{64}}\right]& {}\\ {x}{=}{0}& {}\end{array}\right\$ (26)
 • A snow flake can be described by the following equation
 > F2 := [x^3+y^2*z^3-y*z^4 ];
 ${\mathrm{F2}}{≔}\left[{{y}}^{{2}}{}{{z}}^{{3}}{-}{y}{}{{z}}^{{4}}{+}{{x}}^{{3}}\right]$ (27)
 • Below is a complete description of the real solutions.
 > RealTriangularize(F2, R, output=record);
 $\left\{\begin{array}{cc}{y}{}{{z}}^{{4}}{-}{{y}}^{{2}}{}{{z}}^{{3}}{-}{{x}}^{{3}}{=}{0}& {}\\ {27}{}{{y}}^{{5}}{+}{256}{}{{x}}^{{3}}{>}{0}& {}\\ {y}{>}{0}& {}\\ {x}{\ne }{0}& {}\end{array}\right\{,}\left\{\begin{array}{cc}{y}{}{{z}}^{{4}}{-}{{y}}^{{2}}{}{{z}}^{{3}}{-}{{x}}^{{3}}{=}{0}& {}\\ {27}{}{{y}}^{{5}}{+}{256}{}{{x}}^{{3}}{<}{0}& {}\\ {y}{<}{0}& {}\\ {x}{\ne }{0}& {}\end{array}\right\{,}\left\{\begin{array}{cc}{z}{-}{y}{=}{0}& {}\\ {y}{\ne }{0}& {}\\ {x}{=}{0}& {}\end{array}\right\{,}\left\{\begin{array}{cc}{z}{=}{0}& {}\\ {y}{\ne }{0}& {}\\ {x}{=}{0}& {}\end{array}\right\{,}\left\{\begin{array}{cc}{64}{}{{z}}^{{3}}{-}{16}{}{y}{}{{z}}^{{2}}{-}{12}{}{{y}}^{{2}}{}{z}{-}{9}{}{{y}}^{{3}}{=}{0}& {}\\ {27}{}{{y}}^{{5}}{+}{256}{}{{x}}^{{3}}{=}{0}& {}\\ {x}{\ne }{0}& {}\end{array}\right\{,}\left\{\begin{array}{cc}{y}{=}{0}& {}\\ {x}{=}{0}& {}\end{array}\right\$ (28)

RootFinding[Parametric]

 • The RegularChains library can be used in RootFinding[Parametric][CellDecomposition] through this command's new option, method.
 > with(RootFinding[Parametric]):
 > m := CellDecomposition([x^2+a*x+b = 0], [x], 'method' = 'RC'):
 > CellPlot(m, 'samplepoints');
 > NumberOfSolutions(m);
 $\left[\left[{1}{,}{2}\right]{,}\left[{2}{,}{2}\right]{,}\left[{3}{,}{0}\right]{,}\left[{4}{,}{2}\right]\right]$ (29)
 > unassign('m'):

Statistics

 • New commands AutoCorrelation and CrossCorrelation have been added to the Statistics package.  The commands efficiently compute approximations of the autocorrelations of a discrete time series or the cross-correlations of a pair of discrete time series.
 > Statistics[CrossCorrelation](<1,2,1,2>, <2,1,2,1>, 2);
 $\left[\begin{array}{c}{0.499999999966518}\\ {1.12500000000563}\\ {1.}\\ {0.749999999982922}\\ {0.500000000010712}\end{array}\right]$ (30)
 > Statistics[AutoCorrelation](<1,-1,1,-1>, 2);
 $\left[\begin{array}{c}{1.}\\ {-0.749999999942256}\\ {0.499999999875000}\end{array}\right]$ (31)
 • The Statistics[Sample] command can now use a preexisting rtable to store its results in, instead of always creating a new one. This can be used for more efficient memory usage.

Units

 • The UseUnit command has been added to the Units package. It can be used to select a unit that is to be used for computation in this package. The command is a simpler alternative to the AddSystem and UseSystem commands.