ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 05 Dec 2011 13:32:59 -0600len(list) & ceil(log(4,2)) bugshttp://ask.sagemath.org/question/8533/lenlist-ceillog42-bugs/I was programming functions in Sage for Big numbers and found a few bugs.<br>
I emailed Jason-sage and he suggested this forum.<br>
I hope my contributions can help building a better system.<br>
I run Sage 4.7.2 in a new Firefox offline via the Oracle Virtual Box for Fedora on an old Windows Vista, so that could have something to do with it.<br>
<br>
BUG:<br>
Suddenly the Python len(list) function wasn't working anymore on a simple <code>[1,2,3]</code><br> array.<br>
SOLUTION:<br>
I repasted the same code on a new Worksheet and the len() function could be called again.<br>
<br>
BUG:<br>
I had output that was becoming very slow for mysterious reasons (a 2 to 3 seconds time lag) for some simple small values. I used <code>t = cputime()</code> before and <code>cputime(t)</code> after blocks of code and found the responsible...<br>
CODE INSIDE FUNCTION:
<pre>def myfunction(num): # stops for up to 3 seconds if num == 4
t = cputime();
sad = ceil(log(num, 2));
print(cputime(t));
for m in range(2,12):
myfunction(m);</pre>
The problem is the <code>ceil()</code> around the <code>log()</code> I believe, but why at 4 and why only when that 4 is a function argument (not a local variable or a hard-coded 4) that is originally part of a range array?<br>
SOLUTION:<br>
<pre> happy = ceil(log(num+0, 2));</pre>
These bugs seem to an innocent amateur like me that Sage is an unstable system.<br>
However, I love the potential of this software!<br>
Best Regards, GigaGerard
GigaGerardMon, 05 Dec 2011 13:32:59 -0600http://ask.sagemath.org/question/8533/