Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168821
Image: ubuntu2004
%cython cdef extern from "math.h": double sin(double) cdef double f(double x) except *: return sin(x**2) def integrate(a, b, N): cdef int i cdef double dx, s=0 dx = (b-a)/N for i in range(N): s += f(a+i*dx) return s * dx
integrate(0,10,1e6)
0.58367343190152399