Any help would be VERY much appreciated. The function sqrt from the header file
ID: 3616451 • Letter: A
Question
Any help would be VERY much appreciated.The function sqrt from the header file cmath can be used to findthe square root of a nonnegative real number. Using Newton'smethod, you can also write an algorithm to find the square root ofa nonnegative real number within a given tolerance as follows:
Suppose x is a nonnegative real number, a is the approximate squareroot of x, and epsilon is the tolerance. Start with a = x; A. If |a* a - x| < (this is a less than with an underline) epsilon, thena is the square root of x within the tolerance; otherwise
B. Replace a with (a * a + x) / (2 * a) and repeat Step a.
Where |a * a - x| denotes the absolute value of a * a - x.
Write a recursive function to implement this algorithm to find thesquare root of a nonnegative real number. Also, write a program totest your function.
Explanation / Answer
please rate - thanks #include #include using namespace std; double sqroot(double,double); int main() {double a; do{ couta; }while(a100); coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.