- Hints for Assignment 1:
- problem 1(d): Use a=1 and b such that fl(1+b)=1.
- problem 2: All questions are for double
precision (this is what Matlab uses).
- problem 3(a): We have x1 = f(c) where f(c) = ... -
sqrt(... - ...). Use the condition number
condf=c*f'(c)/f(c). Consider b as a fixed parameter. Then
for (i), (ii), (iii) evaluate condf with
b:=-x1-x2, c:=x1x2 in
Matlab.
problem 3(b): The file qeq1.m should look
like this:
function [x1,x2] = qeq1(b,c)
x1 = ... ;
x2 = ... ;
To find the errors of your computed solution use
x1 = ... ; x2 = ... ;
b = -x1-x2; c = x1*x2;
[x1hat, x2hat] = qeq1(b,c)
and then compute the relative errors of x1hat,
x2hat compared to x1, x2.
- problem 4(b):To find the relative error of
ytilde:=y1hat-xhat use
|
ahat-bhat| <=
|a/(a-b)| |
ahat | +
|b/(a-b)| |
bhat
|.
problem 4(c): Use the remainder term to get an
upper bound for |f(x)-f4(x)|/|f(x)|.
problem 4(d): linspace(a,b,n) gives n equidistant
numbers in the interval [a,b] (including the endpoints).