Understand finite discretisation with and without eliminating boundary conditions.

52 Views Asked by At

Exercise: For a given function $f$ we consider the following boundary value problem:

$$-\dfrac{d^2u(x)}{dx^2} + u(x) = f(x) \text{ for }0<x<1,$$ with boundary conditions $$u(x =0) = 0\text{ and } u(x = 1) = 0.$$ A finite difference method is used on a uniform mesh with $N$ intervals and mesh width $h = 1/N$.

  • Give the finite difference stencil for internal grid points.
  • Give the matrix $A^h$ for $N = 3$ where the boundary conditions are eliminated.

What I've tried: I know that $\dfrac{d^2u(x)}{dx^2}(x_i,y_j) = \dfrac{u_{i-1,j}^h - 2u_{i,j}^h + u_{i+1,j}^h}{h^2} + \mathcal{O}(h^2)$, so the stencil for internal points will look like: $1/h^2\begin{bmatrix}-1&2&-1\end{bmatrix} +\begin{bmatrix}0&1&0\end{bmatrix} = 1/h^2\begin{bmatrix}-1 & 2+ h^2 & -1\end{bmatrix}$. I think I was able to figure out $A^h$; the matrix denoted by $A^h$ is of size $2\times 2$ and given by $$A^h = \dfrac{1}{h^2}\begin{bmatrix}2+h^2& -1\\-1 & 2+h^2\end{bmatrix}$$ Question: What would the matrix $A^h$ have looked like without elimination of boundary conditions?