# Re: fyi, updated a CAS simplification comparing Mathematica with Maple

Nasser M. Abbasi <nma@xxxxxxxxx> wrote:

Updated the page

http://12000.org/my_notes/simplification_in_CAS/index.htm

Notice, I used simplify(expr,size) for Maple and
not simplify(expr).

I just can't understand how fast Maple did this test. It
must be optimized for 'size'. If I do not use 'size' option
for simplify, then it is not as fast.

The reduction percentage now is about the same for large
expressions (x^8,x^16), but Mathematica having a better
reduction percentage for the smaller sized expressions
(x,x^2,x^4). But the actual LeafCount is smaller for
Maple.

I could not do x^32. waited for 8 hrs so I stopped it.
Need bigger PC.

FYI, in developement version of FriCAS the 'normalize' function
can simplify the result to 1:

(13) -> x32 := x^32;

Type: Expression(Integer)
Time: 2.54 (EV) = 2.54 sec
(14) -> normalize(x32)

(14) 1
Type: Expression(Integer)
Time: 0.10 (EV) = 0.10 sec

The released version in 'normalize' code to do this, but due to a bug
'normalize' was producing expression which more complex than the
original. For other powers the result are as follows:

Expand simplify number of terms after expand
(compute) (normalize) in x^n
x^2 0.002 0.01 18
x^4 0.002 0.01 40
x^8 0.01 0.02 108
x^16 0.05 0.03 340
x^32 2.54 0.10 1188

Note that FriCAS always expands and applies basic simplifcations
to expressions. Also, LeafCount makes little sense for FriCAS
because expressions are represented as mutivariate rational
functions of kernels, with each kernel stored only once.
So for FriCAS number of terms is correct measure of size.
To get something comparable to Mathematica LeafCount you
should multiply number of terms by factor of order 10-30
(for single term Mathematica reports LeafCount 30, however
the the way in which FriCAS stores expression would create
some common subexpressions lowering LeafCount of the result).

BTW, Derive result is interesting -- it finds dependence
between two of logs which considerably simplifies the result
(AFAICS it is much smaller than MM-s result after simplification).
OTOH Derive misses fact that all three logs are dependent,
which FriCAS notices and which is necessary to get 1 as
the result.

--
Waldek Hebisch
hebisch@xxxxxxxxxxxxxxxx
.

• Follow-Ups: