The function sqrt from the header file cmath can be

The function sqrt from the header file cmath can be used to find the square root of a nonnegative real number. Using Newton’s method, you can also write an algorithm to find the square root of a nonnegative real number within a given tolerance as follows: Suppose x is a nonnegative real number, a is the approximate square root of x , and epsilon is the tolerance. Start with a = x .

If | a 2 – x | <= epsilon , then a is the square root of x within the tolerance, otherwise:

Replace a with ( a 2 + x ) / (2 a ) and repeat Step a in which | a 2 – x | denotes the absolute value of a 2 – x .

Write a recursive function to implement this algorithm to find the square root of a nonnegative real number. Also, write a program to test your function.(

 

Leave a Comment

Your email address will not be published. Required fields are marked *

GradeEssays.com
We are GradeEssays.com, the best college essay writing service. We offer educational and research assistance to assist our customers in managing their academic work. At GradeEssays.com, we promise quality and 100% original essays written from scratch.
Contact Us

Enjoy 24/7 customer support for any queries or concerns you have.

Phone: +1 213 3772458

Email: support@gradeessays.com

© 2024 - GradeEssays.com. All rights reserved.

WE HAVE A GIFT FOR YOU!

15% OFF 🎁

Get 15% OFF on your order with us

Scroll to Top