Hello,
I play with the timeit function because I want to test the asymptotic
time of complexity for (pseudo-)lists in sage.
I test
timeit('n=5;[2*x for x in [1..10^n]]')
This line is well evaluate and I get a linear answer when I change n
from 2 to 7.
I may add the parameter repeat=1 and number=1 in the timer call.
I get an error if I add a preparse=False, why not... I don't understand
and I don't use it.
Now I try the insert method.
I can evaluate
n=5;L=[] # a new line
timeit('for k in [1..10^n] : L = []')
But I can't evaluate
timeit('n=5;L=[];for k in [0..10^n] : L = []')
And I get the same error when I remplace L=[] by L.insert(k,0) or
L.insert(0,0)
But the eval is possible with timer("""...with 3 lines...""")
So when can I use a semicolon ; as a=4;b=a^4 ? and when can't ?
And a second question : I don't find any example in python documentation
for list with .. as [1..100].
Is it a standard python or a sage feature ?
Is sage a huge library over a standard python ? or has sage any syntax
feature ?
I discover the *arg in defined function by def (in sage and the usual
python)
But I don't find any factorial by n! nor lambda function defined with a
arrow +-> or ->
François
--~--~---------~--~----~------------~-------~--~----~
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/sage-support
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---