C++ for Engineers and Scientists
C++ for Engineers and Scientists
4th Edition
ISBN: 9781133187844
Author: Bronson, Gary J.
Publisher: Course Technology Ptr
bartleby

Videos

Textbook Question
Book Icon
Chapter 5.7, Problem 5E

Numerical analysis) Given a number, n, and an approximation for its square root, a closer approximation of the actual square root can be found by using this formula:

n e w   a p p r o x i m a t i o n = ( n / p r e v i o u s   a p p r o x i m a t i o n ) + p r e v i o u s   a p p r o x i m a t i o n 2

Using this information, write a C++ program that prompts the user for a number and an initial guess at its square root. Using this input data, your program should calculate an approximation of the square root that’s accurate to 0.00001. (Hint: Stop the loop when the difference between the two approximations is less than 0.00001.)

Blurred answer
Students have asked these similar questions
Find the closed-form equation of T(n)=*** using substitution  example questions: T(n)=T(n/5)+T(7/10n)+n
Analyze the running time (i.e. T(n)) of these functions. You should be able to find some simple function f(n) such that T(n) O(f(n)). You should show your work and rigorously justify your an- 1. swer.
Overview One of the oldest methods for computing the square root e of a number is the Babylonian Method e. The Babylonian Method uses an iterative algorithm to make successively more accurate estimates of a number's square root. The algorithm stops iterating when the estimate shows no further sign of improvement, or when the estimate is within some acceptable margin of error. The acceptable margin of error is often called an epsilon. Assuming that you need to solve for the square root of x, the algorithm works as follows. 1. Choose an epsilon value that determines how close your solution should be to the actual square root value before you decide it is "good enough." Because this assignment asks you to solve for the square root to three decimal places, we can safely set the epsilon value to 0.0001 (four decimal places). This guarantees that our solution will be accurate to the precision we need to display to the screen. 2. Choose an initial estimate e for the square root of x. An easy…

Chapter 5 Solutions

C++ for Engineers and Scientists

Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
What Are Data Types?; Author: Jabrils;https://www.youtube.com/watch?v=A37-3lflh8I;License: Standard YouTube License, CC-BY
Data Types; Author: CS50;https://www.youtube.com/watch?v=Fc9htmvVZ9U;License: Standard Youtube License