Fundamental Mathematics from an Advanced Standpoint

Math 4303

Helmut Knaust, Department of Mathematical Sciences, UTEP, El Paso TX 79968
hknaust@utep.edu

Last Edits: 2/16/2011

Mathematica’s Approximation of (Sqrt[7])

N[Sqrt[7],30]

Babylonian Algorithm (= Newton - Raphson Method)

First guess is 2.

a[0]=2;
a[n_]:=a[n]=1/2(a[n-1]+7/a[n-1])

After 6 iterations, (Sqrt[7])has been approximated with 30 digits accuracy:

Table[{n,N[a[n],30]},{n,0,6}]

The denominators of the fractions in the approximation get big quickly :

Table[{n,a[n]},{n,0,6}]

Bisection Method

The initial guesses are 2 (too small) and 3 (too large).

b={2,3};
update[b_]:=(m=0.5(b[[1]]+b[[2]]);If[m^2<7,{m,b[[2]]},{b[[1]],m}])

The bisection method is slow. It  improves by about 1 digit accuracy for every 3 times you apply the algorithm.
Below is a list of the lower and upper estimates for (Sqrt[7])obtained by the algorithm.

NestList[update,{2,3},18]

Newton - Raphson Method

To find a solution of f (x) = 0, one starts with a guess close to the solution, then updates repeatedly as follows :
	(Subscript[x, new])=(Subscript[x, old])-((f((Subscript[x, old])))/(f'((Subscript[x, old]))))

Let's approximate (π/2), a solution of cos(x)=0, with initial guess (Subscript[x, 0])=1:

f[x_]=Cos[x];
x[0]=1;
x[n_]:=x[n]=x[n-1]-f[x[n-1]]/f'[x[n-1]]

Table[{n,N[x[n],80]},{n,1,10}]