Weighted average methods are also often called "Rayleigh-Ritz Methods". The idea is to satisfy the differential equation in an average sense by converting it into an integral equation. The differential equation is multiplied by a weighting function and then averaged over the domain.
If is a weighting function then the weak form of Equation (1) is
The weighting function can be any function of the independent variables that is sufficiently well-behaved that the integrals make sense.
Recall that we are looking for an approximate solution. Let us call this approximate solution . If we plug the approximate solution into equation (5) we get
Since the solution is approximate, the original differential equation will not be satisfied exactly and we will be left with a residual. Weighted average methods try to minimize the residual in a weighted average sense.
Finite element methods are a special type of weighted average method.
In the collocation method, we minimize the residual by making it vanish at points within the domain.
For our problem, the domain of interest is . Let us pick two points in this domain and such that (see Figure 1). In this example we choose and .
Figure 1. Discretized domain for Problem 1.
The values of the residual (8) at and are
If we now impose the condition that the residual vanishes at these two points and solve the resulting equations, we get and . Therefore the approximate solution is
Figure 2 shows a comparison of this solution with the exact solution.
You can see that the collocation method gives a solution that is close to the exact up to . However, the same results cannot be used up to without re-evaluating the integrals.
If you think in terms of equation (6) you can see that a weighting function was used to get to the solution. In fact, it is the choice of weighting function that determines whether a method is a collocation method! The weighting function in this case is
The subdomain method is another way of minimizing the residuals. In this case, instead of letting the residual vanish at unique points, we let the "average" of the residual vanish over each domain. That is, we let,
where is the subdomain over which averaging is done. From this definition it is clear that the weighting function for the subdomain method is
Let us apply the subdomain method to Problem 1. We discretize the domain by choosing one point between and at . For the two subdomains (elements) we have,
Setting these residuals to zero and solving for and we get and . Therefore the approximate solution is
Figure 2 shows a comparison of the exact solution and the subdomain and the collocation solutions.
Figure 2. Subdomain solution versus exact solution for Problem 1.
In this case, instead of writing our trial function as,
we write it as
where are linearly independent functions of . These are called basis functions, interpolation functions, or shape functions. The first term is left outside the sum because it is associated with part or all of the initial or boundary conditions (i.e., we put everything that can be fixed by initial or boundary conditions into ).
Then the trial function in equation (7) can be rewritten using basis functions as
In the Galerkin method we choose the basis functions as the weighting functions.
If we use as the weighting functions , equation (6) becomes
Plugging in the value of from equation (8) into equation (13) and using the basis functions from (12) we get
After integrating and solving for and we get and . Therefore, the Galerkin approximation we seek is
Figure 3 shows a comparison of the exact solution with the Galerkin, subdomain, and collocation solutions.
Figure 3. Galerkin solution versus exact solution for Problem 1.
All the approximate solutions diverge from the exact solution beyond . The solution to this problem is to break up the domain into elements so that the trial solution is a good approximation to the exact solution in each element.