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/
-~----------~----~----~----~------~----~------~--~---
- [sage-forum] Pyrex examples not working in sage 1.4.1 Techniq
- [sage-forum] Re: Pyrex examples not working in sage ... William Stein
- [sage-forum] Re: Pyrex examples not working in sage ... alex clemesha
- [sage-forum] Re: Pyrex examples not working in s... David Joyner
- [sage-forum] Re: Pyrex examples not working ... William Stein
- [sage-forum] Re: Pyrex examples not work... David Joyner
- [sage-forum] Re: Pyrex examples not working ... Justin C. Walker
- [sage-forum] Re: Pyrex examples not work... William Stein
- [sage-forum] Re: Pyrex examples not... alex clemesha
- [sage-forum] Re: Pyrex examples... alex clemesha
- [sage-forum] Re: Pyrex examples... William Stein
- [sage-forum] Re: Pyrex examples not... Justin C. Walker
- [sage-forum] Re: Pyrex examples... William Stein
