# Numerical Methods Qualification Exam Problems and Solutions (University of Maryland)/Jan04 667

Jump to: navigation, search

## Problem 4a

 Consider the boundary value problem $\begin{cases} -u''(x)+b(x)u(x)=f(x), 0\leq x \leq 1 \\ u(0)=u_l, u(1)= u_r \end{cases} \qquad (1) \!\,$ where $b(x), f(x) \in C[0,1] \!\,$, and $b(x) \geq 0 \!\,$. Formulate a difference method for the approximate solution of $(1) \!\,$ on a uniform mesh of size $h \!\,$. Explain how $u''(x) \!\,$ is approximated by a difference quotient

## Solution 4a

From Taylor expansion of $u(x+h) \!\,$ and $u(x-h) \!\,$ around $x \!\,$, we have

$u''(x) = \frac{u(x+h)-2u(x)+u(x-h)}{h^2} + \frac{u''''(\xi)}{12}h^2 \!\,$

Let $P=\{x_i\}_{i=0}^{N+1} \!\,$ be a uniform partition of $[0,1] \!\,$ with step size $h\!\,$

Then for $i=2,\ldots, N-1 \!\,$ we have

$\begin{bmatrix} -\frac{1}{h^2} &&& \frac{2}{h^2} + b(x_i) &&& -\frac{1}{h^2} \end{bmatrix} \begin{bmatrix} u_{i-1} \\ u_i \\ u_{i+1} \end{bmatrix} = f(x_i) \!\,$

For $i=1: \!\,$

$\begin{bmatrix} \frac{2}{h^2}+b(x_1) &&& -\frac{1}{h^2} \end{bmatrix} \begin{bmatrix} u_1 \\ u_2 \end{bmatrix} =f(x_1) + \frac{u_l}{h^2} \!\,$

For $i=N: \!\,$

$\begin{bmatrix} -\frac{1}{h^2} &&& \frac{2}{h^2}+b(x_N) \end{bmatrix} \begin{bmatrix} u_{N-1} \\ u_N \end{bmatrix} =f(x_N)+ \frac{u_r}{h^2} \!\,$

## Problem 4b

 Suppose $b(x)=0 \!\,$ and $u_l=u_r=0 \!\,$ in $(1) \!\,$. Formulate a finite element method for the approximate solution of $(1)\!\,$ in this special case, again on a uniform mesh. Using the standard "hat functions" basis for the finite element space, write out the finite element equations explicitly. Show that if an appropriate quadrature formula is used on the right-hand side of the finiite element equations, they (the finite element equations) are the same as the finite difference equations.

## Solution 4b

$\begin{bmatrix} \frac{2}{h} & -\frac{1}{h} & & & \\ -\frac{1}{h} & \frac{2}{h} &-\frac{1}{h} & & \\ & \ddots & \ddots & \ddots & \\ & & & -\frac{1}{h}& \frac{2}{h} \end{bmatrix} \begin{bmatrix} u_1 \\ \vdots\\ \vdots\\ u_N \end{bmatrix} = \begin{bmatrix} \int_0^1 f \phi_i \\ \vdots \\ \\ \int_0^1 f \phi_N \end{bmatrix} \!\,$

Since we are integrating hat functions on the right hand side, an appropriate quadrature formula would be to take half of the midpoint rule. The regular midpoint rule would give double the actual integral value of a hat function.

Therefore $\int_0^1 f(x) \phi_i(x) \approx h f(x_i) \!\,$

Then the finite difference method and the finite element method yield the same matrix.

## Problem 4c

 Show that the matrix in $(b) \!\,$ is non singluar.

## Solution 4c

Since the matrix is diagonally dominant, it is non-singular.

To show that the matrix has a non-zero determinant, 2n elementary row operation can be used to show that

$\begin{bmatrix} \frac{2}{h} & -\frac{1}{h} & & \\ -\frac{1}{h} & \frac{2}{h} &-\frac{1}{h} & \\ & \ddots & \ddots & \\ & & -\frac{1}{h}& \frac{2}{h} \end{bmatrix}$

has the same determinant as

$\begin{bmatrix} -\frac{1}{h} & \frac{2}{h} &-\frac{1}{h} & \\ & \ddots & \ddots & \ddots & \\ & & -\frac{1}{h}& \frac{2}{h}\\ & & & \frac{n+1}{h} \\ \end{bmatrix}$

which is $\frac{n+1}{h^n}\neq 0$.

## Problem 5

 Consider the following dissipative initial value problem, $\begin{cases} y'+f(y)=0, 0 \leq x \leq 1 \\ y(0)=y_0 \end{cases} \qquad (2) \!\,$ where $f: R \rightarrow R \!\,$ is smooth and satisfies $0 \leq f'(y) \!\,$

## Problem 5a

 Write the Backward Euler Method for (2). This gives rise to an algebraic equation. Explain how you would solve this equation.

## Solution 5a

Using Taylor Expansion we have

\begin{align} y(x-h) &= y(x)-y'(x)h +\frac{y''(\xi)}{2} h^2 \\ y(x) &= y(x-h)+y'(x)h - \frac{y''(\xi)}{2}h^2 \\ y(x_n) &= y(x_{n-1})+\underbrace{y'(x_n)}_{-f(y(x_n))}h - \underbrace{\frac{y''(\xi)}{2}h^2}_{O(h^2)} \qquad (*) \\ \end{align}

Thus we have Backwards Euler Method:

$y_n = y_{n-1} - h f(y_n)\qquad (**)\!\,$

Let $e_n \equiv y(x_{n-1})-y_n \!\,$

## Problem 5b

 Derive an error estimate of the form $|y(x_n)-y_n | \leq \frac{M}{2}h, n=1,2,\ldots \!\,$ where $M=\max_{0 \leq x \leq 1} |y''(x)| \!\,$. Do this directly, not as an application of a standard theorem. (Note that there is no exponential on the right hand side.

## Solution 5b

Subtracting $(*) \!\,$ and $(**) \!\,$, we have

\begin{align} e_n &= e_{n-1}-h [ f(y(x_n))-f(y_n)] - \frac{y''(\xi)}{2}h^2 \\ &= e_{n-1}-h f'(y(\alpha)) e_n - \frac{y''(\xi)}{2} h^2 \quad \mbox{ (by MVT) } \\ e_n^2 &= e_{n-1}e_n - h \underbrace{f'(y \alpha)}_{< 0} e_n^2 - \frac{y''(\xi)}{2} h^2 e_n \\ &\leq e_{n-1}e_n - \frac{y''(\xi)}{2}h^2 e_n \\ e_n &\leq e_{n-1} - \frac{y''(\xi)}{2}h^2 \\ \| e_n \| &\leq \|e_{n-1}\|+ \frac{\|y''\|_\infty}{2}h^2 \\ \| e_n \| &\leq n \frac{\|y''\|_\infty}{2}h^2 \\ &\leq \frac{M}{2} h \end{align} \!\,