Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2. Edmund Halley (the astronomer famous for discovering Halley's comet) invented a fast algorithm for computing the square root of a number, A. Halley's algorithm
2. Edmund Halley (the astronomer famous for discovering Halley's comet) invented a fast algorithm for computing the square root of a number, A. Halley's algorithm approximates vA as follows Start with an initial guess: xi. The new approximation is then given by: ,,- (15-" (10-3) until some convergence is met These two calculations are repeate Create a function called my_sqrt that approximates the square root of a number It should have three inputs 1. the number you are tryng to find the square root of (A) 2 the initial guess (x.) 3. the convergence criteria () Your function will return the approximation for the square root of A. Use a sufficient number of iterations to ensure the convergence criteria is met. Test your script by: i Approximating the square root of 5 (A 5) ii. Comparing it to the value calculated with the buit-in MATLAB function, sqrt. iii. Use format long to compare results. iv. Start with an initial guess, x-2 v. Use a convergence criteria, -0.001
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