%% Lab 7
%
% In this lab we will explore relaxation techniques to help iterative
% methods converge
  
%% Exercise 1: A non-convergent fixed-point method
%
% Consider the fixed-point method given by $g(x) = -x^4+2$.
%
% 1) Plot $g(x)$ to see that it has a unique fixed point for $x \geq
% 0$.
%
% 2) Choose the initial guess $x_0 = .5$ for the fixed point and see that the
% iteration does not converge.
%
% 3) Consider the associated relaxation method
%
% $$ g_w(x) = w g(x) + (1-w)x.  $$
%
% Find a value of $w$ so that this fixed point method converges to a fixed
% point of $g(x)$.

%% Exercise 2: Increasing the convergence rate
%
% Consider the fixed-point method given by $g(x) = \cos(x)$.  The
% corresponding fixed-point iteration is (globally) linearly convergent. 
%
% 1) Find $w$ so that the relaxation method 
%
% % $$ g_w(x) = w g(x) + (1-w)x,$$
%
% converges faster to the fixed point of $g(x)$.
%
% 2) With this choice of $w$, is the method still globally convergent?

%% Exercise 3: A non-convergent iterative method
%
% Let
%
%  A = [-2 1 0 0 0; 1 -2 1 0 0; 0 1 -2 1 0; 0 0 1 -2 1; 0 0 0 1 -2];
%  b = [.5, .5, .5, .5, .5]';
%
% Define $T = I -A$ and consider the fixed point method given by $g(x) = Tx
% + b$.
% 
% 1) Show that this method does not converge.
% 
% 2) Consider the associated relaxation method $g_w(x) = w g(x) + (1-w)x.$
% Can you choose $w$ so that the method converges?
