Answered step by step
Verified Expert Solution
Question
1 Approved Answer
2 . 7 Exercises 8 7 Exercise 2 . 1 9 : Explore round - off errors from a large number of inverse operations Maybe
Exercises
Exercise : Explore roundoff errors from a large number of inverse operations
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 in range :
for in rangen:
for in rangen:
print d times sqrt and :
Explain with words what the program does. Then run the program. Roundoff errors are here completely destroying the calculations when is large enough! Investigate the case when we come back to instead of by fixing an value where this happens and printing out in both for loops over i Can you now explain why we come back to and not
Filename: repeatedsqrt
Exercise : Explore what zero can be on a computer
Type in the following code and run it:
eps
while eps:
print eps
eps
print 'final eps: eps
Explain with words what the code is doing, line by line. Then examine the output. How can it be that the "equation" eps is not true? Or in other words, that a number of approximately size the final eps value when the loop terminates gives the same result as if eps were zero?
Filename: machinezero.
Remarks The nonzero eps value computed above is called machine epsilon or machine zero and is an important parameter to know, especially when certain math
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started