%% YOURNAME (DUEDATE)
%
% *IMPORTANT:*
%
% Do not change *anything* in this header (besides your
% name and due date above as needed)!
%
% Put your solution to the exercise completely at the end
% of this file.
%
%%
% <latex>
% % for Octave, or for Matlab published to LaTeX for proclatex
% \input{../setup.tex}
% </latex>
%
%% LINEAR ALGEBRA, Exercise 2

if ~exist('___code___','var') ; clear ; end
format compact
more off


%% EXERCISE DESCRIPTION:
%
% Conditioning of Vandermonde matrices.
%
% Given |n| |x|-values |x1|, |x2|, ..., |xn| and
% function values at those |x|-values |f1|, |f2|,
% ..., |fn|, you can find the coefficients of the
% polynomial interpolating those function values from
% solving:
%
%      /x1^(n-1) x1^(n-2) ... x1^2 x1 1\ /C1\   /f1\
%      |x2^(n-1) x2^(n-2) ... x2^2 x2 1| |C2|   |f2|
%      |x3^(n-1) x3^(n-2) ... x3^2 x3 1| |C3| = |f3|
%      |   :        :     ...  :    :  | |: |   |: |
%      \xn^(n-1) xn^(n-2) ... xn^2 xn 1/ \Cn/   \fn/
%
% The matrix in the above equations is a (horizontally
% flipped) Vandermonde matrix.  It is typically very
% poorly conditioned,
%
%% Hints
%
% * For 10 equally spaced x-values from 0 to 1, the
% matrix condition number should be 1.5193e+07.
%
% * The polynomial plot without perturbations should be
% right on top of the exact cosine curve.
%
% * The relative error in the perturbed fValues should be
% 0.011394.


%% SOLUTION:


