>> Thanks for doing all this!  See Sage integrates into your
>> environment after all :-).
>
> Yes and it made me pretty excited!! Only it's 4x slower than sympy:

Is that "4 x" all Sage startup time, i.e., the time to do
"from sage.all import *"?  Shouldn't you time something
like this:

sage: timeit('integrate(x^2/3 - log(x))')
5 loops, best of 3: 39.5 ms per loop

versus in sympy:

sage: from sympy import *
sage: x = var("x")
sage: timeit('integrate(x**int(2)/int(3)-log(x), x)')
5 loops, best of 3: 78.9 ms per loop

Hey, that's interesting that Sage can convert
an expression to maxima, have maxima do the
integral, get the result back from maxima, parse
the result using regexps and eval, and get the
answer twice as quickly as sympy does the
integral natively....

So there are two components, startup time and
doing the integration.  The startup time totally
swamps the time of integration.

Since the sage you're using undoubtedly imports
sympy racing the two is a little unfair, plus there
is also the startup time for Maxima.

By the way sympy is imported by every startup
of sage even in 3.0.4, though we'll deal with that soon
enough:

teragon-2:build was$ ./sage-3.0.4.rc0/sage -startuptime |grep sympy
            sympy: 0.098 (sage.calculus.calculus)
...

---




>
> [EMAIL PROTECTED]:~/sympy$ time
> LD_LIBRARY_PATH=/home/ondra/ext/sage/local/lib python s.py
>
>                                   2
>                                  x
>                                  -- - log(x)
>                                  3
>
>                                            3
>                                           x
>                              - x log(x) + -- + x
>                                           9
>
> real    0m2.065s
> user    0m1.308s
> sys     0m0.280s
> [EMAIL PROTECTED]:~/sympy$ time
> LD_LIBRARY_PATH=/home/ondra/ext/sage/local/lib python s2.py
>           2
>          x
> -log(x) + ──
>          3
>                3
>               x
> x - x*log(x) + ──
>               9
>
> real    0m0.454s
> user    0m0.408s
> sys     0m0.048s
>
>
> where s.py is the script in the wiki and s2.py is this:
>
> from sympy import *
> var("x")
> e = x**2/3-log(x)
> pprint(e)
> pprint(integrate(e, x))
>
>
>
>
> But honestly, 0.5s for sympy is too much too. I wonder why it is so slow.
>
> Ondrej
>
> >
>



-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to