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,

\[\int _{-1}^{1} w(x)\, R(\tilde{T},x)\, dx.\]

(2.174)

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

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,

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.

Figure 2.30: Comparison of \(T\) (solid) and \(\tilde{T}\) (dashed) for method of weighted residuals.

Figure 2.31: Error \(\tilde{T}-T\) for method of weighted residuals.

Figure 2.32: Residual \(R(\tilde{T},x)\) for method of weighted residuals.