Question: Write a script to compute machine ( about 1 ) using a while loop. Your code should output the value of along with a message

Write a script to compute machine (about 1) using a while loop. Your code should
output the value of along with a message explaining what means. For extra credit use the
IEEE standard for double precision given in class to show by hand that your computed value is
correct.
2.(25 pts) The following algorithm calculates a value similar to machine called machine delta.
1. Set =1.0
2. While >0 repeat
a.=
b.=/2
3. Output
4. Stop
Write a script to find and print machine delta. Explain what is and why it is so different than
machine . For extra credit use the IEEE standard for double precision given in class to show by
hand that your computed value is correct.
3.(50 pts) For this problem you want to estimate the derivative of the function =() at
=. See Lab01 for the definition of (). Use both the forward difference,
(0)=(0+)(0)
+()
and the centered difference
(0)=(0+)(0)
2+(2)
For the step sizes, let =1/21
, with =1,2,...,. For =10, find and save the absolute
true errors
|,|=|()()|
for each difference approximation and step size.
a. Find the true value by hand using the definition of () given in Lab01.
b. Plot the log of the absolute error versus the log of for both the forward and the
centered approximation on the same set of axes. Do not use Matlabs loglog command.
c. Add a title, axes labels, and a legend.
d. Use Matlabs Basic Fitting Tool to find the slope, for each difference approximation.
e. Report the slopes you find and explain their values mathematically. Hint: If an error is
() then it is proportional to , while if it is (2), it is proportional to 2
.
f. Finally, experiment with to determine the optimum step size, , for each difference
approximation, that best balances the truncation and the round-off errors.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!