Functional cython implementation of Newton