Approximating an eigenfunction
Consider the eigenfunction problem
$$u'' = \lambda u, \: u(0)=0, \: u(2)=0.$$
We wish to find an approximate solution to an eigenfunction corresponding to the eigenvalue of smallest magnitude by approximating it with a matrix equation.
- Write down a matrix that approximates the second derivative of this function over the interval $[0,2]$.
- Use your favorite numerical software to find the eigenvalue of smallest magnitude and corresponding eigenvector.
- Plot the resulting approximation to the eigenfunction, together with the corresponding actual eigenfunction.
Comments
I tried the following:
a = 0
b = 2
n =25
1) The 24x24 matrix that approximates the 2nd derivative is
$$U_{xx}=\begin{pmatrix} -312.5 & 156.25 & 0 & \ldots & 0 & 0 & 0\\ 156.25 & -312.5 & 156.25 & \ldots & 0 & 0 & 0\\ \ldots & \ldots & \ldots & \ldots & \ldots & \ldots & \ldots\\ 0 & 0 & 0 &\ldots & 156.25 & -312.5 & 156.25\\ 0 & 0 & 0 & \ldots & 0 & 156.25 & -312.5 \end{pmatrix}$$
2) The eigenvalue of smallest magnitude and its corresponding eigenvector are:
$$\lambda = -2.4642$$
$$\vec u = \begin{pmatrix} -0.0354\\ -0.0703\\-0.1041\\-0.1362\\-0.1662\\-0.1936\\-0.2179\\-0.2388\\-0.2559\\-0.2689\\-0.2778\\-0.2822\\-0.2822\\-0.2778\\-0.2689\\-0.2559\\-0.2388\\-0.2179\\-0.1936\\-0.1662\\-0.1362\\-0.1041\\-0.0703\\-0.0354\end{pmatrix}$$
3) The eigenfunction for this problem was: $$k* sin(\sqrt{-\lambda}*x)$$.
If we drop k, we get the following plot:
But if we let $k = -0.09\pi$, we get the following:
Now, I don't remember talking about using the approximation to find $k$ in class. @mark Could you explain why this was necessary here?