EXERCISES 5.5

\(\def\ds{\displaystyle} \) 1 (a) \(\ds f(-\frac{1}{\sqrt{3}})+f(\frac{1}{\sqrt{3}}) = 0\), which agrees with the correct value of the integral. Error \(= 0\).

1 (b) \(\ds f(-\frac{1}{\sqrt{3}})+f(\frac{1}{\sqrt{3}}) = \frac{1}{9}+\frac{1}{9} = \frac{2}{9}\). Correct value is \(2/5\), and the error \(= 8/45\approx 0.177778\).

1 (c) \(\ds f(-\frac{1}{\sqrt{3}})+f(\frac{1}{\sqrt{3}}) = e^{-1/\sqrt{3}} + e^{1/\sqrt{3}}\approx 2.342696\). Compared to the correct value \(e-1/e\), the error \(= 0.007706\).

1 (d) \(\ds f(-\frac{1}{\sqrt{3}})+f(\frac{1}{\sqrt{3}}) = \cos -\pi/\sqrt{3} + \cos\pi/\sqrt{3}\approx -0.481237\). Compared to the correct value \(0\), the error \(= 0.481237\).


3 (a) Use roots \(x_1, x_2, x_3, x_4\) and coefficients \(c_1, c_2, c_3, c_4\) from Table 5.1. For \(f(x) = x^3+2x\), the Gaussian quadrature estimate \(c_1f(x_1)+c_2f(x_2)+c_3f(x_3)+c_4f(x_4)\) is zero, in agreement with the correct value. Error \(=0\).

3 (b) Similar to (a). For \(f(x)=x^4\), the Gaussian quadrature estimate is \(0.4\), equal to the correct value. Error \(=0\).

3 (c) Similar to (a). For \(f(x)=e^x\), the Gaussian quadrature estimate is \(2.350402\), differing from the correct value by error \(2.95\times10^{-7}\).

3 (d) Similar to (a). For \(f(x)=\cos\pi x\), the Gaussian quadrature estimate is \(-0.002136\), differing from the correct value zero by error \(0.002136\).


5 (a) By change of interval, \[\int_0^4 \frac{x}{\sqrt{x^2+9}}\ dx = \int_{-1}^1 \frac{4t+4}{\sqrt{4(t+1)^2+9}}\ dt.\] Calculating the \(n=3\) Gaussian quadrature approximation \[\frac{5}{9}f(-\sqrt{3/5})+\frac{8}{9}f(0)+\frac{5}{9}f(\sqrt{3/5})\] with \(f(t) = (4t+4)/\sqrt{4(t+1)^2+9}\) yields \(1.999825\)

5 (b) By change of interval, \[\int_0^1 \frac{x^3}{x^2+1}\ dx = \int_{-1}^1 \frac{(t+1)^3}{4((t+1)^2+4)}\ dt.\] The \(n=3\) Gaussian quadrature approximation yields \(0.15340700\).

5 (c) By change of interval, \[\int_0^1 xe^x\ dx = \int_{-1}^1 \frac{t+1}{4}e^{(t+1)/2}\ dt.\] The \(n=3\) Gaussian quadrature approximation yields \(0.99999463\).

5 (d) By change of interval, \[\int_1^3 x^2\ln x\ dx = \int_{-1}^1 (t+2)^2\ln (t+2)\ dt.\] The \(n=3\) Gaussian quadrature approximation yields \(6.99867782\).


7 The functions are orthogonal on the interval \([-1,1]\) because

\({\ds \int_{-1}^1 x(x^2-\frac{1}{3})\ dx = \int_{-1}^1 x^3-\frac{1}{3}x\ dx =(1)^4-\frac{(1)^2}{6}-((-1)^4-\frac{(-1)^2}{6}) = 0.}\)


9 The third Legendre polynomial is calculated from the formula in Example 5.14 as \begin{eqnarray*} p_3(x)&=&\frac{1}{2^33!}\frac{d^3}{dx^3}[(x^2-1)^3]= \frac{1}{48}(120x^3-72x) = \frac{5}{2}x^3-\frac{3}{2}x. \end{eqnarray*} By factoring \({\ds p_3(x) = \frac{1}{2}x(5x^2-3),}\) the three roots \(x_1=-\sqrt{3/5}, x_2=0, x_3=\sqrt{3/5}\) are found. The corresponding coefficients for Gaussian Quadrature are the integrals of the Lagrange interpolating functions \[c_i=\int_{-1}^1 L_i(x)\ dx. \] For example, \[c_1 = \int_{-1}^1 \frac{(x-\sqrt\frac{3}{5})x}{2\sqrt\frac{3}{5}\sqrt\frac{3}{5}}\ dx = \frac{5}{6}\left[\frac{x^3}{3}-\frac{\sqrt\frac{3}{5}x^2}{2}\right]_{-1}^1 = \frac{5}{6}\left[\frac{2}{3}\right] = \frac{5}{9}\] and \[c_2 = \int_{-1}^1 \frac{(x+\sqrt\frac{3}{5})(x-\sqrt\frac{3}{5})}{-\sqrt\frac{3}{5}\sqrt\frac{3}{5}}\ dx = -\frac{5}{3}\left[\frac{x^3}{3}-\frac{3}{5}x\right]_{-1}^1 = -\frac{5}{3}\left[-\frac{8}{15}\right] = \frac{8}{9}. \] The third coefficient \(c_3 = 5/9\) is equal to \(c_1\) by symmetry.