Hints:
- Problem 1
- Typo: it should say "in the case of a tie pick the number
with d4=0"
- Problem 2
-
Note: Even with
format long g, different machine
numbers are sometimes displayed in the same way. E.g.,
x = 1 + 1e-15 is displayed as 1, but typing
num2bin(x) or x-1 shows that it is a
different machine number from 1.
- Problem 3
- 3(a):
Let f(c) = (-b + sqrt(...))/2, then find f'(c) by taking the derivative
with respect to c. Show that the condition number is
y1/(y1-y2) and evaluate this for (i),(ii),(iii).
3(b): The file qeq1.m should look like
this:
function [y1,y2] = qeq1(b,c)
y1 = ... ;
y2 = ... ;
To find the errors of your computed solution use in your main
code
y1 = ... ; y2 = ... ;
b = -y1-y2; c = y1*y2;
[y1hat, y2hat] = qeq1(b,c)
and then compute the relative errors of y1hat,
y2hat compared to y1, y2.
- Problem 4
-
4(a): Let y1 = exp(x) and y2 = exp(-x).
First find an upper bound for the relative error of the computed values y1hat,
y2hat.
Then use the error propagation formula for c = a - b (see the PDF file about error propagation
below).
4(b): Use the remainder term of the Taylor series to get an
upper bound for |f(x)-f4(x)|/|f(x)|.
4(c): linspace(a,b,n) gives n equidistant numbers
in the interval [a,b] (including the endpoints), e.g.,
x = linspace(0,20*pi,1000); plot(x,x.*sin(x))