You are on page 1of 4

An Algorithm for approximating N

By: Branden Laske


Introduction:

An algorithm is an eective way for calculating many types of functions

and their outputs. It acts as a set of rules for solving a problem expressed in a nite
number of steps1 . One well known algorithm for calculating precise estimates is called a
Taylor Series. A Taylor Series approximates point values, in our case y-values, around a
specic point the function is concerned with. It gives a precise estimate to the value and the
error in the approximation. In this paper we will learn how to formulate an algorithm for
calculating a square root function and include an example that approximates a calculation
error to any extent. In showing how to use our algorithm with an example, we will also
learn to understand why our rational approximation is accurate, where it came from, and
prove our remainder diverges towards zero.
The two equations used for approximating the square root of any Natural number N
include:
rk =

N
rk1
+
2rk1
2

(1)

Bk =

1
2
(N rk1
)2
8

(2)

Using the Algorithm and Key Points:

There are a couple of key points to keep in

mind while we analyze and learn to use the algorithm. First o, the algorithm we will be
using is iterative, meaning that steps are repeated until we reach our result. We will get our
result using the equation, plug our result back into the same equation, and repeat the same
process producing an even more precise estimate. To break down what we need to know are
as given:
A.

The rst thing to keep in mind is choosing our rst value for r. For the simplicity of

things we will always choose some value greater than or equal to 1. In some cases it may
1 Dictionary.com,

Denition of Algorithm.

require a little more computing but for the sake of dealing with other restrictions within the
algorithm, this will do. The value of N is also chosen by us. N can be any natural number,
one that we wish to nd the approximate value of its square root.
B.

The method we use for computing the kth approximation is exactly where the term

iterative comes into hand. Since we choose the value of r0 which is explained in part (A),
our result we get from equation (1) by plugging in r0 and N is r1 . Our r1 is then plugged
back into equation (1) to calculate the next rk . K is the number of repeated steps we end

up taking in order to reach our goal for the appropriate error | rk N |< . is a very
small decimal number that expresses how accurate our approximation is. This being the
result we calculate from equation (2).
C.

We will be calculating the error value within equation (2) by itself each time. This

alone will give you a separate fraction, one that will produce the very small decimal number
. How many more digits the denominator of this error has will show the accuracy of the

approximation within the value of N . For example, say our remainder or upper bound
Bk =

1111
1111103

. There are three more digit values within the denominator than that of the

numerator, so our approximation would be 103 or .001.


To summarize the steps on using our algorithm we are basically choosing our starting r
and N values explained in part (A). We then plug them into equation (1) to produce our
next r value, r2 , which is explained in part (B). We also plug r and N into equation (2) to

see how accurate our result r2 is to the actual value of N , this being explained in part (C).
These steps are then repeated with r2 , r3 ,...rk , until we reach our desired goal of accuracy
that can be any chosen decimal place 10v vN. Our accuracy of approximation is also
shown and explained in part (C).
Example:

As an example using our algorithm, we are going to estimate the value of

5. We will let N = 5, r0 = 2, and we are going to set our goal to be an approximation of

107 . We begin by plugging in values into our equation (1) r1 =

5
4

+ 1 when reduced you get

. For our remainder B1 = ( 18 (5 22 )2 ) which reduces to

1
8

being our remainer. Now

r1 =

18
8

taking our r1 we plug it back into equation (1) and calculate our r2 getting, r2 =
which reduces to r2 =

1218
544

. Our remainder B2 =
2

2 2
( 81 (5 18
8 ) )

5
36
8

which reduces to B2 =

18
8

961
32768

We then need to repeat this process to calculate our r3 and then r4 . We choose to stop at
r4 because we set our goal to be within 107 . Our value, when reduced, of r4 = 8928692538
3993032684

and using this value to plug into our remainder function (2) and reducing everything you
get B4 =

7896577707
1594230291x108

. Going back to part (C) we analyze our remainder and see that the

denominator has eight more digits than our numerator. This concludes that our goal for
our remainder of 107 has been met. To reach this we had to nd r4 or use our algorithm
4 repeated times to reach this result. In other words meaning our approximation of

5 is

exact and correct up to 7 decimal places.


Taylor's Theorem (for n=1):

In producing our algorithm we refer to two equations

to produce and calculate the rational value of N come from Taylor's Theorem
(3)

f (x) = f (a) + f 0 (a)(N a)

This equation represents the estimation of aR as a linear approximation to


R(x; a) =

f (t)
(x a)2
2

N.

(4)

This is used to derive our remainder function to show the accuracy of the approximation
to the actual value of

N , in other words .

Producing our Algorithm:

Now that some of the concepts for calculating our ap-

proximation and using our algorithm are cleared up, lets go through the steps in how we
produced our algorithm. First o let's take equation (3) and make some changes to our
2
2
variables. We are going to let a = rk1
and x = N . We let a = rk1
because by reduc-

ing our components inside equation (3) you get square roots. The second power of r will
cancel out the square root making the calculations possible without the use of a calculator. Once we replace these variables you will end up with f (N ) = r2 + 2r(N r2 ) and
R(x; a) = [

1
3

8t 2

(N r2 )2 ]. Multiplying out our f (N ) results f (N ) =

the variable t within our remainder [ 18 (t)

3
2

N
2r

+ 2r . In dealing with

(N r2 )2 ], we know that 81 t

value plugged into t would make the denominator larger. Since 18 t

3
2

3
2

<

1
8

because any

is a decreasing expo-

nential function instead of nding a new t value for each value a we will just replacet with 1.
3

Not replacing t with 1 only speeds up the process and results in complex exponential values.
So instead we will dodge these issues by replacing t in which we will still get the same nal
result. If we go through and make the adjustment replacing t
function f (N ) =

N
2r

r
2

3
2

with 1 you get our reduced

which was given at the beginning as equation (1) along with our

remainder as function (2) R(x; a) = [ 18 (N r2 )2 ]. This is where our iterative functions


come from being the two equations that are our algorithm functions used to approximate
our

N.

Proof of Remainder's Divergence: It is important to understand that the remainder


of our approximation is diverging to zero
because it shows that the upper bound is getting
closer and closer to the actual value of N .

You might also like