An archived instance of discourse for discussion in undergraduate PDE.

Test 1 Sample Part 2 Problems - #3

cromer

I was working on the matrix formulation problem, and I think what I have is right, but I wanted to make sure I have done it correctly and achieved the correct format.

The problem is finding numerical estimates for the equation $u'' = \lambda u$ with $u(0) = u(1) = 0$. The interval is divided into four pieces, leaving four endpoints: $u_0,u_1,u_2,u_3$, and $u_4$. The discretized second derivative equation gives

$$\lambda u_i = \frac{1}{1/4^2}(u_{i+1}-2u_i+u_{i-1}).$$

To write this as a matrix, I started by simply putting these equations into column-vector form:

$$\lambda \left[
\begin{array}{c}
u_1 \\ u_2 \\ u_3
\end{array}
\right]
=
\frac{1}{1/4^2}
\left[
\begin{array}{c}
u_0 -2 u_1 + u_2 \\ u_1 - 2 u_2 + u_3 \\ u_2 - 2 u_3 + u_4
\end{array}
\right].$$










Then, reading off the coefficients of each $u_i$ in each row, I wrote this as a matrix-vector product:

$$\lambda \left[
\begin{array}{c}
u_1 \\ u_2 \\ u_3
\end{array}
\right]
=
16
\left[
\begin{array}{ccccc}
1 && -2 && 1 && 0 && 0\\ 0 && 1 && -2 && 1 && 0 \\ 0 && 0 && 1 && -2 && 1
\end{array}
\right]
\left[
\begin{array}{c}
u_0 \\ u_1 \\ u_2 \\ u_3 \\ u_4
\end{array}
\right].$$















We know $u_0$ and $u_4$ from the boundary conditions, so plugging these in, this becomes the matrix equation

$$
16
\left[
\begin{array}{ccccc}
1 && -2 && 1 && 0 && 0\\ 0 && 1 && -2 && 1 && 0 \\ 0 && 0 && 1 && -2 && 1
\end{array}
\right]
\left[
\begin{array}{c}
0 \\ u_1 \\ u_2 \\ u_3 \\ 0
\end{array}
\right]
=
\lambda \left[
\begin{array}{c}
u_1 \\ u_2 \\ u_3
\end{array}
\right].$$
















One thing I wondered is that since the boundary conditions happen to be zero, this matrix equation can be written in $3 \times 3$ form instead of $3 \times 5$. Would we be expected to write it this way, as in

$$
16
\left[
\begin{array}{ccc}
-2 && 1 && 0\\ 1 && -2 && 1\\ 0 && 1 && -2
\end{array}
\right]
\left[
\begin{array}{c}
u_1 \\ u_2 \\ u_3
\end{array}
\right]
=
\lambda \left[
\begin{array}{c}
u_1 \\ u_2 \\ u_3
\end{array}
\right]$$
















on the test?

Edit:

After discussing this problem with Dylan Williams, I am convinced that the matrix need never be $5 \times 5$ but can simply be $3 \times 5$ even in the case of nonzero boundary conditions, and have edited my post above to reflect this.

jradford

My impression was that we would be expected to write it in a 3x3 format, though I'm not positive. That made more sense to me than the 5x5.

Mark

I like it but I do agree with Jacob on the $3\times3$ thing.

cromer

By the method I used to construct it, the $5 \times 5$ made a lot of sense to me, but after talking with some other people I think that it never needs to be that big even if $u_0$ and $u_4$ are not zero (I was thinking about what the matrix would be for other step sizes and boundary conditions). I have edited my post to reflect this.

jradford

In this step:

$$
16
\left[
\begin{array}{ccc}
-2 && 1 && 0\\ 1 && -2 && 0\\ 0 && 1 && -2
\end{array}
\right]
\left[
\begin{array}{c}
u_1 \\ u_2 \\ u_3
\end{array}
\right]
=
\lambda \left[
\begin{array}{c}
u_1 \\ u_2 \\ u_3
\end{array}
\right]$$
















Shouldn't column 3, row 2 be a 1?

cromer

Thanks! I copy-pasted a lot of code there and it seems I deleted a wrong entry.

sfrye

How did you get Lambda*u_i on the left? I botched that on the in class. Don't know how I missed it.

cromer

Because we're obtaining numerical approximations for the eigenvalue equation $u'' = \lambda u$, we set the approximation for the second derivative equal to $\lambda u_i$:

$$\frac{u_{i+1}-2u_i +u_{i-1}}{h^2} = \lambda u_i.$$

In the quiz we had a couple of weeks ago, we found the numerical equations for $u''=x^2$, so the equations were of the form

$$\frac{u_{i+1}-2u_i +u_{i-1}}{h^2} = x_i^2.$$

I may not be the best at explaining it, but hopefully that's helpful.

sfrye

Argg!! I knew it was that simple and was just missing something. Thanks dude.