

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
2 Square roots. A classic algorithm that illustrates many of these concerns is “Newton's” method to compute square roots x =.
Typology: Lecture notes
1 / 3
This page cannot be seen from the preview
Don't miss anything!


Numerical methods can be distinguished from other branches of analysis and computer science by three characteristics:
A classic algorithm that illustrates many of these concerns is “Newton’s” method to compute square roots x =
a for a > 0 , i.e. to solve x^2 = a. The algorithm starts with some guess x 1 > 0 and computes the sequence of improved guesses
xn+1 =
xn + a xn
The intuition is very simple: if xn is too big (>
a), then a/xn will be too small (<
a), and so their arithmetic mean xn+1 will be closer to
a. It turns out that this algorithm is very old, dating at least to the ancient Babylonians circa 1000 BCE.^1 In modern times, this was seen to (^1) See e.g. Boyer, A History of Mathematics, ch. 3; the Babylonians used base 60 and a famous tablet (YBC 7289) shows √ 2 to about six decimal digits.
be equivalent to Newton’s method to find a root of f (x) = x^2 − a. Recall that Newton’s method finds an approximate root of f (x) = 0 from a guess xn by approximating f (x) as its tangent line f (xn) + f ′(xn) (x − xn), leading to an improved guess xn+1 from the root of the tangent:
xn+1 = xn −
f (xn) f ′(xn)
and for f (x) = x^2 − a this yields the Babylonian formula above.
A classic analysis text (Rudin, Principles of Mathematical Analysis) approaches the proof of con- vergence of this algorithm as follows: we prove that the sequence converges monotonically and is bounded, and hence it has a limit; we then easily see that the limit is
a. In particular:
a, then it follows
a < xn+1 < xn:
(a) xn+1 − xn = 12 ( (^) xan − xn) = a−x^2 n 2 xn <^0. (b) x^2 n+1 − a = 14 (x^2 n + 2a + a
2 x^2 n^ )^ −^ a^ =^
1 4 (x
2 n −^2 a^ +^ a^2 x^2 n^ ) =^
1 4 (xn^ −^
a xn )
(^2) = (x^2 n−a)^2 4 x^2 n^ >^0 (regardless of whether xn >
a).
a, the second property above means that x 2 >
a; then for n > 2 it is monotonically decreasing and bounded below by
a.
However, this proof by itself tells us nothing about how fast the sequence converges
Using the accompanying Julia notebook, we will apply this method to compute the most famous root of all,
2 is irrational was thrown off a cliff by his Pythagorean colleagues.). As a starting guess, we will use x 1 = 1, producing the following sequence when computed with about 60 digits of accuracy, where the correct digits are shown in boldface: 1 1. 1. 41 66666666666666666666666666666666666666666666666666666666675 1.41421 56862745098039215686274509803921568627450980392156862745 1.41421356237 46899106262955788901349101165596221157440445849057 1.41421356237309504880168 96235025302436149819257761974284982890 1.41421356237309504880168872420969807856967187537 72340015610125 1. Looking carefully, we see that the number of accurate digits approximately doubles on each iteration. This fantastic convergence rate means that we only need seven Newton iterations to obtain more than 60 accurate digits—the accuracy is quickly limited only by the precision of our floating-point numbers, a topic we will discuss in more detail later on.