CoCalc Public Filessupport / 2015-01-19-expand-speed.sagewsOpen with one click!
Authors: Gihan Marasingha, Harald Schilly, ℏal Snyder, William A. Stein
Description: Jupyter notebook support/2015-06-04-141749-bokeh.ipynb
K.<sqrt3> = QuadraticField(3) R.<a1,a2,a3,a4,a5> = K[] timeit("(a1+a2+a3+a4+sqrt3*a5)^25")
5 loops, best of 3: 317 ms per loop
%timeit (a1+a2+a3+a4+sqrt3*a5)^2
625 loops, best of 3: 145 µs per loop
%timeit expand((a1+a2+a3+a4+sqrt3*a5)^2)
625 loops, best of 3: 156 µs per loop
a1 + a2
timeit("a = (a1+a2+a3+a4+sqrt3*a5)^25")
5 loops, best of 3: 361 ms per loop
Error in lines 1-1 Traceback (most recent call last): File "/projects/4a5f0542-5873-4eed-a85c-a18c706e8bcd/.sagemathcloud/", line 876, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 1, in <module> File "/projects/4a5f0542-5873-4eed-a85c-a18c706e8bcd/.sagemathcloud/", line 1482, in timeit go(*args) File "/projects/4a5f0542-5873-4eed-a85c-a18c706e8bcd/.sagemathcloud/", line 1478, in go print sage.misc.sage_timeit.sage_timeit(code, globals_dict=salvus.namespace, **kwds) File "/usr/local/sage/sage-6.4/local/lib/python2.7/site-packages/sage/misc/", line 242, in sage_timeit series = [s/number for s in timer.repeat(repeat, number)] File "/usr/local/sage/sage-6.4/local/lib/python/", line 223, in repeat t = self.timeit(number) File "/usr/local/sage/sage-6.4/local/lib/python/", line 195, in timeit timing = self.inner(it, self.timer) File "<magic-timeit>", line 6, in inner File "/usr/local/sage/sage-6.4/local/lib/python2.7/site-packages/sage/calculus/", line 433, in expand return x.expand(*args, **kwds) File "sage/symbolic/expression.pyx", line 3787, in sage.symbolic.expression.Expression.expand (build/cythonized/sage/symbolic/expression.cpp:22037) File "sage/ext/c_lib.pyx", line 73, in sage.ext.c_lib.sig_raise_exception (build/cythonized/sage/ext/c_lib.c:769) KeyboardInterrupt