Performance - New Features in Maple 2020 - Maplesoft

What's New in Maple 2020

Performance

Maple 2020 improves the performance of several key functions.


Natural Logarithms 

In Maple 2020, the natural logarithm of large integers computes much faster and with less memory. 

On an i7-8650U processor, Maple 2020 computes the following in about 14 seconds. Maple 2019, however, takes 17 minutes 

restart; -1; a := `^`(2, `*`(`^`(10, 5), `*`(nextprime(`^`(10, 4))))); -1; length(a) 

301240717
 

CodeTools:-Usage(ln(a));  

 

memory used=3.99GiB, alloc change=244.86MiB, cpu time=15.14s, real time=15.21s, gc time=15.62ms
`+`(`*`(1000700000, `*`(ln(2))))
 

This directly translates to performance gains in computing logarithms in all integer bases, as they work by computing natural logarithms.


Factorial 

The factorial function is faster for large arguments. This case is about three times faster than in Maple 2019. 

threemillion := `+`(`*`(3, `*`(`^`(10, 6)))); -1

CodeTools:-Usage(length(factorial(threemillion))); 1

memory used=230.57MiB, alloc change=26.75MiB, cpu time=765.00ms, real time=759.00ms, gc time=0ns
18128484
 

Integer Least Common Multiple 

The integer least common multiple function (ilcm) has become much faster when called many times on smaller arguments. The following case is about ten times faster than in Maple 2019. 

N := `^`(10, 3); -1 

CodeTools:-Usage(seq(seq(ilcm(i, j), j = 1 .. N), i = 1 .. N)); -1 

memory used=62.21MiB, alloc change=-110.98MiB, cpu time=562.00ms, real time=538.00ms, gc time=62.50ms
 

Integration in the VectorCalculus and MultivariateCalculus Packages 

The integration commands from the VectorCalculus and MultivariateCalculus packages (and the corresponding Student subpackages) now use the collapsed rather than the nested form for multiple integration. This allows the outer integration steps to use and benefit directly from the knowledge of the ranges of the inner integration steps.This allows computation to complete more quickly for some examples, and to succeed in some examples which previously did not succeed or which required special assumptions to be made. The following example now computes in under one second, on a machine where previously it took 100 seconds unless executed under the assumption that abs(y)<z .
with(Student:-MultivariateCalculus); -1

MultiInt(`+`(`*`(4, `*`(`^`(`+`(`-`(`*`(`^`(y, 2))), `*`(`^`(z, 2))), `/`(3, 2)))), `*`(10, `*`(sqrt(`+`(`-`(`*`(`^`(y, 2))), `*`(`^`(z, 2))))))), y = `+`(`-`(z)) .. z, z = 0 .. 1, coordinates = carte...


`+`(`*`(`/`(59, 30), `*`(Pi)))


The following example now computes in approximately one second, whereas previously it used a prohibitively large amount of time and memory resources.
MultiInt(sqrt(`*`(x, `*`(y))), [x, y, z] = Tetrahedron(`<,>`(0, 0, 0), `<,>`(1, 0, 0), `<,>`(0, 1, 0), `<,>`(0, 0, 1)));

`+`(`*`(`/`(1, 96), `*`(Pi)))

 

The following examples erroneously returned 0 in Maple2019.
with(Student:-VectorCalculus); -1

int(`/`(`*`(exp(`+`(x, `*`(I, `*`(y))))), `*`(`+`(1, `-`(x), `*`(I, `*`(y))))), [x, y] = Circle(`<,>`(0, 0), 1));
 

`+`(`*`(2, `*`(Pi, `*`(`+`(`-`(`/`(1, 2)), `*`(`/`(1, 2), `*`(exp(1))))))))
 

int(`*`(exp(x), `*`(cos(y))), [x, y] = Circle(`<,>`(0, 0), 1));  

Pi
 

 

The following example now computes in a few seconds, but did not complete in Maple 2019.
int(`/`(1, `*`(`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2)), `*`(`^`(z, 2))))), [x, y, z] = Sphere(`<,>`(2, 0, 0), 1));
 

`+`(`-`(`*`(Pi, `*`(`+`(`-`(`*`(`/`(1, 2), `*`(arcsinh(`/`(4, 3))))), `-`(2), `*`(2, `*`(ln(3))))))))
 

The underlying structure of the returned inert form illustrates the change in behavior.
Ex := int(`/`(1, `*`(`+`(`*`(`^`(x, 2)), `*`(`^`(y, 2)), `*`(`^`(z, 2))))), [x, y, z] = Sphere(`<,>`(2, 0, 0), 1), inert);
 

Typesetting:-mprintslash([Ex := Int(Int(Int(`/`(`*`(`^`(r, 2), `*`(sin(phi))), `*`(`+`(`*`(4, `*`(r, `*`(sin(phi), `*`(cos(theta))))), `*`(`^`(r, 2)), 4))), theta = 0 .. `+`(`*`(2, `*`(Pi)))), phi = 0...
 

lprint(Ex); 1 

Int(r^2*sin(phi)/(4*r*sin(phi)*cos(theta)+r^2+4),[theta = 0 .. 2*Pi, phi = 0 ..
Pi, r = 0 .. 1])
 


Previously the inert form would consist of multiple, nested calls to Int.
lprint(IntegrationTools:-ExpandMultiple(Ex));
 

Int(Int(Int(r^2*sin(phi)/(4*r*sin(phi)*cos(theta)+r^2+4),theta = 0 .. 2*Pi),phi= 0 .. Pi),r = 0 .. 1)