Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Well, let me answer my own question

At least i can do this in Cantor, within a code block:

cython(r"""
from math import sin

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

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

""")

It is not that clean as in the notebook but works nice. Is there another solution ?