Newton.py working for both functions