Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this problem we need to approx. square roots without using sqrt, please help Exploration 1: Approximating square roots. We have seen how Python can

In this problem we need to approx. square roots without using sqrt, please help

image text in transcribed

Exploration 1: Approximating square roots. We have seen how Python can do basic arithmetic - addition, subtraction, multiplication, and division. But what about other functions, like the square root? In fact, Python offers a few functions for the square root, but that's not the point. How can we compute the square root using only basic arithmetic? Why might we care? 1. We might want to know the square root of a number with more precision than the Python function offers. 2. We might want to understand how the square root is computed... under the hood. 3. Understanding approximations of square roots and other functions is important, because we might want to approximate other functions in the future (that aren't pre-programmed for us). Here is a method for approximating the square root of a number X. 1. Begin with a guess g. 2. Observe that g(X/g)=X. Therefore, among the two numbers g and (X/g), one will be less than or equal to the square root of X, and the other will be greater than or equal to the square root. 3. Take the average of g and (X/g). This will be closer to the square root than g or X/g (unless your guess is exactly right!) 4. Use this average as a new guess... and go back to the beginning. Now implement this in Python to approximate the square root of 2. Use a loop, so that you can go through the approximation process 10 times or 100 times or however many you wish. Explore the effect of different starting guesses. Would a change in the averaging function improve the approximation? How quickly does this converge? How does this change if you try square roots of different positive numbers? Write your code (Python) and findings (in Markdown cells) in a readable form. Answer the questions in complete sentences. [ ] \# Start your explorations here

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Theory Icdt 99 7th International Conference Jerusalem Israel January 10 12 1999 Proceedings Lncs 1540

Authors: Catriel Beeri ,Peter Buneman

1st Edition

3540654526, 978-3540654520

More Books

Students also viewed these Databases questions