You will write Newton's method so that it stops safely: at a flat tangent, and after too many steps.
The idea. . Stop when two values differ by less than the tolerance.
Your tasks.
newton_step(f, df, x). Return the next value, or None when .newton(f, df, x0, tol, max_steps). Return the root, or None when a step fails or the steps run out.sqrt_newton(N). Use your newton on from to return .Run your code once to unlock the worked solution.
Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…