On Sun, Mar 30, 2008 at 8:32 PM, Mike Hansen <[EMAIL PROTECTED]> wrote: > > Hello, > > I definitely don't get the same results as you. Here's my Sage > session: > > sage: import math > sage: l = lambda x: -3*x^7 - 2*x^3 + 2*math.exp(x^2) + > x^12*(2*math.exp(2*x) - math.pi*math.sin(x)^((-1) + > math.pi)*math.cos(x)) + 4*(math.pi^5 + x^5 + 5*math.pi*x^4 + > 5*x*math.pi^4 + 10*math.pi^2*x^3 + 10*math.pi^3*x^2)*math.exp(123 + x > > - x^5 + 2*x^4) > sage: f = -3*x^7 - 2*x^3 + 2*exp(x^2) + x^12*(2*exp(2*x) - > > pi*sin(x)^((-1) + pi)*cos(x)) + 4*(pi^5 + x^5 + 5*pi*x^4 + 5*x*pi^4 + > 10*pi^2*x^3 + 10*pi^3*x^2)*exp(123 + x - x^5 + 2*x^4) > sage: ff = f._fast_float_(x) > sage: l(0.01) > 3.29059638451369e56 > sage: ff(0.01) > 3.2905963845136858e+56 > sage: vals = [ i/float(1000.0) for i in range(1001)] > sage: timeit("for i in vals: l(i)") > 5 loops, best of 3: 280 ms per loop > sage: timeit("for i in vals: ff(i)") > 125 loops, best of 3: 3.47 ms per loop > sage: timeit('ff(1.0r)') > 625 loops, best of 3: 6.03 µs per loop > > The Python lambda is I get is quite a bit slower than yours, and it > looks like fast_float is about 50x faster than lambda.
Thanks Mike for your replies. According to: http://groups.google.com/group/sage-devel/browse_thread/thread/b7e6f93aeede6c1e/ you are the 6th most active Sage developer. Congratulations. :) Ondrej --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---