Looking for square root of 5 with accuracy 0.0001

Using both Bisection and Newton methods for comparison


Calculation by interval Bisection method
Iteration 0: 5
Iteration 1: 2.5
Iteration 2: 1.25
Iteration 3: 1.875
Iteration 4: 2.1875
Iteration 5: 2.34375
Iteration 6: 2.265625
Iteration 7: 2.2265625
Iteration 8: 2.24609375
Iteration 9: 2.236328125
Iteration 10: 2.2314453125
Iteration 11: 2.23388671875
Iteration 12: 2.235107421875
Iteration 13: 2.2357177734375
Iteration 14: 2.23602294921875
Iteration 15: 2.236175537109375

Calculation by Newton method
Iteration 0: 1
Iteration 1: 3
Iteration 2: 2.3333333333333335
Iteration 3: 2.238095238095238
Iteration 4: 2.2360688956433634

For comparison sqrt of 5 computed by built-in JS sqrt function is 2.23606797749979