The “divide and average” method, an old-time method forapproximating the square root of any positive number a, can beformulated as
x =( x + (a/x)) / 2
Write a well-structured python function toimplement this algorithm based on the outlined algorithmbelow.  The program must take as input the followingvalues:
• The value whose square root is sought, a

• An initial guess of the solution, xguess

• The number of decimals, n, in order tocalculate the error criteria, es

• The maximum number of iterations allowed before declaring adiverging solution, maxit

The program should produce, as output, the value of the errorcriteria, es, and a table showing the differentiterations required to find a solution using the required errorcriteria.

Show the results of your program for a = 122.5, xguess = 5.0, n= 5, maxit = 20.

Iterative ProcedureHints (1) I E Numerical Methods

Iterative ProcedureHints (1) I E Numerical Methods fol x E ENGR2450Assignment 1.pd O file:///C/Users/canad/Downloads/Numerical Methods for Engineers- 7th-Edition steven chapra.pdf 80 of 987 3.3 ERROR DEFINITIONS FUNCTION IterMeth val, es maxit) iter 1 sol va 100 DO solo 1d sol soil iter iter 1 IF sol E 0 ea abs (sol so 101d)/ Sol) *100 IF ea s es OR iter maxit EXIT END DO IterMeth sol END I terMeth Ask me anything 12:44 PM 1/24/2017 X Show transcribed image text