Nasser M. Abbasi, May 10, 2012
A summary of the above older version is here
This version only shows the final result using an updated version of Mathematica and Maple, but does not show each expression generated. When I have more time I hope to also show those in this updated version.
For this version I used Mathematica 8.04 and Maple 14, both on windows 7.
The PC is intel i7 930 @ 2.8 Ghz with 8 GB memory.
This is the result of doing a simplification measure on an expression using Maple and Mathematica using an expression posted on sci.math.symbolic by Dr Carlos.
The expression given in the original post can be found at
http://sci4um.com/about26200.html
xnum = ((6-4*Sqrt[2])*Log[3-2*Sqrt[2]]+(3-2*Sqrt[2])*Log[17-12*Sqrt[2]]+32-24*Sqrt[2]); xden = (48*Sqrt[2]-72)*(Log[Sqrt[2]+1]+Sqrt[2])/3; x = xnum/xden; The answer is x = 1
Expand[] in Mathematica
and expand() in Maple are then applied to
Mathematica has both Simplify[expr] and FullSimplify[expr] and Maple
has simplify(expr,size) and simplify(expr). Here, I used
only the simplify(expr,size) since I used LeafCount.
The tables below show the result of using both functions in each system.
The tables show the size of the expression before and after simplification, the percentage in size reduction and the cpu time used.
xnum = ((6-4*Sqrt[2])*Log[3-2*Sqrt[2]]+(3-2*Sqrt[2])*Log[17-12*Sqrt[2]]+32-24*Sqrt[2]);
xden = (48*Sqrt[2]-72)*(Log[Sqrt[2]+1]+Sqrt[2])/3;
x = xnum/xden;
xtab = Expand[{x,x^2,x^4,x^8,x^16}];
n = Length[xtab];
stab = Table[0,{n},{4}];
For[i=1,i<= n,i++,
{
stab[[i,1]] = LeafCount[xtab[[i]]];
s = Timing[Simplify[ xtab[[i]] ]]; (*use FullSimplify or Simplify *)
stab[[i,2]] = LeafCount[ s[[2]] ];
stab[[i,3]] = s[[1]];
stab[[i,4]] = Round[100.0*stab[[i,2]]/stab[[i,1]]];
}
];
Grid[Join[{{"leaf count before","leaf count after","cpu","% reduction"}},stab],
Frame->All
]
with(MmaTranslator[Mma]) to access the
function LeafCount().
Source code
restart;
with(MmaTranslator[Mma]):
xnum := ((6-4*sqrt(2))*ln(3-2*sqrt(2))+(3-2*sqrt(2))*ln(17-12*sqrt(2))+32-24*sqrt(2)):
xden := (48*sqrt(2)-72)*(ln(sqrt(2)+1)+sqrt(2))/3:
x := xnum/xden:
n:=5:
stab := Matrix(5,4,0): #Matrix where to keep track of stats
xtab : =expand({x,x^2,x^4,x^8,x^16}):
for i from 1 to n do
stab[i,1]:= LeafCount(xtab[i]):
startingTime := time():
s := simplify(xtab[i],size):
stab[i,3] := time()-startingTime:
stab[i,2] := LeafCount(s):
stab[i,4] := ceil(100.*stab[i,2]/stab[i,1]):
od:
stab;
Columns have the same meaning as above.
restart;
xnum := ((6-4*sqrt(2))*ln(3-2*sqrt(2))+(3-2*sqrt(2))*ln(17-12*sqrt(2))+32-24*sqrt(2)):
xden := (48*sqrt(2)-72)*(ln(sqrt(2)+1)+sqrt(2))/3:
x := xnum/xden:
n := 5:
stab := Matrix(5,4,0): #Matrix where to keep track of stats
xtab := expand({x,x^2,x^4,x^8,x^16}):
for i from 1 to n do
stab[i,1]:=length(xtab[i]):
startingTime := time():
s := simplify(xtab[i],size):
stab[i,3] := time() - startingTime:
stab[i,2] := length(s):
stab[i,4] := ceil(100.*stab[i,2]/stab[i,1]):
od:
stab;
Columns have the same meaning as above.
| Maple 14 | Mathematica 8.04 |
![]() |
![]() |
| Maple 14 | Mathematica 8.04 |
![]() |
![]() |
me 2012-06-02