@@ -1074,22 +1074,21 @@ Let's run through each initial guess and check the output
10741074```{code-cell} ipython3
10751075:tags: [raises-exception]
107610761077-attempt = 1
1078-for init in initLs:
1077+for attempt, init in enumerate(initLs, start=1):
10791078 print(f"Attempt {attempt}: Starting value is {init} \n")
10801079 %time p = newton(lambda p: e(p, A, b, c), init, tol=1e-15, max_iter=15)
10811080 print("-" * 64)
1082- attempt += 1
10831081```
1084108210851083We can see that Newton's method may fail for some starting values.
1086108410871085Sometimes it may take a few initial guesses to achieve convergence.
108810861089-Substitute the result back to the formula to check our result
1087+Substitute the result back to the formula to check our result using the second initial guess which converges
1090108810911089```{code-cell} ipython3
1092-e(p, A, b, c)
1090+p_solution = newton(lambda p: e(p, A, b, c), initLs[1], tol=1e-15, max_iter=15)
1091+e(p_solution, A, b, c)
10931092```
1094109310951094We can see the result is very accurate.