Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

using %cython in Cantor with sage backend

To use the %cython magic function in the sage notebook you can do something like:

%cython

from math import sin

def f(x):
    return sin(x**2)

def integral(double a, double b, int N):
    cdef double dx = (b-a)/N
    cdef int i
    cdef double s = 0
    for i in range(N):
        s += f(a+dx*i)
    return s * dx

But in cantor you can't since the sage mode in Cantor is not the same as the sage notebook. How can i do something like that in Cantor without using an external editor or without using more commands?