Improvements for Polynomials
Maple 18 builds upon the efficiency improvements of earlier releases for multivariate polynomial operations. More polynomials now take advantage of the high performance data structure introduced in Maple 17, further improvements has been made to Maple’s performance for large computations, and polynomial computations modulo p are now significantly faster. As a result of these changes, computations that explicitly rely on polynomials, as well as the many Maple library routines that rely on underlying polynomial computations, are now faster.
Expanded Degree Range
Determinant Benchmark
Faster Dense Algorithms
Polynomial Powers
Computations Modulo p
See Also
In Maple 18, the maximum degree range of polynomials that can be stored in the new data structure has been expanded. In Maple 17, a polynomial in n variables used 64n+1 bits to store the total degree and each of the n exponents. Thus, the maximum total degree was equal to the maximum partial degree in Maple 17. For most values of n, this is needlessly restrictive. For example, for n=11 variables there are five bits per exponent and five bits for the total degree, leaving four bits unused. In Maple 18, the extra bits are given to the total degree, which allows a much greater range of polynomials to be stored in the new data structure. The practical limits for a 64-bit machine are shown below, and we have highlighted cases where we are limited by the bits available for the total degree. In most cases, we can store the sum of maximum partial degrees.
Number of variables
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Maximum partial degree
2097151
65535
4095
1023
511
255
127
63
31
Maximum total degree
4194302
16380
5115
567
310
341
180
195
210
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
112
119
126
66
69
72
75
78
81
84
We compute determinants of n by n Vandermonde matrices in the variables {x1, x2, ..., xn}. The determinant has n! terms and total degree n⁢n−12. For n=4, the matrix and determinant are:
A:=LinearAlgebra:-VandermondeMatrix⁡x1,x2,x3,x4
LinearAlgebra:-DeterminantA, method=minor
x13⁢x22⁢x3−x13⁢x22⁢x4−x13⁢x2⁢x32+x13⁢x2⁢x42+x13⁢x32⁢x4−x13⁢x3⁢x42−x12⁢x23⁢x3+x12⁢x23⁢x4+x12⁢x2⁢x33−x12⁢x2⁢x43−x12⁢x33⁢x4+x12⁢x3⁢x43+x1⁢x23⁢x32−x1⁢x23⁢x42−x1⁢x22⁢x33+x1⁢x22⁢x43+x1⁢x33⁢x42−x1⁢x32⁢x43−x23⁢x32⁢x4+x23⁢x3⁢x42+x22⁢x33⁢x4−x22⁢x3⁢x43−x2⁢x33⁢x42+x2⁢x32⁢x43
The benchmark was performed on an Intel Core i7 3930K 3.2 GHz with 64 GB RAM running 64-bit Linux. Maple 16 uses the traditional "sum of products" data structure for all polynomials. Maple 17 uses the new polynomial data structure for determinants up to n=9, but for n=10 the total degree field overflows and performance degrades. The extra degree bits in Maple 18 allow the computation to reach n=12,which produces 479 million terms.
Maple 18 uses Kronecker substitution to multiply and divide dense polynomials in subquadratic time. Performance has been improved with an upgrade to GMP 5.1.1 and tweaks to Maple's garbage collector. Below, we multiply and divide dense polynomials in n variables with degree d in each variable and b bit coefficients. The benchmark was performed on an Intel Core i5 4670 3.4 GHz with 16 GB RAM running 64-bit Linux.
c≔rand1..ceil⁡2evalf⁡bn:
f≔expandmul⁡randpoly⁡cat⁡x,i,degree=d,dense,coeffs=c,i=1.. n:
g≔expandmul⁡randpoly⁡cat⁡x,i,degree=d,dense,coeffs=c,i=1.. n:
CodeTools:-Usagedivide⁡expand⁡f⋅g,f,'q':
Maple 18 uses a new algorithm to expand powers of short polynomials. This complements square and multiply (used for dense polynomials) and repeated multiplication (used for sparse polynomials). An improved heuristic selects among these algorithms. The timings below are on an Intel Core i5 4670 3.4 GHz with 16 GB RAM running 64-bit Linux.
f ≔ randpolyseqcatx,i,i=1.. n,degree=d,dense:CodeTools:-Usageexpandfk:
Prior to Maple 18, polynomial computations over Zp called interpreted Maple library routines. This incurred significant overhead for small operations. For this release, we implemented Eval, Expand, and Divide in the kernel in C for the non-algebraic number case. Their performance is comparable to eval, expand, and divide, except that numbers are reduced to modulo p to prevent expression swell. The benchmark below times these operations for small polynomials on an Intel Core i5 4670 3.4 GHz with 16 GB RAM running 64-bit Linux.
p≔32003:k≔10000:
v≔seq⁡cat⁡x,i,i=1..n:
e≔seq⁡i=rand⁡,i=vmodp:
f≔randpolyv,degree=2,dense:
g≔randpolyv,degree=2,dense:
r≔CodeTools:-Usageseq⁡Expand⁡f+i⁢gmodp,i=1..k:
CodeTools:-Usage⁡seq⁡Divide⁡i,g,'q'modp,i=r:
CodeTools:-Usage⁡seq⁡Eval⁡i,emodp,i=r:
The bar chart below shows the overall times for each n, with the times for Eval on top of the times for Divide and the times for Expand on the bottom.
Performance Improvements in Maple 18, What's New in Maple 18
Download Help Document