Simplification test. Comparison between Maple and Mathemtica
Updated March 12, 2007 by Nasser M. Abbasi
This document can be downloaded in PDF format here.
March 12, 2007: Added more tests using Maple simplify() command with option called size. I learned about this new option for simplify, which is designed to reduce the size of the expression, from Maple help:
This is result of doing informal simplification measure on expressions using Maple and Mathematica based on script posted on sci.math.symbolic by Dr Carlos and slightly changed by me for formatting purposes and to add a new calculation for the percentage of the size of the expression after simplification to that before the simplification.
Maple used: Version 11 on Windows XP
Mathematica used: Version 5.2 on Windows XP
PC: Intel P4, 2.4 GHz, 750 MB RAM.
For the Mathematica tests, one test used Simplify and the second used FullSimplify. Both tested used LeafCount command to count the size of the expression. Before start of each test, the Mathematic Kernel was restarted.
For Maple, 2 tests are done, Both use the length() command as a measure of size of expression. In one test simplify() was called, and in the second test simplify() with the option size, which is designed to reduce the size of the expression.
For N=1, Maple, using simplify() without the size option, was able to obtain a size=1 after simplification. This is good. For tests N=2,3,4,5 (i.e. as the expression size is increasing), the size of the expression after simplification was about 42% to about 50% compared to the size of the expression before simplification.
Mathematica was not able to obtain size=1 using either Simplify nor FullSimplify for N=1, but on average, the final size of the expression was about half that of Maple final size of expression when Maple test was done using simplify().
However, when using Maple simplify() command with the size option, Maple was able to reduce the size of the expression to about the same size as Mathematica (few percentage off) and Maple did this in an amazing speed.
However, since with Maple, the length() function was used to determine the size of the expression, and with Mathematica, the function LeafCount was used, it is not clear to me that this is a completely valid comparison as the complexity reduction of the expression might not be reflected similarly. This is why I included an image of each test output for comparison so as to allow one to visually see for themselves.
For Mathematica, Using Simplify, Mathematica achieved a simplification in range of 22% to 35%. While using FullSimplify, the simplification ranged from 17% to 26%. This shows that FullSimplify can achieve about 10% more simplification than Simplify.
It is also interesting to notice that with Mathematica, as the size of the expression increased (N=4 and N=5), FullSimplify achieved the same simplification reduction as Simplify did, but using much more CPU time. For N=5, FullSimplify CPU usage increased dramatically. One might conclude that using FullSimplify for larger expression is not as efficient as using it for smaller expressions. It looks like FullSimplify might needs to be tuned up more for larger expressions?
Using FullSimplify was most productive for N=1 and N=2, where percentage simplification improved by more than 10%
For the CPU time used by Simplification. Maple simplify() was much faster than Mathematica FullSimplify as expected since FullSimplify is designed to do more simplification on expressions. Maple simplify() CPU time ranged from 0.2 to 18.5 seconds. While Mathematica FullSimplify CPU time ranged from about 1.8 seconds to 518 seconds. Mathematica Simplify command on the other hand used less than 1 second.
> This is Maple implementation of simplification test posted on the internet
sci.symbolic news group. The original test was written in Mathematica by Dr Carlos.
For Maple, I run this test twice, once using simpify() and once using simplify() with the size option.
#names of indexes into matrix which collects the data into
ID:=1: BEFORE_COUNT:=2: AFTER_COUNT:=3: SIMPLIFY_CPU:=5:
stab:=Matrix(5,5,0): #Matrix where to keep track of stats
for i from 1 to n do