Question: c++ Recursion Using Newtons method to find the square root Write a recursive program that uses Newtons method to find the square root of a
c++
Recursion
Using Newtons method to find the square root Write a recursive program that uses Newtons method to find the square root of a nonnegative real number within a given tolerance. Suppose x is a nonnegative real number, a is the approximate square root of x, and is the tolerance. Start with a = x. If |a 2 x| , then a is the square root of x within the tolerance; otherwise: Replace a with (a 2 + x)/(2a) and repeat the above step Note: |a 2 x| denotes the absolute value of a 2 x. write a program to test your function. Additional requirements and instructions: No use of global variables. Code is well commented. Comments for functions describe what they do. They also describe the post conditions. If parameter names are not descriptive in function headers, the comments for a function describe the pre conditions as well. Submit all code files needed to compile and run this program. Comply with syllabus policies .
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
