The finite difference method is a widely used technique for solving boundary-value problems. It approximates the derivatives in the differential equations using finite differences, thereby converting the differential equations into a system of algebraic equations. By solving these algebraic equations, one determines the values of the dependent variable at specific discrete points of the independent variable.
To demonstrate this approach, let’s solve the following second-order linear two-point boundary-value problem:
We begin by dividing the interval into subintervals, each of length , by the grid points
Next, we approximate the unknown function at these mesh points. By replacing the derivatives and with their finite difference approximations from “Deriving Finite Difference Approximations of the Derivatives“:
we obtain the following relationships that the solution must satisfy:
Suppose that we can find numbers that satisfy the equations:
where and .
Then we can consider to be the approximations of the solution at the the grid points .
Furthermore, (*) can be rewritten as:
This forms a system of linear equations in the unknowns . In matrix form it is:
Solving this system of linear equations yields for .
Exercise-1 Show that discretizing the boundary-value problem
leads to the following system of linear equations:
Exercise-2 Show that a more accurate approximation of boundary conditions is given by
Exercise-3 Deriving the system of linear equations by discretizing boundary conditions using (1) and (2).
Exercise-4 Show that