To my understanding, the function Simplify[] and FullSimplify[] work by applying a series of built-in transformation rules to the expression and trying to minimize the TransformationFunctions in the process, which by default is LeafCount[].

In my recent work I need to simplify a lot of symbolic expressions involving elementary functions as well as a special function Erfc[]. While Simplify works fine for simple expressions, it is extremely time-consuming for more complicated expressions. Some complicated expressions take days to be simplified. And FullSimplify[] takes hours even for very simple expressions. I do not have much experience in symbolic computation, and I desperately need some help.

Specifically, is there any general suggestions to accelerate Simplify[] or FullSimplify[]? For example, in order to accelerate it, is it possible to:

  1. Change the default ComplexityFunction?
  2. Change the default TransformationFunctions?
  3. Utilize parallel computation?
  4. Utilize Compile?

If they are possible, how should I do those things? Also, what is a suitable value for TimeConstraint?

  • 1
    $\begingroup$ 1: Yes, see documentation of ComplexityFunction; 2: Yes, see documentation of TransformationFunctions; 3: No (unless you can split up your expressions). 4 No. $\endgroup$ Commented Oct 8, 2015 at 11:04
  • $\begingroup$ @SjoerdC.deVries Thanks for the comment. Of course I am ALLOWED to change these; that I am well aware of. My questions is whether it is possible to change them to accelerate the computation, and how to do that : ) $\endgroup$
    – Y.X
    Commented Oct 8, 2015 at 12:36
  • $\begingroup$ You state that LeafCount is the current ComplexityFunction. That is not entirely true. You can find information about the actual function at the bottom of the ComplexityFunction page. It uses some extra stuff to take complexity of the numbers used in your expression into account. You might try changing the default function to LeafCount to see whether that helps. $\endgroup$ Commented Oct 8, 2015 at 12:44
  • $\begingroup$ Using TransformationFunctions to reduce the number of transformations will quite logically reduce time, but will, at the same time, probably have a negative impact on the results. $\endgroup$ Commented Oct 8, 2015 at 12:46
  • 4
    $\begingroup$ I've found that the best way to speed up simplifications is to first think for yourself which parts are never going to simplify together, like two independent parameters a, b for example, or perhaps in your example the Erfc[] is not going to simplify with the elementary functions. Then you use instead of Simplify[expression], Collect[expression,{a,b,Erfc[_]},Simplify]. This way you prevent mathematica from working on parts of the problem you know won't simplify. $\endgroup$
    – Jansen
    Commented Oct 8, 2015 at 19:29

1 Answer 1


Without a test expression, I can give some ideas that have worked. I'm not sure there's an idea that always works.

Often the problem is probably the combinatorial explosion of things to try as an expression grows large.

Simplify will do less and do it faster; sometimes it helps. Likewise, putting a TimeConstraint on the first call makes it do less faster. If the quick one does lots of little simplifications it can make the big simplification faster.

Simplify[Simplify[expr, TimeConstraint -> 0.1]]

For a similar reason, simplifying part of the expression first can help.

Simplify[Map[Simplify, expr, {5}]]
Simplify[Map[Simplify, expr, {-5}]]

You can put FullSimplify for Simplify as might be needed. FullSimplify will tackle special functions; Simplify will not.

If you know something about the structure of expr, some approaches will seem more likely than others to be successful.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.