One thing I’ve been experimenting with recently is how much the form of an expression can affect Maple’s performance.

For example, two mathematically equivalent expressions can behave very differently when passed to simplify, solve, dsolve, or numerical procedures.

A useful workflow is to simplify and restructure the problem before asking Maple to do the expensive part.

For example:

restart:

expr := (x^2-1)/(x-1):

simplify(expr);

gives a much simpler expression, but in larger problems the same idea can make a surprisingly big difference.

I’ve also found it useful to inspect intermediate expressions rather than immediately running a large command:

interface(showassumed=0):

simplify(expr, symbolic);
factor(expr);
expand(expr);
collect(expr, x);

The interesting part is that Maple isn't necessarily “slow” because the underlying mathematics is difficult. Sometimes it is simply being asked to work with a representation that hides the structure of the problem.

For large symbolic calculations, I now tend to think of Maple as having two stages:

1. Prepare the mathematics

Reduce, factor, substitute, collect terms, exploit assumptions, and remove unnecessary complexity.

2. Let Maple perform the expensive computation

Only after the expression has been put into a useful form.

This seems particularly important with large nonlinear systems, symbolic integration, and differential equations.

A small change in representation can sometimes turn a calculation that takes minutes into one that takes seconds.

I’d be interested in seeing more examples where Maple's performance was improved simply by changing the mathematical representation of the problem.


Please Wait...