Newton’s method - Your turn

Newton’s method - Your turn#

A for loop was used in the example script to perform the Newton’s iteration. The iteration was terminated after a specified number of loops. In this case, we have performed a certain number of iterations without concerning ourselves with the accuracy of the computed solution. A more accurate (and possibly more efficient) approach would be to test for convergence and stop the iteration when the required level of accuracy has been achieved. This is the perfect case for a while loop! The convergence criterion often used is the difference between the solutions obtained in two successive iterations. The loop is terminated when the difference is below a specified threshold value.

  1. Rewrite the example script using a while loop. Terminate the iteration when the absolute value of the difference between any two successive iterates for \(V_{\mathrm{diode}}\) is less than \(10^{-6}\). Note: You’ll have to store the old value of \(V_{\mathrm{diode}}\) before computing the new one.

  2. How many iterations were required to achieve the specified accuracy?

# TODO: Write your solution below

Exporting your work#

When you’re ready, the easiest way to export the notebook is to File > Print it and save it as a PDF. Remove any excessively long, unrelated outputs first by clicking the arrow → next to the output box and then Show/hide output. Obviously don’t obscure any necessary output or graphs!