Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem needs to be completed using MATLAB or a similar language. Thank you! Problem 3: Square root approximation through an iter- ative process Geometrically, you
Problem needs to be completed using MATLAB or a similar language. Thank you!
Problem 3: Square root approximation through an iter- ative process Geometrically, you can compute the square root of a positive number A by constructing a square with area equal to A. Notice that if a square has the same area A as a rectangle of length L and width W, then length of the square must lie between L and W. Also, you can make any rectangle "more square (while maintaining the same area) by changing its length from L to the average value of the two dimensions L and W; AND by changing its width from W to A divided by the average value of the two dimensions L and W. Mathematically This averaging process can be iterated to generate a sequence of rectangles that become "more and more square The value of VA will always be sandwiched between the length and the width of each rectangle generated by this process; so if we think of the sequence of rectangle lengths as converging to vA, then the absolute error of the approximation will be bouhded by the difference of the length and width of each rectangle. Write a function mySqrt that: Has as input a positive real number A followed by a tolerance level. . Starts with a rectangle of length A and width 1 Generates sequences of lengths L and widths W of rectangles that are getting "more and more square", using the averaging process described above. . Continues until IL-W is no more than the given tolerance. Returns the sequence of L-values as a sequence that converges to v In your prob30, call your mySgrt function to compute sequences that converge to VTo, 3141, v55555 Report the following in the standard output for each of the three square roots: (a) the mumber of iterations needed to get IL-Wi down to les than 10- (b) the absolute error at the final step for each cal. 0 Type here to search Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started