Question 8.3: FINITE-DIFFERENCE METHOD, LINEAR BVP Consider the BVP in Exa...

FINITE-DIFFERENCE METHOD, LINEAR BVP

Consider the BVP in Example 8.1:

\ddot{u} =0.02u+1,   u(0)=10,   u(10)=100

Solve by the finite-difference method using central-difference formulas and h = Δt = 2.

The 'Blue Check Mark' means that either the MATLAB code/script/answer provided in the answer section has been tested by our team of experts; or the answer in general has be fact checked.

Learn more on how do we answer questions.

At each interior grid point, the second derivative is replaced with a central difference formula to obtain

\frac{u_{i-1}-2u_{i} +u_{i+1} }{\Delta t^{2} }=0.02u_i+1

Since the length of the interval is 10 and Δt = 2, we have N = 10/2 = 5, so that there are N − 1 = 4 interior points. Simplifying the above equation, we find

u_{i-1} -(2+0.02\Delta t^{2} ) u_{i}+u_{i+1} =\Delta t^{2},  i=2,3,4,5     (8.4)

Note that u_1 = 10 and u_6 = 100 are available from the boundary conditions. Applying Equation 8.4 yields

\begin{matrix} u_{1}-2.08u_{2} +u_{3}=4 \\ u_{2}-2.08u_{3}+u_{4} =4 \\ u_{3} -2.08u_{4}+u_{5}=4 \\u_{4}-2.08u_{5}+u_{6} =4 \end{matrix}  \overset{u_{1}=10 }{\underset{u_{6}=100 }{\Rightarrow }}   \left [ \begin{matrix} -2.08 & 1 & & \\ 1 & -2.08 & 1 & \\ & 1 & -2.08 & 1 \\ & & 1 & -2.08 \end{matrix} \right ] \left \{ \begin{matrix} u_{2} \\ u_{3} \\ u_{4} \\ u_{5} \end{matrix} \right \} =\left \{ \begin{matrix} -6 \\4 \\ 4 \\ -96 \end{matrix} \right \}

As projected by the structure of Equation 8.4, the resulting coefficient matrix is tridiagonal, and thus will be solved using the Thomas method (Section 4.3). That yields

u_2 = 15.0489 ,   u_3 = 25.3018 ,   u_4 = 41.5788 ,   u_5 = 65.1821

Comparison with the Shooting Method
In Example 8.1, we learned that the true solution (using the shooting method) of the current BVP is obtained by solving the following system via RK4:

\left\{\begin{matrix}\begin{matrix}  \dot{x} _{1}=x_{2} \\ \dot{x} _{2}=0.02x_{1} +1  \end{matrix} ,   \begin{matrix} x_{1}(0)=10 \\ x_{2} (0)=1.4112\end{matrix}\end{matrix}\right.
TABLE 8.1
Comparison of Results: Shooting Method,
Finite Difference, Actual (Example 8.3)
t Finite Difference Shooting Method Actual
0 10 10 10
2 15.0489 15.2760 15.2762
4 25.3018 25.8084 25.8093
6 41.5788 42.4455 42.4478
8 65.1821 66.5269 66.5315
10 100 100 100

In order to compare the numerical results generated by the shooting method with those given above by the finite-difference method, the step size in shooting method (RK4) must be adjusted to 2:

>> t = 0:2:10;
>> f = @(t,x)([x(2);0.02*x(1)+1]);
>> x0 = [10;yi];
% Solutions by the shooting method at interior grid points
>> u = RK4System(f,t,x0); u(1,[2:end-1])
ans =
15.2760 25.8084 42.4455 66.5269

The exact values at the interior grid points are readily found as follows:

>> ue = matlabFunction(dsolve('D2u = 0.02*u+1','u(0)=10, u(10)=100'));
% Exact solutions at interior grid points
>> ue(t(2:end-1))
ans =
15.2762 25.8093 42.4478 66.5315

A summary of the preceding calculations is presented in Table 8.1, where it is immediately observed that the shooting method produces much more accurate estimates than the finite-difference method. The main reason for this is that the shooting method relies on the RK4 method, which enjoys a very high level of accuracy. The accuracy of both techniques can be improved by reducing the step size Δt.

Related Answered Questions

Question: 8.5

Verified Answer:

The interval is 1.5 in length and \Delta t=...
Question: 8.4

Verified Answer:

The interval is 0.2 in length and \Delta x=...
Question: 8.2

Verified Answer:

There are two state variables selected \eta...
Question: 8.1

Verified Answer:

Since the ODE is second order, there are two state...