Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Heron method is a method the ancient Greeks used to compute the square root of a number n. The method generates a sequence of

The Heron method is a method the ancient Greeks used to compute the square root of a number n. The method generates a sequence of numbers that represent better and better approximations for sqrt n. The first number in the sequence is an arbitrary guess; every other number in the sequence is obtained from the previous number prev using the formula Please use simple python

1/2(prev + (n/prev))

Write function heron () that takes as input two numbers:n and error. The function should start with an inital guess of 1.0 for sqrt n and then repeatedly generate better approximations until the differenve ( more precisely, the absolute value of the difference) between successive approximations is at most error.

>>> heron (4.0, 0.5)

2.05

>>> heron (4.0, 0.1)

2.000609756097561

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

Practical Issues In Database Management A Refernce For The Thinking Practitioner

Authors: Fabian Pascal

1st Edition

0201485559, 978-0201485554

More Books

Students also viewed these Databases questions

Question

What is Taxonomy ?

Answered: 1 week ago

Question

1. In taxonomy which are the factors to be studied ?

Answered: 1 week ago

Question

1.what is the significance of Taxonomy ?

Answered: 1 week ago

Question

What are the advantages and disadvantages of leasing ?

Answered: 1 week ago

Question

5. Discuss the key roles for training professionals.

Answered: 1 week ago