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

def fp(x):
    return 2 * x

def Newton(f, y0, N):
    y = np.zeros(N + 1)
y[0] = y0
for n in range(N):
    y[n + 1] = y[n] - f(y[n]) / fp(y[n])
return y
print(Newton(f, 1, 10))
Метод Эйлера в питоне