[IronPython] sympy on IP 2.6B2
Jeffrey Sax
jeffrey at extremeoptimization.com
Sun Jul 26 22:12:06 CEST 2009
I got sympy 0.6.5 running *without* frames by commenting out some lines:
sympy\__init__.py: line 44
# evalf._create_evalf_table()
Sympy\utilities\__init__.py: lines 14 and 18:
# from source import source
# from runtests import test, doctest
There are two more anomalies I'd like to report:
1. Performance
CPython 2.6:
>>> from time import time
>>> from sympy import Symbol, cos
>>> x = Symbol("x")
>>> a=time(); cos(x).diff(x,1000); time()-a
0.10899996757507324
IronPython 2.6b2:
>>> from time import time
>>> from sympy import Symbol, cos
>>> x = Symbol("x")
>>> a=time(); cos(x).diff(x,1000); time()-a
5.678321838378906
So IronPython is 50 times slower here on pure Python code.
2. Problem with '*' (splat operator)
Using the same setup code as above:
CPython 2.6:
>>> cos(x).series(x,0,10)
1 - x**2/2 + x**4/24 - x**6/720 + x**8/40320 + O(x**10)
IronPython 2.6b2:
>>> cos(x).series(x,0,10);
Traceback (most recent call last):
File "C:\Program Files
(x86)\Python26\Lib\site-packages\sympy\core\basic.py", line 2139, in series
File "C:\Program Files
(x86)\Python26\Lib\site-packages\sympy\core\basic.py", line 2206, in nseries
File "C:\Program Files
(x86)\Python26\Lib\site-packages\sympy\core\function.py", line 308, in
_eval_nseries
File "C:\Program Files
(x86)\Python26\Lib\site-packages\sympy\core\basic.py", line 2206, in nseries
File "C:\Program Files
(x86)\Python26\Lib\site-packages\sympy\core\mul.py", line 753, in
_eval_nseries
File "C:\Program Files
(x86)\Python26\Lib\site-packages\sympy\simplify\simplify.py", line 1008, in
powsimp
TypeError: __call__() argument after * must be a sequence, not generator
The offending line:
newexpr = Mul(newexpr, Mul(*(Pow(b,e) for b, e in c_powers.items())))
Oddly enough, something like:
>>> def f(*args):
... pass
...
>>> f(*(x for x in range(3)))
works fine, but
>>> from sympy import Mul
>>> Mul(*(x for x in range(3)))
does not. Mul is the type that represents a multiplication operation in
sympy.
Jeffrey
-----Original Message-----
From: users-bounces at lists.ironpython.com
[mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland
Sent: July-24-09 4:50 PM
To: Discussion of IronPython
Subject: Re: [IronPython] sympy on IP 2.6B2
-X:FullFrames promotes all local variables into the heap. So you can
always crawl the stack and look/change them for all methods.
-X:Frames only creates the frame objects and if something happens to
make us promote local variables (e.g. a closure, or a call to locals(),
exec, eval, dir(), vars()) then the local variables will be available
for that specific method.
More information about the Ironpython-users
mailing list