Objective: To write and run a python script that approximates the square root of a real number
Question:
Objective: To write and run a python script that approximates the square root of a real number Problem: The Babylonian algorithm to compute the square root of a number 3 is as follows: (1) Make a guess at the answer. Call the initial guess zo. You can take x/2 as your initial guess. (2) Computer = x/x0. (3) Set xo = (30 + r)/2. (4) Go back to step 2 for as many iterations as necessary. The more times that steps 2 and 3 are repeated, the closer xo will become to the square root of Your program should do the following: Use the method of Homework Assignment 1 to scan in a value for x and convert it to a floating point number. If &
Using the square root function from the math module, print out math.sqrt(x). This algorithm is a special case of Newton's tangent-line method for iteratively approximating a solution to an equation f(x) = 0. For Newton's method, the recurrence relation is 2n+1 = In - f(n)/f'(an) where co is an initial guess. Can you determine the function f(c)?