Deadline for Assignment 3 extended to April 15.
Hints for Assignment 3:
- Problem 1:
You have two choices for computing the interpolating polynomial:
- solve a linear system for getting the coefficients, then use nested
multiplication for evaluating the polynomial
- evaluate the Lagrange form of the polynomial
The Chebyshev nodes on the interval [a,b] are given by
xj = (a+b)/2 + cos(
(j-1/2)/n) (b-a)/2
for j = 1,...,n.
Then
|(x-x1)...(x-xn)|
2 ((b-a)/4)n
for x in [a,b]
- Problem 2:
Use t = 1:9 and tt = 1:.05:9; . Let x
be the row vector containing the x-coordinates of the 9 points. Then use
spline to evaluate the spline for t and x in the points
tt, yielding the vector xt. Do the same for the y-coordinates, yielding
the vector yt.
Use plot(x,y,'o',xt,yt); axis equal for plotting the given points and
the interpolating curve.
- Problem 3(ii) Download hybrid.m.
If function f is contained in m-file f.m use
interval=hybrid('f',a,b,delta) to compute interval of
length<=delta containing the zero.
- Problems 3(iii), 4(b): How to use fzero: Write an m-file f.m
containing the function, e.g.
function y = f(x)
y = cos(x) - x;
Pick a,b such that f has different signs at a,b. Then use
x = fzero('f',[a,b])
- Problem 4(a): Print out |f(xk)| and |xk-xk-1|
after each iteration.