Question: Problem 2. Evaluate the function f(x)=x+1-1 for different values of x using a six-digit rounding computer arithmetic. a) Use hand calculations to evaluate f(x)
Problem 2. Evaluate the function f(x)=x+1-1 for different values of x using a six-digit rounding computer arithmetic. a) Use hand calculations to evaluate f(x) at x = 0.001, and show how the identity a - b = (a - b)(a+ab+b) can be used to avoid catastrophic cancellation (or loss-of-significance errors) in this case. b) Write a MATLAB script to evaluate f(x) for a decreasing sequence of values of x. To be more precise, produce the results for each x (0.1.0.01, 0.001, 0.0001, 0.00001}, generate a table with the results obtained from a six-digit rounding computer arithmetic, the true values of f(x) (obtained from a double precision computer arithmetic), and the associated relative errors. c) Extend your MATLAB script from Part b) to evaluate f(x) by modifying f(x) according to Part a), and generate the same table as in Part b) (with different results). d) Compare the two tables found in Parts b) and c), and give a brief statement. Hint: In MATLAB, use round (a, b, 'significant') to round a number a using b significant digits. Note, however, that the rounding will be performed on a binary basis rather than on a decimal basis. Turn in your MATLAB script for this problem. Remember to use your name in both the MATLAB filename and the MATLAB script, and upload your MATLAB script to gradescope.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
