Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. On slides 13 and 14 of the file MIT6_0001F16_Lec3 , we discussed about an algorithm (or pseudo code) that computes the exact cube root

2. On slides 13 and 14 of the file MIT6_0001F16_Lec3, we discussed about an algorithm (or pseudo code) that computes the exact cube root of a number. With an initial guess, compute the exact cube root of the following numbers:

a) 280

b) -179

c) -321

Make sure that the guesses which you give are not closer than 10%. Of the individual numbers in a), b) c). Find how many iterations you need to arrive at the exact square root. Also find out if any of the square root computations may diverge (you need infinite number of iterations or you may not arrive at the exact square root and may go off-track).

image text in transcribed

GUESS-AND-CHECK - cube root cube = 8 for guess in range (cube+1): if guess**3 == cube: print("Cube root of", cube, "is", guess) 6.0001 LECTURE 3 13 GUESS-AND-CHECK cube root cube = 8 for guess in range (abs (cube) +1): if guess**3 >= abs(cube) : break if guess**3 != abs(cube) : print (cube, 'is not a perfect cube') else: if cube = abs(cube) : break if guess**3 != abs(cube) : print (cube, 'is not a perfect cube') else: if cube

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_2

Step: 3

blur-text-image_3

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 Administration The Complete Guide To Dba Practices And Procedures

Authors: Craig S. Mullins

2nd Edition

0321822943, 978-0321822949

More Books

Students also viewed these Databases questions

Question

1. Define mass and mediated communication

Answered: 1 week ago