Hi,

It looks as though that example is a little messed up!

#do this in a cell
%pyrex
def sumsquares(int n):
    cdef int i, j
    j = 0
    for i from 1 <= i <= n:
        j = j + i*i
    return j

#do this in the next cell to test *pyrex* function:
time v=[sumsquares(100) for _ in xrange(10000)]


#in another cell do this:
two = int(2)
def sumsquarespy(n):
    return sum(i**two for i in xrange(1,n+1))

#do this in the next cell to test *python* function:
time v=[sumsquarespy(100) for _ in xrange(10000)]

Hope that helps
-Alex



--~--~---------~--~----~------------~-------~--~----~
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-forum
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to