Performance
Maple 2018 improves the performance of many routines.
Gröbner Bases
Kernel Improvements
Logic
Graph Theory
Sparse Linear Equations mod p
Matrix Inverse with Trig Functions
timelimit
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.
cyclic9≔x0+x1+x2+x3+x4+x5+x6+x7+x8,x0⁢x1+x0⁢x8+x1⁢x2+x2⁢x3+x3⁢x4+x4⁢x5+x5⁢x6+x6⁢x7+x7⁢x8,x0⁢x1⁢x2+x0⁢x1⁢x8+x0⁢x7⁢x8+x1⁢x2⁢x3+x2⁢x3⁢x4+x3⁢x4⁢x5+x4⁢x5⁢x6+x5⁢x6⁢x7+x6⁢x7⁢x8,x0⁢x1⁢x2⁢x3+x0⁢x1⁢x2⁢x8+x0⁢x1⁢x7⁢x8+x0⁢x6⁢x7⁢x8+x1⁢x2⁢x3⁢x4+x2⁢x3⁢x4⁢x5+x3⁢x4⁢x5⁢x6+x4⁢x5⁢x6⁢x7+x5⁢x6⁢x7⁢x8,x0⁢x1⁢x2⁢x3⁢x4+x0⁢x1⁢x2⁢x3⁢x8+x0⁢x1⁢x2⁢x7⁢x8+x0⁢x1⁢x6⁢x7⁢x8+x0⁢x5⁢x6⁢x7⁢x8+x1⁢x2⁢x3⁢x4⁢x5+x2⁢x3⁢x4⁢x5⁢x6+x3⁢x4⁢x5⁢x6⁢x7+x4⁢x5⁢x6⁢x7⁢x8,x0⁢x1⁢x2⁢x3⁢x4⁢x5+x0⁢x1⁢x2⁢x3⁢x4⁢x8+x0⁢x1⁢x2⁢x3⁢x7⁢x8+x0⁢x1⁢x2⁢x6⁢x7⁢x8+x0⁢x1⁢x5⁢x6⁢x7⁢x8+x0⁢x4⁢x5⁢x6⁢x7⁢x8+x1⁢x2⁢x3⁢x4⁢x5⁢x6+x2⁢x3⁢x4⁢x5⁢x6⁢x7+x3⁢x4⁢x5⁢x6⁢x7⁢x8,x0⁢x1⁢x2⁢x3⁢x4⁢x5⁢x6+x0⁢x1⁢x2⁢x3⁢x4⁢x5⁢x8+x0⁢x1⁢x2⁢x3⁢x4⁢x7⁢x8+x0⁢x1⁢x2⁢x3⁢x6⁢x7⁢x8+x0⁢x1⁢x2⁢x5⁢x6⁢x7⁢x8+x0⁢x1⁢x4⁢x5⁢x6⁢x7⁢x8+x0⁢x3⁢x4⁢x5⁢x6⁢x7⁢x8+x1⁢x2⁢x3⁢x4⁢x5⁢x6⁢x7+x2⁢x3⁢x4⁢x5⁢x6⁢x7⁢x8,x0⁢x1⁢x2⁢x3⁢x4⁢x5⁢x6⁢x7+x0⁢x1⁢x2⁢x3⁢x4⁢x5⁢x6⁢x8+x0⁢x1⁢x2⁢x3⁢x4⁢x5⁢x7⁢x8+x0⁢x1⁢x2⁢x3⁢x4⁢x6⁢x7⁢x8+x0⁢x1⁢x2⁢x3⁢x5⁢x6⁢x7⁢x8+x0⁢x1⁢x2⁢x4⁢x5⁢x6⁢x7⁢x8+x0⁢x1⁢x3⁢x4⁢x5⁢x6⁢x7⁢x8+x0⁢x2⁢x3⁢x4⁢x5⁢x6⁢x7⁢x8+x1⁢x2⁢x3⁢x4⁢x5⁢x6⁢x7⁢x8,x0⁢x1⁢x2⁢x3⁢x4⁢x5⁢x6⁢x7⁢x8−1:
G≔CodeTools:-UsageGroebner:-Basis⁡cyclic9,tdegx0,x1,x2,x3,x4,x5,x6,x7,x8,characteristic=231−1:
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.
katsura12≔2⁢x0⁢x11+2⁢x1⁢x10+2⁢x1⁢x12+2⁢x2⁢x9+2⁢x3⁢x8+2⁢x4⁢x7+2⁢x5⁢x6−x11,2⁢x0⁢x10+2⁢x1⁢x11+2⁢x1⁢x9+2⁢x12⁢x2+2⁢x2⁢x8+2⁢x3⁢x7+2⁢x4⁢x6+x52−x10,2⁢x0⁢x9+2⁢x1⁢x10+2⁢x1⁢x8+2⁢x11⁢x2+2⁢x12⁢x3+2⁢x2⁢x7+2⁢x3⁢x6+2⁢x4⁢x5−x9,2⁢x0⁢x8+2⁢x1⁢x7+2⁢x1⁢x9+2⁢x10⁢x2+2⁢x11⁢x3+2⁢x12⁢x4+2⁢x2⁢x6+2⁢x3⁢x5+x42−x8,2⁢x0⁢x7+2⁢x1⁢x6+2⁢x1⁢x8+2⁢x10⁢x3+2⁢x11⁢x4+2⁢x12⁢x5+2⁢x2⁢x5+2⁢x2⁢x9+2⁢x3⁢x4−x7,2⁢x0⁢x6+2⁢x1⁢x5+2⁢x1⁢x7+2⁢x10⁢x4+2⁢x11⁢x5+2⁢x12⁢x6+2⁢x2⁢x4+2⁢x2⁢x8+x32+2⁢x3⁢x9−x6,2⁢x0⁢x5+2⁢x1⁢x4+2⁢x1⁢x6+2⁢x10⁢x5+2⁢x11⁢x6+2⁢x12⁢x7+2⁢x2⁢x3+2⁢x2⁢x7+2⁢x3⁢x8+2⁢x4⁢x9−x5,2⁢x0⁢x4+2⁢x1⁢x3+2⁢x1⁢x5+2⁢x10⁢x6+2⁢x11⁢x7+2⁢x12⁢x8+x22+2⁢x2⁢x6+2⁢x3⁢x7+2⁢x4⁢x8+2⁢x5⁢x9−x4,2⁢x0⁢x3+2⁢x1⁢x2+2⁢x1⁢x4+2⁢x10⁢x7+2⁢x11⁢x8+2⁢x12⁢x9+2⁢x2⁢x5+2⁢x3⁢x6+2⁢x4⁢x7+2⁢x5⁢x8+2⁢x6⁢x9−x3,2⁢x0⁢x2+x12+2⁢x1⁢x3+2⁢x10⁢x12+2⁢x10⁢x8+2⁢x11⁢x9+2⁢x2⁢x4+2⁢x3⁢x5+2⁢x4⁢x6+2⁢x5⁢x7+2⁢x6⁢x8+2⁢x7⁢x9−x2,2⁢x0⁢x1+2⁢x1⁢x2+2⁢x10⁢x11+2⁢x10⁢x9+2⁢x11⁢x12+2⁢x2⁢x3+2⁢x3⁢x4+2⁢x4⁢x5+2⁢x5⁢x6+2⁢x6⁢x7+2⁢x7⁢x8+2⁢x8⁢x9−x1,x02+2⁢x12+2⁢x102+2⁢x112+2⁢x122+2⁢x22+2⁢x32+2⁢x42+2⁢x52+2⁢x62+2⁢x72+2⁢x82+2⁢x92−x0,2⁢x12+2⁢x1+2⁢x11+x0+2⁢x10+2⁢x9+2⁢x2+2⁢x8+2⁢x3+2⁢x7+2⁢x4+2⁢x6+2⁢x5−1:
memory used=186.80MiB, alloc change=256.00MiB, cpu time=82.03s, real time=26.78s, gc time=93.75ms
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 ≔ x8⋅y4 + x4⋅y4 + x2⋅y2+1; subsx=y⋅z, y=2⋅z2,f; subsx=sqrtx, f; subsy=1x, f;
x4+3
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;
true
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 n−1 holes if each hole can contain at most one pigeon.
n ≔ 11:# Every pigeon is in a holePositiveClauses ≔ seqLogic:-`&or`seqxi, j, j = 1 .. n−1, i = 1 .. n:# No hole contains two pigeonsNegativeClauses ≔ seqseqseqLogic:-`&or`Logic:-`¬`xi, j, Logic:-`¬`xk, j, i = k+1 .. n, k = 1 .. n, j = 1 .. n−1:PHP ≔ Logic:-`&and`PositiveClauses, NegativeClauses:nopsPHP;
561
CodeTools:-UsageLogic:-SatisfiablePHP
false
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.
G≔Importexample/DSJC125.1.s6, base=datadir
G≔Graph 1: an undirected unweighted graph with 125 vertices and 736 edge(s)
CodeTools:-UsageGraphTheory:-ChromaticNumberG
memory used=266.60KiB, alloc change=10.94MiB, cpu time=48.00ms, real time=1.14s, gc time=0ns
5
The msolve command has been updated with a new solver for sparse linear equations for primes up to 231−1. 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
The inverse of a matrix with trigonometric functions is faster.
x≔ 1 + sina + cosb: A≔Matrix11x+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;
0.078
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; i:=0: for j to x do if isprime(j) then i := i + 1; end if; end do: return i; end proc:
timelimit(0.5,f(1000000));
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.
Download Help Document