MATH 3510 HW 3 Name:
Date:
Collaborators:
(If applicable, collaborators submit their individually written assignments together)
Instructor/grader comments:
Question:
1
2
3
4
Total
Points:
15
20
25
10
70
Score:
Page 1 of 3
MATH 3510 HW 3
Floating point numbers
1. Floating point numbers typically represented in computers in the following binary form:
bbb (−1)b0× 1+ 1+ 2+…+ d ×2E,
222 2d where bi, i = 0,…,d can have values 0 or 1.
(a) (5 points) What is the (approximate) value of machine epsilon for a microprocessor that uses d = 12? Briefly explain. Express your answer as a power of 2 (exactly) and as a nearest power of 10 (approximately).
Write your answer in the homework project’s README.md file.
(b) (5 points) For the same microprocessor, how many floating point numbers x, such that1≤x<2arethere? Howmanyfloatingpointnumbersx,suchthat8≤x<16 are there? Briefly explain.
Write your answer in the homework project’s README.md file.
(c) (5 points) For the same microprocessor, assuming that the smallest possible value of E is -15 and the largest possible value of E is 16, what are (approximately) the smallest and the largest positive floating point number? Briefly explain. Express your answer as a power of 2 and as a nearest power of 10 (approximately).
Write your answer in the homework project’s README.md file.
Matlab
2. (20points) Writeascript(placeitintoafilehw03p2.m)thatusesthefunctionhw03p2data (available for download from the class website) to plot a figure consisting of four subplots that represent the data provided by the function using linear, loglog and semilogx/semil- ogy axes. (Use subplot matlab function.) Each subfigure should have grid, a title, and axes labels. Use a linestyle that marks the data points and connects them with a line.
Determine the type of functional dependence y(x) of the data (e.g. y = log(x), y = eαx, y = xp, etc.). Explain in your README.md file your reasoning, as well as indicate which type of graph is the best to represent the data in this problem.
Stability of the algorithms
3. Modify the recurrence algorithm from Problem 1 of the homework assignment 2 and turn it into a stable one.
Page 2 of 3
MATH 3510 HW 3
(a) (15points) Writematlabfunctionhw03p3integral(placethecodeinthefilenamed hw03p3integral.m) that accepts a positive integer parameter k and returns a vector containing the values of the integral (A) for n = 1, 2, . . . , k. The function must use the stable version of relation (B). Your function must preallocate the array that it returns. Use for loop when writing your code. Provide the help text for the function.
(b) (10 points) Write matlab script (place it into a file hw03p3.m) that does the sim- ilar calculations and measurements as the script hw02p1.m. Describe the results (primary whether you achieved stability while keeping the performance) in your README.md file.
Gitlab
4. (10 points) Create a gitlab project called hw03 (name it exactly as shown). Upload all matlab files that are required to run your code. Do not upload other types of files (e.g. no graphics files). Create README.md file and write your answers. Share the project with the instructor (gitlab user name m3510 20f in) and the TA (gitlab user name m3510 20f ta) and grant them the Reporter privileges.
Page 3 of 3