Performance - Maple Help

Online Help

All Products    Maple    MapleSim


Maple 2018 improves the performance of many routines.


Gröbner Bases

Kernel Improvements


Graph Theory

Sparse Linear Equations mod p

Matrix Inverse with Trig Functions


Gröbner Bases

Gröbner bases lie at the heart of many fundamental operations, including solving systems of equations and integration, so performance improvements in Gröbner bases results in faster calculations in other areas as well. Maple 2018 includes new optimizations to the F4 algorithm to increase parallel speedup when computing large total degree Gröbner bases.  On a quad core Core i7 with hyperthreading, the new implementation runs 33 percent faster and parallel speedup increases from 1.94x to 2.84x.



memory used=24.08MiB, alloc change=18.98MiB, cpu time=2.73m, real time=25.73s, gc time=0ns

Maple 2018 also includes a new implementation of the FGLM algorithm for converting total degree Gröbner bases to lexicographical order, with improved performance and lower memory requirements.  On this example, the FGLM algorithm runs about 3.5x faster.


memory used=186.80MiB, alloc change=256.00MiB, cpu time=82.03s, real time=26.78s, gc time=93.75ms

Kernel Improvements

Fast code has been added to the subs command for the case of replacing variables in polynomials with products.  The following types of substitutions run significantly faster on large polynomials.

f  x8y4 + x4y4 + x2y2+1; subsx=yz, y=2z2,f; subsx=sqrtx, f; subsy=1x, f;



Kernel code has been added to speed up tests for polynomials and rational functions using Maple library types.  The examples below run about 6x faster.

 f  randpolyx,y,z,t,u,v,w,sqrt2,sqrt3,degree=10,terms=10000:CodeTools:-Usagetypef, polynomalgfun, x,y,z,t,u,v,w;CodeTools:-Usagetypef,ratpolyalgfun,x,y,z,t,u,v,w;




The SAT solver used by the Satisfy and Satisfiable commands is now MapleSAT, a SAT solver based on MiniSat but with improvements to the variable branching heuristic.  The following example runs about 4x faster in Maple 2018 than Maple 2017.  It encodes an instance of the pigeonhole principle, the fact that n pigeons cannot fit in n1 holes if each hole can contain at most one pigeon.

n  11:# Every pigeon is in a holePositiveClauses  seqLogic:-`&or`seqxi, j, j = 1 .. n1, i = 1 .. n:# No hole contains two pigeonsNegativeClauses  seqseqseqLogic:-`&or`Logic:-`&not`xi, j, Logic:-`&not`xk, j, i = k+1 .. n, k = 1 .. n, j = 1 .. n1:PHP  Logic:-`&and`PositiveClauses, NegativeClauses:nopsPHP;






Graph Theory

The ChromaticNumber command which computes the chromatic number of a graph now uses a hybrid algorithm by default.  This algorithm runs two separate implementations in parallel and returns the result of whichever method finishes first.  Consequently, some examples which could not be solved in Maple 2017 in a reasonable amount of time can be quickly solved in Maple 2018.  In the following example Maple 2017 is unable to determine the chromatic number after an hour of CPU time while Maple 2018 does so in seconds.  The example is a random graph which appears in the paper "Optimization by Simulated Annealing: An Experimental Evaluation; Part II, Graph Coloring and Number Partitioning" by D. Johnson, C. Aragon, L. McGeoch, and C. Schevon.

GImportexample/DSJC125.1.s6, base=datadir

GGraph 1: an undirected unweighted graph with 125 vertices and 736 edge(s)



memory used=266.60KiB, alloc change=10.94MiB, cpu time=48.00ms, real time=1.14s, gc time=0ns



Sparse Linear Equations mod p

The msolve command has been updated with a new solver for sparse linear equations for primes up to 2311.  It pivots for structure and sparsity and quickly detects redundant equations in overdetermined systems.  The example below runs over 100x faster.

memory used=1.03MiB, alloc change=0 bytes, cpu time=125.00ms, real time=19.00ms, gc time=0ns


Matrix Inverse with Trig Functions

The inverse of a matrix with trigonometric functions is faster.

x 1 + sina + cosb: AMatrix11x+a11,12x+a12,13x+a13,14x+a14,21x+a21,22x+a22,23x+a23,24x+a24,31x+a31,32x+a32,33x+a33,34x+a34,41x+a41,42x+a42,43x+a43,44x+a44:timeLinearAlgebra:-MatrixInverseA;




The timelimit command is useful for putting a time bound on a computation, preventing it from running longer than you expect. The timelimit command now has virtually no overhead.

f := proc(x)
    description "Number of Primes less than x";
    global i,j;
    for j to x do
        if isprime(j) then
            i := i + 1;
        end if;
    end do:
    return i;
end proc:


Error, (in isprime) time expired

printf("The number of primes less than %a is %a. This was computed in %.2f s.", j, i, 0.5);

The number of primes less than 150743 is 13909. This was computed in 0.50 s.