compareCython
%cython cdef double cf(double x): return x**2 - 2 * x def cintegre(double a, double b, int N): cdef int i cdef double s, dx s = 0 dx = (b - a) / N for i from 0 <= i < N: s += cf(a + i*dx) return s*dx
__home_moi...11_code_sage7_spyx.c
   
__home_moi...code_sage7_spyx.html
timeit('cintegre(0.,2.,2^20)')
125 loops, best of 3: 4.84 ms per loop