Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

When I try this, it works for me, in one cell:

%cython
def sum_cython(long n):
    cdef long i, s = 0
    for i in range(n):
        s += i
    return s

And then in another cell:

sum_cython(10)

Results in: 45

(Sage Version 4.6)

When I try this, it It works for me, in one cell:me with: Sage Version 4.6 / Fedora 14 / libstdc++ 4.5.1 (i686) For whatever that's worth.

%cython
def sum_cython(long n):
    cdef long i, s = 0
    for i in range(n):
        s += i
    return s

And then in another cell:

sum_cython(10)

Results in: 45

(Sage Version 4.6)