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

Online Help

All Products    Maple    MapleSim


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

Expanded Degree Range

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

31

15

15

15

15

Maximum total degree

4194302

65535

16380

5115

1023

255

255

567

310

341

180

195

210

15

 

Number of variables

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

Maximum partial degree

7

7

7

7

7

3

3

3

3

3

3

3

3

3

3

3

Maximum total degree

112

119

126

127

15

63

66

69

72

75

78

81

84

63

15

3

 

Determinant Benchmark

We compute determinants of n by n Vandermonde matrices in the variables {x1, x2, ..., xn}.  The determinant has n! terms and total degree nn12.  For n=4, the matrix and determinant are:

 

A:=LinearAlgebra:-VandermondeMatrixx1,x2,x3,x4

LinearAlgebra:-DeterminantA, method=minor

x13x22x3x13x22x4x13x2x32+x13x2x42+x13x32x4x13x3x42x12x23x3+x12x23x4+x12x2x33x12x2x43x12x33x4+x12x3x43+x1x23x32x1x23x42x1x22x33+x1x22x43+x1x33x42x1x32x43x23x32x4+x23x3x42+x22x33x4x22x3x43x2x33x42+x2x32x43

(2.1)

 

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.

 

 

Faster Dense Algorithms

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.

crand1..ceil2evalfbn:

fexpandmulrandpolycatx,i,degree=d,dense,coeffs=c,i=1.. n:

gexpandmulrandpolycatx,i,degree=d,dense,coeffs=c,i=1.. n:

CodeTools:-Usagedivideexpandfg,f,'q':

 

 

Polynomial Powers

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:

 

 

Computations Modulo p

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.

 

p32003:k10000:

vseqcatx,i,i=1..n:

eseqi=rand,i=vmodp:

frandpolyv,degree=2,dense:

grandpolyv,degree=2,dense:

rCodeTools:-UsageseqExpandf+igmodp,i=1..k:

CodeTools:-UsageseqDividei,g,'q'modp,i=r:

CodeTools:-UsageseqEvali,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.

 

 

See Also

Performance Improvements in Maple 18, What's New in Maple 18