next up previous
Next: About this document ...

Math428: Problem Set #6 solution guide

1.
If y(x) is a three times differentiable function, prove that

\begin{displaymath}y_k' - \frac{y_{k+1}-y_{k-1}}{2h} = O(h^2),
\end{displaymath}

where yk = y(kh). Hint: Use Taylor series, of course.


Here, we just make the substitutions

\begin{eqnarray*}y_{k+1} & = & y_k + h y_k' + \frac{1}{2} h^2 y_k'' +
\frac{1}{...
... y_k' + \frac{1}{2} h^2 y_k'' -
\frac{1}{6} h^3 y_k'''+ O(h^4).
\end{eqnarray*}


After making the substitutions and cancelling everything out, you end up with a remainder

\begin{displaymath}\frac{1}{6} h^2 y_k'' + O(h^3) = O(h^2).
\end{displaymath}


2.
If y(x) is a four times differentiable function, prove that

\begin{displaymath}y_k'' - \frac{y_{k+1}-2 y_k+y_{k-1}}{h^2} = O(h^2).
\end{displaymath}


This is very similar to the previous problem, except that one expands one step further.

\begin{eqnarray*}y_{k+1} & = & y_k + h y_k' + \frac{1}{2} h^2 y_k'' +
\frac{1}{...
...' -
\frac{1}{6} h^3 y_k''' + \frac{1}{24} h^4 y_k'''' + O(h^5).
\end{eqnarray*}


After making all the cancellations, one ends up with a remainder like

\begin{displaymath}\frac{1}{12} h^2 y_k'''' + O(h^3) = O(h^2)
\end{displaymath}


3.
Derive a second order finite difference for yk' with variable step size using yk+1, yk, and yk-1. To do this, find coefficients A1, A2 and A3 such that

\begin{displaymath}y_k' - \frac{A_1 y_{k+1}+A_2 y_k + A_3 y_{k-1}}{h_1 + h_2} = O(h^2),
\end{displaymath}

where h1 = xk+1-xk and h2 = xk-xk-1. Use Taylor series again. Expect the A's will depend upon the h's. You can check your answer by seeing if you recover the usual centered difference formula when h1=h2.


First, we need to expand yk+1 and yk-1.

\begin{eqnarray*}y_{k+1} & = & y_k + h_1 y_k' + \frac{1}{2} h_1^2 y_k'' + O(h^3)...
...y_{k-1} & = & y_k - h_2 y_k' + \frac{1}{2} h_2^2 y_k'' + O(h^3).
\end{eqnarray*}


Next, we need to set up the linear system that eliminate terms with yk, yk' and yk''.

\begin{eqnarray*}A_1 + A_2 + A_3 & = & 0, \\
\frac{h_1 A_1 - h_2 A_3}{h_1+h_2} & = & 1, \\
h_1^2 A_1 + h_2^2 A_3 & = & 0.
\end{eqnarray*}


If we solve this system, we find that

\begin{eqnarray*}A_1 & = & \frac{h_1}{h_2}, \\
A_2 & = & \frac{h_2^2 - h_1^2}{h_1 h_2}, \\
A_3 & = & - \frac{h_2}{h_1}.
\end{eqnarray*}



4.
[Based on KC 8.9: 1] Solve the two point boundary value problem

\begin{displaymath}y'' = e^x + y^2 \cos x - (x-1) y', \ \ \ y(0) = 1,\ \ \ y(1) = 3,
\end{displaymath}

using the shooting method with the secant rule.


See matlab m-file and diary for this one. I implemented a system for y and $\frac{\partial y}{\partial z}$ because I knew I would need it for the next problem. One can see that the secant method finds a correct value of y'(0) (0.17978) in a few steps, so that y(1) is 3 to 5 digits of precision. Of course, one could continue the process to gain whatever precision one needs.


5.
[Based on KC 8.9: 1] Solve the two point boundary value problem

\begin{displaymath}y'' = e^x + y^2 \cos x - (x-1) y', \ \ \ y(0) = 1,\ \ \ y(1) = 3,
\end{displaymath}

using the shooting method with Newton's Method.


This is the same as the previous problem with similar results except we use Newton's method.


6.
[Based on KC 8.9: 1] Solve the two point boundary value problem

\begin{displaymath}y'' = e^x + y \cos x - (x-1) y', \ \ \ y(0) = 1,\ \ \ y(1) = 3,
\end{displaymath}

using finite differences. Note that the differential equation in this problem is different from the previous two.


For this problem, we set up a linear system by writing out each derivative and second derivative as a second order finite difference. Then, we solve the linear system using Gaussian elimination. The matlab diary and m files are posted on the web.



 
next up previous
Next: About this document ...
Louis F Rossi
2002-05-02