a test: sympycore expand versus maxima expand

63 views
Skip to first unread message

Pearu Peterson

unread,
Jan 3, 2008, 7:37:03 AM1/3/08
to Sympy Core
Hi,
Here is a nice result:

Maxima:
(%i56) t0:elapsed_real_time ()$ expand ((x + y+z)^100)$
elapsed_real_time ()-t0;
(%o58) 2.334953999999925
(%i62) t0:elapsed_real_time ()$ expand ((x + y+z)^20*(x+z)^19)$
elapsed_real_time ()-t0;
(%o64) .4762450000000626

sympycore:
>>> %time e=((x+y+z)**100).expand()
CPU times: user 0.45 s, sys: 0.01 s, total: 0.46 s
Wall time: 0.46
>>> %time e=((x+y+z)**20 * (y+x)**19).expand()
CPU times: user 0.18 s, sys: 0.00 s, total: 0.18 s
Wall time: 0.18

ie sympycore power expand is about 5 times faster than maximas and
arithmetics
about 2.5x faster for the given example.

Regards,
Pearu

Ondrej Certik

unread,
Jan 3, 2008, 8:48:35 AM1/3/08
to symp...@googlegroups.com

On my computer, I get these results:

sympycore:

In [11]: %time e=((x+y+z)**100).expand()
CPU times: user 0.58 s, sys: 0.00 s, total: 0.58 s
Wall time: 0.58

In [12]: %time e=((x+y+z)**20 * (y+x)**19).expand()
CPU times: user 0.27 s, sys: 0.00 s, total: 0.27 s
Wall time: 0.27


sympy:

In [1]: %time e=((x+y+z)**100).expand()
CPU times: user 38.32 s, sys: 0.04 s, total: 38.37 s
Wall time: 38.42

In [2]: %time e=((x+y+z)**20 * (y+x)**19).expand()
CPU times: user 18.61 s, sys: 0.02 s, total: 18.63 s
Wall time: 18.65


So, this shows, that sympy in pure Python can actually be as fast
(actually faster) as maxima. Wow.

I would like to port the improvements in sympycore to sympy, but I
don't have time for that. But I think it's currently the most
important thing that we should do.


Ondrej

Pearu Peterson

unread,
Jan 3, 2008, 3:33:56 PM1/3/08
to Sympy Core
Reply all
Reply to author
Forward
0 new messages