Purchase Solution

The divide-and-average algorithm

Not what you're looking for?

Ask Custom Question

The divide-and-average algorithm for approximating the square root of any positive number a is as follows: Take any initial approximation x that is positive, and then find a new approximation by calculating the average of x and a/x, that is, (x + a/x)/2. Repeat this procedure with x replaced by this new approximation, stopping when x and a/x differ in absolute value by some specified error allowance, such as 0.00001. Write a program that reads values for x, a, and the small error allowance and then uses this divide-and-average algorithm to find the approximate square root of x. Execute the program with a=3 and error allowance=0.00001, and use the following initial approximationa: 1, 10, 0.01, and 100. Also execute the program with a=4, errow allowance=0.00001, and initial approximations 1 and 2.

Purchase this Solution

Solution Summary

The divide-and-average algorithm is used here.

Purchase this Solution


Free BrainMass Quizzes
Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

C# variables and classes

This quiz contains questions about C# classes and variables.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.