Requirements

  • Python 3.7

This code makes use of the f"..." or f-string syntax. This syntax was introduced in Python 3.6.

Sample Execution & Output

If run without command line arguments, using

python newtons_method.py

the following usage message will be displayed.

Usage: ./newtons_method.py initial_guess

If run using

python newtons_method.py 2

output similar to

x = 1.0000000469590518 | f(x) = 9.391810573688986e-08 | 5 iterations

should be generated.