Let's look at a simple example. Suppose that N = 3 , i.e. Three internal points, but first we will include the boundary points in the matrix D2 that describe the approximate derivatives of the second order:
1 / 1 -2 1 0 0 \ D2 = --- | 0 1 -2 1 0 | h^2 \ 0 0 1 -2 1 /
The first line means that the approximate second derivative at x_1 is 1/h^2 * (u_0 - 2*u_1 + u_2) . We know that u_0 = 0 , although due to the homogeneity of the Dirichlet boundary conditions, therefore, we can simply omit it from the equation, and e get the same result for the matrix
1 / 0 -2 1 0 0 \ D2 = --- | 0 1 -2 1 0 | h^2 \ 0 0 1 -2 0 /
Since u_0 and u_{n+1} are not real unknowns - they are known to be equal to zero, we can completely discard them from the matrix and get
1 / 2 1 0 \ D2 = --- | 1 -2 1 | h^2 \ 0 1 -2 /
Missing entries in the matrix really correspond to the fact that the boundary conditions are zero.
Sven marnach
source share