\documentclass[10pt,letterpaper]{article}
\usepackage{graphicx}
\usepackage[colorlinks=true]{hyperref}

\topmargin -0.5in
\textheight 9in
\oddsidemargin=-0.05in
\evensidemargin=-0.05in
\textwidth 6.5in
\pagestyle{empty}

\newcommand{\bi}{\begin{itemize}}
\newcommand{\ei}{\end{itemize}}
\newcommand\ben{\begin{enumerate}}
\newcommand\een{\end{enumerate}}
\newcommand\vg{\vspace{2ex}}
\newcommand{\bc}{\begin{center}}
\newcommand{\ec}{\end{center}}
\newcommand{\ie}{{\it i.e.\ }}
\newcommand{\eg}{{\it e.g.\ }}
\newenvironment{tight}{\vspace{-1ex}\begin{list}%
{$\bullet$}{\setlength{\parsep}{0in} \setlength{\itemsep}{-2ex}}}%
{\end{list}\vspace{-1ex}}
\newcommand{\bt}{\begin{tight}}
\newcommand{\et}{\end{tight}}
\newcommand{\eps}{\varepsilon}
\newcommand{\mbf}[1]{{\mathbf #1}}
\newcommand{\xx}{\mbf{x}}
\newcommand{\uu}{\mbf{u}}
\newcommand{\vv}{\mbf{v}}
\newcommand{\nn}{\mbf{n}}
\newcommand{\bb}{\mbf{b}}

\begin{document}
\title{Math 126 Numerical PDEs, Winter 2012: Homework 1}
\date{due Monday 9am Jan 16}
\maketitle

{\em %Questions vary in difficulty and length.
Ideally you should start to use \LaTeX\ to write this up, then post it to your
webpage with your codes.
A good thing to do this weekend is to get both those set up
(make a baby webpage and a baby \LaTeX\ document.)
Codes should be short with explanatory comments if needed.
See honor code in syllabus.
}

\ben
\item If $\uu$ and $\vv$ are $m$-vectors, the matrix $A = I + \uu\vv^\ast$
is known as a {\em rank-one perturbation of the identity}. Show that if
$A$ is non-singular, then its inverse has the form $A^{-1} =
I + \alpha\uu\vv^\ast$ for some scalar $\alpha$, and give an expression
for $\alpha$. For what $\uu$ and $\vv$ is $A$ singular?
If it is singular, what is Nul $A$?
[NLA Ex 2.6]

\item The spectral radius $\rho(A)$ of a square matrix $A$ is the magnitude
of its largest eigenvalue. Prove that $\rho(A) \le \|A\|_2$.
[NLA Ex 3.2]

\item Use the in-class worksheet on the following $m\times m$ bidiagonal matrix
to answer the below.
\[A=\left[\begin{array}{llll}1&2&&\\&1&2&\\&&1&\ddots\\&&&\ddots
\end{array}\right]\]
\ben
\item find a nontrivial lower bound on the condition number $\kappa(A)$
\item predict the smallest $m$ such that roughly
all significant digits will be lost in the
solution $\xx$ to a linear system $A\xx = \bb$ in double precision.
\item demonstrate your last claim in a couple of lines of code, by
starting with a known $\xx$, computing $\bb$ then solving via
{\tt mldivide}.
[Hint: look up the {\tt toeplitz}
command to construct the matrix rather than use a loop. You need to
choose a $\bb$ that causes floating-point rather than exact integer
arithmetic to be used!]
\een
%m=53; A = toeplitz([1 zeros(1,m-1)], [1 2 zeros(1,m-2)]);
%x_true = randn(m,1);     % note involves non-integers
%b = A*x_true;
%x = A\b; norm(x-x_true)

\item How many nested loops are implied by each of the following MATLAB
commands? (\ie how many loops would you need to write to code the equivalent
in C or fortran?)
{\tt A = rand(100,100); x = 1:100; b = A*x'; B = A*A;}

\item Give an exact formula, in terms of $\beta$ and $t$,
for the smallest positive integer $n$ that
does not belong to the floating-point system $\mbf{F}$, and compute $n$
for IEEE single- and double-precision. Give one line of code, and its output,
which demonstrates this is indeed the case for double-precision. [NLA Ex 13.2]

\item Measure how the time to compute the singular values of a random real dense
$m\times m$ matrix scales with $m$, focusing on the range $10^2\le m \le 10^3$.
Produce a log-log
graph of time vs $m$, and the simple power law to which it is asymptotic.
BONUS: for what large $m$ would you expect this to break down and why?
%[Hint: what are the best axis choices to illustrate a power law?]
%
% t=[]; ms=100:100:1000;                                    
% for i=1:numel(ms); a=randn(ms(i));tic;svd(a);t(i)=toc; end
% figure; loglog(ms, [t; 3e-9*ms.^3], '+-'); xlabel m; ylabel('t (sec)');

\item Consider the polynomial $p(x) = (x-2)^9 = x^9 - 18x^8 + 144x^7 - 672x^6
+2016x^5 - 4032x^4 + 5376x^3 - 4608x^2+2304x - 512$. [NLA Ex 13.3]
\ben
\item plot $p(x)$ for $x=1.920, 1.921, 1.922, \dots, 2.080$ evaluating $p$
via its coefficients $1, -18, 144, \dots$.
\item overlay on your plot the same computed using $(x-2)^9$
\item explain, including the size of the effect!
\een

%\item Prove that 

%circulant matrix from 2006?

\een

\end{document}
