\documentclass[12pt,a4paper]{article}

\usepackage{amstext}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{stmaryrd}
\usepackage{enumerate}
\usepackage{alltt}
\usepackage[latin1]{inputenc}
\usepackage{cancel}
\usepackage{fancyhdr}
\usepackage{listings}
\usepackage{pstricks}
\usepackage{pst-plot}
\usepackage{wasysym}
\usepackage{rotating}

\title{\textsc{Numerical Algorithms for Visual Computing II \\ \large Assignment 3}}
\author{\shortstack[c]{Jan Hendrik Dithmar\\ \scriptsize 2031259} \and \shortstack[c]{Andreas Steinel \\ \scriptsize
2029984}}
\date{}

\pagestyle{fancy}

\lhead{Assignment 3}
\chead{}
\rhead{Dithmar (2031259), Steinel (2029984)}
\lfoot{NAVC II}
\cfoot{Page \thepage}
\rfoot{WS 2008/2009}

\begin{document}

\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}

\newcommand{\exercise}[1]{\subsection{#1}}
\renewcommand{\theenumi}{\textbf{\alph{enumi}}}

\newcommand{\AND}{\ensuremath{\wedge}}
\newcommand{\OR}{\ensuremath{\vee}}
\newcommand{\SetR}{\ensuremath{\mathbb{R}}}
\newcommand{\SetN}{\ensuremath{\mathbb{N}}}
\newcommand{\SetC}{\ensuremath{\mathbb{C}}}
\newcommand{\SetZ}{\ensuremath{\mathbb{Z}}}
\newcommand{\SetQ}{\ensuremath{\mathbb{Q}}}
\newcommand{\SetB}{\ensuremath{\mathbb{B}}}
\newcommand{\QED}{\ensuremath{\hspace*{\fill}\square}}
\newcommand{\FLASH}{\ensuremath{\hspace*{\fill}\lightning}}
\newcommand{\OnotO}{\ensuremath{\mathcal{O}}}
\newcommand{\bild}[2]{
	\begin{figure}[htpb]
		\centering
			\includegraphics[#1]{#2}\\[0.2cm]
	\end{figure}
	}

\newcommand{\m}[1]{\begin{pmatrix}#1\end{pmatrix}}
\newcommand{\+}{\phantom{-}}
\newcommand{\f}{\frac}

\maketitle

\thispagestyle{empty}

\newpage
\setcounter{page}{1}
\setcounter{section}{3}

\exercise{The 1-D Spectacle}
\begin{enumerate}
	\item The solution is a line
		$$u(x) = ax + b$$
		So, we have $u''(x) = 0, u'(x) = a, u(x) = ax + b$ by normal school primitive calculation. Further, we have $u(0) = k_1$ and $u(1) = k_2$, which leads to
		\begin{eqnarray*}
			u(0) & = & a \cdot 0 + b \Rightarrow b = k_1 \\
			u(1) & = & a \cdot 1 + b \\
			& = & a + k_1 \Rightarrow a = (k_2 - k_1)
		\end{eqnarray*}
		Therefore, the sought function is
		$$u(x) = (k_2 - k_1) x + k_1$$
	\item The problems (b1), (b2) and (b4) are reasonable where the others are (partially) not.
		\begin{itemize}
			\item[(b1)]
				\begin{eqnarray*}
					u'(x) & = & 1 \\
					u(0) & = & 2= k_1 \\[0.3cm]
					u'(x) & = & k_2 - k_1\Leftrightarrow 1 + 2 = 3 = k_2 \\[0.3cm]
					\Rightarrow u(x) & = & x + 2
				\end{eqnarray*}
			\item[(b2)]
				\begin{eqnarray*}
					u'(x) & = & 3 \\
					u(1) & = & 4 \\
					u(2) & = & 7 \\[0.3cm]
					u'(x) & = & 3 \Leftrightarrow u(2) - u(1) = 3 \\[0.3cm]
					u(x) & = & 3x + 4
				\end{eqnarray*}
			\item[(b3)]
				\begin{eqnarray*}
					u''(x) & = & 0 \\
					u(1) & = & 4
				\end{eqnarray*}
				This gives too less information and only one degree of freedom ($u'$). This results in infinitely many solutions.
			\item[(b4)]
				\begin{eqnarray*}
					u''(x) & = & 0 \\
					u(1) & = & 4 \\
					u'(1) & = & 1\\[0.3cm]
					\Rightarrow u(x) & = & 1 \cdot x + 4
				\end{eqnarray*}
			\item[(b5)]
				\begin{eqnarray*}
					u''(x) & = & 0 \\
					u(1) & = & 4 \\
					u''(1) & = & 1
				\end{eqnarray*}
				We have at 1 a minimum ($u''(1) > 0$). Besides, the solution (b4) stays the same, except that we are not $C^2$-continuous at $u(1)$. $u''(1) \neq \lim_{x \to 1} \underbrace{0}_{= u''(x)}$. \\
				If the BVP relies on $C^2$-continuity, this problem is not reasonable.
		\end{itemize}
\end{enumerate}

\exercise{Connecting analytical and numerical stuff}
\begin{enumerate}
	\item Approximating $u'$ in the following way
		$$u' = \frac{u_{i+1} - u_i}{\Delta x}$$
		yields the discrete formulation of the integral
		$$\sum_{i=0}^N \left( \frac{u_{i+1} - u_i}{\Delta x} \right)^2$$
	\item Setting $\frac{\partial}{\partial u_k} = 0$ for $k=1,...,N$.
		\begin{eqnarray*}
			0 = \frac{\partial}{\partial u_1} & = & - \frac{2}{(\Delta x)^2} (u_2 - u_1) \quad \quad \quad \quad \quad  \quad \quad \quad \quad \quad \quad (k=1) \\
			0 = \frac{\partial}{\partial u_k} & = & - \frac{2}{(\Delta x)^2} (u_{k+1} - u_k) + \frac{2}{(\Delta x)^2} (u_k - u_{k-1}) \quad (k = 2, ..., N-1) \\
			0 = \frac{\partial}{\partial u_N} & = & - \frac{2}{(\Delta x)^2} (u_N - u_{N-1}) \; \; \quad \quad \quad \quad  \quad \quad \quad \quad \quad (k = N)
		\end{eqnarray*}
	\item The system looks like this:
		$$\left(\begin{array}{rrrrrrr} 1 & 0 & \cdots & \cdots & \cdots & \cdots & 0 \\ 1 & -2 & 1 & 0 & \cdots & \cdots & 0 \\ 0 & 1 & -2 & 1 & 0 & \cdots & 0 \\ 0 & 0 & \ddots & \ddots & \ddots & 0 & 0 \\ 0 & \cdots & 0 & 1 & -2 & 1 & 0 \\ 0 & \cdots & \cdots & 0 & 1 & -2 & 1 \\ 0 & \cdots & \cdots & \cdots & \cdots & 0 & 1\end{array}\right) \left(\begin{array}{c} u_0 \\ u_1 \\ \vdots \\ \vdots \\ \vdots \\ u_N \\ u_{N+1} \end{array}\right) = \left(\begin{array}{c} u_L \\ 0 \\ \vdots \\ \vdots \\ \vdots \\ 0 \\ u_R \end{array}\right)$$
		This system has a unique solution. This is the Laplace matrix system yielding to the same result as already encountered in Assignment 2.
	\item One can relate this to the Euler-Lagrange equation. This differential equation is reasonable since its solutions are the functions for which a given functional is stationary. A differentiable function is stationary at its local maxima or minima. Since we're looking for exactly that property, i.e. a minimiser, the Euler-Lagrange equation is a good choice.
%	\item As stated in \textbf{c.}, this is equivalent to $u_{xx} = 0$. One can write this problem as $u_x = f$ where $f \in \SetR$.
%		[$u_x = f$ is always a better solution to $\min_{u(x)} \int u_x^2 dx$ as any function of $u$, e.g. $u_x = fu$.] One can stress that $(u_x = f)_x = u_{xx} = 0$ is already the Laplace equation. \\
%		In other words,
%		$$\min \int_a^b |u'(x)|^2 dx$$
%		is always fulfilled by a linear interpolation of $a$ and $b$. The minimal solution is at $u'(x) \equiv 0$, which means $u(x)$ is constant. Otherwise, $u'(x) = const$ is true if $u(x)$ is linear.
\end{enumerate}

\end{document}