2.8.3 The Method of Weighted Residuals
While the collocation method enforces the residual to be zero at \(N\) points, the method of weighted residuals requires \(N\) weighted integrals of the residual to be zero. A weighted residual is simply the integral over the domain of the residual multiplied by a weight function, \(w(x)\). For example, in the one-dimensional diffusion problem we are considering, a weighted residual is,
By choosing \(N\) weight functions, \(w_ i(x)\) for \(i=1,\ldots ,N\), and setting these \(N\) weighted residuals to zero, we obtain \(N\) equations which we solve to determine the \(N\) unknown values of \(a_ j\).
We define the weighted residual for \(w_ i(x)\) to be
The method of weighted residuals requires
In the method of weighted residuals, the next step is to determine appropriate weight functions. A common approach, known as the Galerkin method, is to set the weight functions equal to the functions used to approximate the solution. That is,
For the heat diffusion example we have been considering, this would give weight functions as
Now, we must calculate the weighted residuals. For our example, we have
To do this integral, the following results were used:
Similarly, calculating \(R_2\):
where the following results have been used:
Finally, we can solve for \(a_1\) and \(a_2\) by setting the weighted residuals \(R_1\) and \(R_2\) to zero:
This could be written as a \(2\times 2\) matrix equation and solved, but the equations are decoupled and can be readily solved,
The results using this method of weighted residuals are shown in the figures below. Comparison with the collocation method results shows that the method of weighted residuals is more accurate in this case.