Babylonian Method Essay
Babylonian Method
I. Objective The objectives of this activity are: To be able to calculate the root of a number [Babylonian Method] using Octave To find the number of iterations To be input its tolerance to determine its number of iteration
II. Problem In order to be able to calculate the root of a number using Babylonian method, we must first make a program using octave that would make a function calculate the given number denoted by ‘Babylonian(x)’. We must also include in the program the number if iterations it will make.
Another problem also is we had to make another program that will calculate its root but its number of iterations will not be specified, only its tolerance will determine the number of iterations.
III. Theoretical Background The language in Octave is similar to C language which allows us to be familiar with the language. In the Babylonian method, we knew its formula was Xn+1 = ⅟2 ( Xn + S/ Xn ) . All we had to do was to make the program to input the S=square root of the number, and use the FOR loop to repeat the iterations. And WHILE loop to be used with the tolerance.
IV. Results/Codes and Sample Runs
The first program was to calculate the root by predefined number of iterations.
The second program was to find the root by using tolerance to determine its number of iterations. The tolerance value is 0.0001
On third program, value of tolerance was changed to .000001
V. Analysis
For the number of iterations to be defined, we needed to use the FOR loop followed by the equation until the loop ends. ‘for=1:10’ means that it repeats the loop 10 times starting from 1 up to 10. Where x is the initial guess and a is the number to be inputted by the user to find its root.
The second program used a different kind of loop, WHILE loop was used. First the tolerance and difference was declared. Where x was still the initial guess. While the difference was still bigger than the tolerance the loop would still continue until it comes to a point there the difference is lesser than the tolerance which stops the loop.
On the third program, the tolerance was changed from 0.0001 to 0.00001 , the only difference it made was that another iteration or loop was made.
VI. Conclusion
I conclude that to be able to find the root of a number using Babylonian method using Octave, we must be familiar the the C language and its loops.
The FOR loop was to specify the number of iterations while the WHILE loop determines its number of iterations depending on its given tolerance. By changing the tolerance number to a smaller value, the number of iterations increases.
A

Subject: Mathematics,

University/College: University of Chicago

Type of paper: Thesis/Dissertation Chapter

Date: 30 November 2016

Words:

Pages:
We will write a custom essay sample on Babylonian Method
for only $16.38 $12.9/page