Keywords: Examples for calculating the square root of 2 with Heron's method.svg en First elements of the sequence we get when we calculate <math>\sqrt 2</math> with Heron's Method via the recursion <math>x_ n+1 \tfrac 12\left x_n + \tfrac 2 x_n \right </math> with the starting points <math>x_0 2</math> <math>x_0 4</math> and <math>x_0 8</math> 2016-05-13 own http //kulla me Stephan Kulla User Stephan Kulla other fields Matplotlib + import numpy as np import matplotlib pyplot as plt n_max 5 0 def square_root_seg a x_0 x_n x_0 while True yield x_n x_n x_n + a / x_n / 2 0 ns np arange 0 n_max + 0 01 1 plt plot 0 n_max np sqrt 2 np sqrt 2 color black for x_0 in 2 0 4 0 8 0 xs np fromiter square_root_seg 2 0 x_0 np float ns size plt plot ns xs o label x_0 d int x_0 plt text 7 2 np sqrt 2 -0 1 \sqrt 2 plt legend loc 'upper right' plt savefig Examples for calculating the square root of 2 with Heron's method svg cc-zero Numerical analysis |