% Stand 03.04.2000, Matthias Bollhoefer
% Modified by Marine Froidevaux on 10.8.2019
% new LaTeX 2e
\documentclass[12pt,a4paper]{report}
\usepackage{latexsym,amssymb,german,a4wide,verbatim,xr}
\usepackage{fancyhdr} 
%\usepackage{pgffor}
\usepackage{enumitem}
\usepackage{amsmath}
\usepackage{verbatim}
\usepackage{mathtools}

% use labels from a different document
%\usepackage{xr}
% optional \externaldocument[blablbla]{...} to avoid multiple labels \ref{blablablaLABEL}
% is used to get the correct references from the external document
%\externaldocument{../vorles/vorles}

% include graphical environment
%\usepackage{graphics}

% include self defined matrix symbols
%\usepackage{matrix}

%\newcommand*{\pathToExercises}{../../Material_NumerikI_Matthias}
% use selfdefined commands
%\input{\pathToExercises/vorles/meinstil.def}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Layout
%\addtolength{\topmargin}{-15ex}
%\addtolength{\textheight}{20ex}
\pagestyle{fancy}
\setlength{\headheight}{28pt}
\lhead{Technische Universität Berlin\\Numerische Mathematik I - WS 2019/2020}
\rhead{}
\cfoot{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newcommand{\CurrentWeekNb}{6}
\newcounter{taskNb}
\stepcounter{taskNb}

\begin{document}
%\thispagestyle{AbgabeDatum}
\begin{center}
%{\LARGE Numerische Mathematik}\\[1.5ex]
%%{\large \CurrentWeekNb. \"Ubungsblatt}\\ 
{\Large Exercise sheet for the \CurrentWeekNb. tutorial}\\ 
{Woche 25.11.-29.11.19}\\
%\\{Diese Aufgaben müßen spätestens am 24.10.19 in der Vorlesung abgegeben werden.}
%{Abgabe:} Spätestens am 24.10.19 in der Vorlesung\\[0.5cm]
\end{center}
%\hfill {Abgabe: Spätestens am 24.10.19 in der Vorlesung}\\[0.5cm]
%
%%\def\exerciseList{001, 002, 003}
%\begin{enumerate}
%
%

\paragraph{Exercise 1}
Let us consider the partial differential equation
%
\begin{equation}\label{eq:pde}
  \frac{\partial y(x,t)}{\partial t} =  \frac{\partial^2 y(x,t)}{\partial x^2}
\end{equation}
%
for all $x\in\Omega = (0,1)$, $t\geq 0$ with Dirichlet boundary conditions $y(0,t)=y(1,t)=0$ for all $t\geq 0$ and initial condition $y(x,0)=s(x)$, where $s:[0,1]\to\mathbb R$ is a given function satisfying $s(0)=s(1)=0$.
The solution $y(x,t)$ is bounded for all $x\in \Omega$ and all $t>0$, independently from $s(x)$. That means that the problem has a stable equilibrium point. One does not have to show this.

Let us discretize this equation using the central difference quotient (of second order) for the space variable $x$ and using the explicit Euler method for the time variable $t$.
Let us denote the (constant) grid width $\Delta x=1/N$, $N\in\mathbb{N}\geq 2$ and the (constant) time increment $\Delta t$. Answer the following questions:
%
\begin{enumerate}
  \item\label{it:1} Under which conditions for $\Delta x$, $\Delta t$ is the discretized system also stable? That is, the numerical solution should always be bounded for all $x\in \Omega$ and all $t>0$, independently from $s(x)$.
\end{enumerate}
%
Let us now consider the original problem \eqref{eq:pde} with general Dirichlet boundary conditions $y(0,t)=a$, $y(1,t)=b$ for all $t\geq0$ (and then also $s(0)=a$, $s(1)=b$).
%
\begin{enumerate}\setcounter{enumi}{1}
  \item What does the equilibrium point of the new problem look like?
  \item Does the result from point \ref{it:1} hold also in this case?
\end{enumerate}
%
Hint: You can use the fact that the eigenvalues of the matrix $-D_x^2$, where $D_x^2 u(t)\approx  \frac{\partial^2 y(x,t)}{\partial x^2}$, lie in the interval $[4, 4/ \Delta x^2 ]$.

\paragraph{Exercise 2}
Can the difference quotient
$$
\frac{y(x+2h)-y(x+h)-y(x)+y(x-h)}{2h^2}
$$
be used as approximation of $y''(x)$? If yes, which order has the error?

\emph{Bonus question:} Is there any $\hat x=x+\hat h$, such that the presented difference quotient is a (better) approximation of $y''(\hat x)$?

\paragraph{Exercise 3}
Let us define $$A_n = \begin{bmatrix} -2 &1\\1&-2&\ddots\\ &\ddots&\ddots&1\\ &&1&-2 \end{bmatrix}\in\mathbb{R}^{n,n},$$ for all $n\in\mathbb N$.
For a generic matrix $A\in\mathbb R^{n,n}$, let $\operatorname{nnz}(A)$ denote the number of entries of $A$ which are different from zero, and let $\operatorname{size}(A)$ denote the total number of entries of $A$.
\begin{enumerate}
  \item What is the value of the quotient $\operatorname{nnz}(A_n)/\operatorname{size}(A_n)$?
  \item Compute the inverse of $A_4$. What is the quotient of $\operatorname{nnz}(A_4^{-1})/\operatorname{size}(A_4^{-1})$?
\end{enumerate}
Compare and comment the two results.

\end{document}


