On Wed, Jan 13, 2010 at 4:30 AM, mindcorrosive <[email protected]> wrote: > I've got a problem when evaluating exponents using sympy (class > sympy.exp). Small code sample: > > import sympy as sy > a=sy.exp(10)+sy.exp(20) > print a > >>> exp(10) + exp(20) > > All is well and good, but I'd like to evaluate the expression (which > is obviously a constant). I try simply to convert it into a float: > > b=float(a) > > and get an exception > (trace omitted) > TypeError: unsupported operand type(s) for >>: 'long' and 'float' > > If "a" would have been > > a=sy.exp(10) > > then the conversion works as expected. > > Perhaps I'm not doing it the right way? I couldn't find an obvious way > to handle this. > > If that's relevant, I'm running Py2.4, sympy 0.6.6 on win32.
This works on linux (latest sympy, both python2.4 and 2.6): In [2]: a = exp(10) + exp(20) In [3]: a Out[3]: 10 20 ℯ + ℯ In [4]: float(a) Out[4]: 485187221.876 so you found a bug. Could you please post the whole traceback? Let's fix it. Ondrej
-- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
