Question: In python code please The ancient Greeks knew that the iteration x_n+1 = 1/2 (x_n + 2/x_n) would converge to squareroot2 if x_0 = 1.
The ancient Greeks knew that the iteration x_n+1 = 1/2 (x_n + 2/x_n) would converge to squareroot2 if x_0 = 1. Write a Python program that takes a starting value as input and determines it the sequence converges or not. The sequence converges if |x_n+1 - x_n| lessthanorequalto 10^-7. If it doesn't converge in 100 iterations, then we'll say the sequence doesn't converge. The definition statement of your program should be def squareroot2(x0) Your output statement should be of the form: The sequence starting at X0X0X0 converges to XXXX in NNNN iterations. Or The sequence starting at X0X0X0 doesn't converge. where X0X0X0 is the initial value x_0, XXXX is the value the sequence converges to and NNNN is the number of iterations it takes to converge
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
