Question: Please answer using MatLab Geometrically, you can compute the square root of a positive number A by constructing a square with area equal to A.

Please answer using MatLab

Please answer using MatLab Geometrically, you can compute the square root of

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 VA 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: L+ W Wnew = This averaging process can be iterated to generate a sequence of rectangles that become "more and more square The value of vA wil 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 bounded 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 L - W is no more than the given tolerance Returns the sequence of L-values as a sequence that converges to VA. In your prob3), call your mySqrt function to compute sequences that converge to V10, V3141, V55555 Report the following in the standard output for each of the three square roots a) the number of iterations needed to get IL WI down to less than 103 (b) the absolute error at the final step for each call 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 VA 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: L+ W Wnew = This averaging process can be iterated to generate a sequence of rectangles that become "more and more square The value of vA wil 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 bounded 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 L - W is no more than the given tolerance Returns the sequence of L-values as a sequence that converges to VA. In your prob3), call your mySqrt function to compute sequences that converge to V10, V3141, V55555 Report the following in the standard output for each of the three square roots a) the number of iterations needed to get IL WI down to less than 103 (b) the absolute error at the final step for each call

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!