Chapter 2: Problem 26
Maybe you have tried to hit the square root key on a calculator multiple times
and then squared the number again an equal number of times. These set of
inverse mathematical operations should of course bring you back to the
starting value for the computations, but this does not always happen. To avoid
tedious pressing of calculator keys we can let a computer automate the
process. Here is an appropriate program:
from math import sqrt
for n in range(1, 60):
r = 2.0
for i in range(n):
r = sqrt(r)
for i in range(n):
r = r**2
print ’%d times sqrt and **2: %.16f’ % (n, r)
Explain with words what the program does. Then run the program. Round-off
errors are here completely destroying the calculations when
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.