error at mpf

2 views
Skip to first unread message

lopmart

unread,
Mar 22, 2008, 7:31:56 AM3/22/08
to SympyCore
hi

i try to convert Calculus to float, and l get the next error


File "C:\Model.py", line 173, in <module>
Buno=(expr.subs(list).evalf().to_Float())
File "C:\Python25\lib\site-packages\sympycore\calculus\algebra.py",
line 132, in to_Float
f = self.evalf(n)
File "C:\Python25\lib\site-packages\sympycore\calculus\algebra.py",
line 122, in evalf
return self.Number(evalf(self.data, n))
File "C:\Python25\lib\site-packages\sympycore\arithmetic\evalf.py",
line 53, in evalf
return mpmath_to_numbers(eval(s, vars(mpmath)), digits)
File "<string>", line 1
mpf(5.465)e-mpf(3)
^
SyntaxError: invalid syntax


Buno is float

thanks for your help


Pearu Peterson

unread,
Mar 22, 2008, 7:46:04 AM3/22/08
to SympyCore

Hi,
This is clearly a bug in 0.1. I believe that this is not present
in the svn version of sympycore:
>> Calculus(1.23e-45).evalf()
Calculus('1.23e-45')

So, you can either use sympycore from svn (it may give
some speedup upto 2x) or use the following workaround:

Buno=float(expr.subs(list).data)

It will work only if expr.subs(list) is a number.

HTH,
Pearu

lopmart

unread,
Mar 22, 2008, 11:03:53 PM3/22/08
to SympyCore

hi,


thanks for you help

im going to research how to install sympycore 0.2 under windows os

Pearu Peterson

unread,
Mar 23, 2008, 4:33:46 AM3/23/08
to SympyCore


On Mar 23, 3:03 am, lopmart <lopm...@gmail.com> wrote:

> im going to research how to install sympycore 0.2 under windows os

I just uploaded a new windows installer for sympycore 0.2-svn (built
on Ubuntu using wine-mingw combination!) to

http://code.google.com/p/sympycore/downloads/list

HTH,
Pearu

lopmart

unread,
Mar 24, 2008, 3:50:25 PM3/24/08
to SympyCore
hi

i installed sympycore-0.2-svn.win32-py2.5.exe ( not uninstalled the
first version) and when run my program , get it the next error


from sympycore import *
File "C:\Python25\Lib\site-packages\sympycore\__init__.py", line 12,
in <module>
from basealgebra import *
File "C:\Python25\Lib\site-packages\sympycore\basealgebra
\__init__.py", line 7, in <module>
from .pairs import CollectingField
File "C:\Python25\Lib\site-packages\sympycore\basealgebra\pairs.py",
line 19, in <module>
from ..arithmetic.numbers import mpq, realtypes
File "C:\Python25\Lib\site-packages\sympycore\arithmetic
\__init__.py", line 12, in <module>
from . import mpmath
File "C:\Python25\Lib\site-packages\sympycore\arithmetic\mpmath
\__init__.py", line 3, in <module>
from mptypes import *
File "C:\Python25\Lib\site-packages\sympycore\arithmetic\mpmath
\mptypes.py", line 23, in <module>
'nearest' : round_nearest,
NameError: name 'round_nearest' is not defined


which is my error? thanks for your time

Pearu Peterson

unread,
Mar 24, 2008, 4:00:00 PM3/24/08
to SympyCore
You should remove the last version before installing new sympycore
version.

This error occurs because mpmath is picking up mpmath\lib\ package
(that should not exist
in the mpmath package anymore) instead of the module mpmath\lib.py.

You have the following options:
1) Remove sympycore directory in c:\Python25\Lib\site-package\
directory and reinstall sympycore-0.2-svn
2) Or remove the following directories
c:\Python25\Lib\site-package\sympycore\arithmetic\mpmath\lib\
c:\Python25\Lib\site-package\sympycore\arithmetic\mpmath\apps\
then sympycore should be functional again.

HTH,
Pearu

lopmart

unread,
Mar 24, 2008, 11:52:42 PM3/24/08
to SympyCore
hi

it works!

thank you for your help again
Reply all
Reply to author
Forward
0 new messages