\documentclass[10pt,letterpaper]{article}
\usepackage{graphicx,verbatim,amsmath,amssymb,bm}
\usepackage[colorlinks=true]{hyperref}
\topmargin -0.5in
\textheight 9in
\oddsidemargin=-0.05in
\evensidemargin=-0.05in
\textwidth 6.5in
\pagestyle{empty}
\def\bea{\begin{eqnarray}}
\def\eea{\end{eqnarray}}
\newcommand{\be}{\begin{equation}}
\newcommand{\ee}{\end{equation}}
\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.\ }}
\newcommand{\eps}{\varepsilon}
\newcommand{\mbf}[1]{{\mathbf #1}}
\newcommand{\xx}{\mbf{x}}
\newcommand{\yy}{\mbf{y}}
\newcommand{\uu}{\mbf{u}}
\newcommand{\vv}{\mbf{v}}
\newcommand{\nn}{\mbf{n}}
\newcommand{\bb}{\mbf{b}}
%\newcommand{\bm}[1]{\boldmath{#1}}
\newcommand{\pO}{{\partial\Omega}}
\begin{document}
\title{Math 116 Numerical PDEs: Homework 7}
\date{due Mon 9am Feb 27}
\maketitle
{\em Shorter one to let you do projects.
Here you study a toy version of a `fast method' for multiplying
a vector by a dense $N\times N$ interaction (e.g.\ Nystr\"{o}m) matrix.
We work in $\mathbb{R}^2$ which you'll find easier to think of as
$\mathbb{C}$.
}
\ben
\item
Measuring rank of interaction.
\ben
\item
Given $N$, set up a list of $N$
source points chosen uniformly random in $[-1/2,1/2]^2$,
and $N$ target points also chosen uniformly random in
$[3/2,5/2]\times [-1/2,1/2]$.
(Use a single complex number to represent each point.)
\item
Study the numerical rank of the source-target interaction matrix
given by the kernel $(1/2\pi)\log\frac{1}{\|\xx-\yy\|}$.
As $N$ increases, what does it do, specifically?
\item
For $N=100$, compute the numerical rank with tolerance $10^{-10}$
and compare it to the predicted maximum number of multipole
coefficients $P$ needed for this tolerance as in lecture (you may ignore
$O(1)$ constants).
\een
\item
Applying the low-rank property to $O(N)$ fast evaluation of naive $O(N^2)$
interactions.
\ben
\item
Read in the list of $10^6$ charge source locations and charge values
from gzip-compressed text file {\tt sourcecharges.dat}.
The columns are: coord1 coord2 charge.
Each row is one source.
[Hint: see {\tt textread} command.]
Note that values have been chosen to be multiples of $10^{-4}$ to keep the file
a reasonable size, but that your calc should still be to full accuracy.
The target locations are then the sources translated by $(2,0)$.
Sources and targets should fall inside the boxes of the previous question.
\item
Either by evaluating the multipole coefficients, or by filling
skinny and tall matrices and applying them, compute the potentials
at the targets due to the sources.
Use an expansion of order $P$ from the previous question.
[Hint: always vectorize the loop over $N$, otherwise too slow.
Debug by checking against the direct evaluation for a single target]
\item Report the $l^2$ norm (ie root of sum of squares)
of your vector of potentials at all targets.
It should be accurate to around 10 digits (I will check it).
[Hint: it is nearest to the integer 9721]
\een
BONUS: Estimate how many times faster than naive
summation your method is at this $N$. [Note it is too big to run the naive
sum!]
\een
\end{document}