Skip to main content

Math 220-2: Kursobjekt

Section 1.23 Numerical integration: error bounds

Example 1.23.2. Estimating \(\ln 4\text{:}\) error bounds.

Let \(f(x)=\frac{1}{x}\text{.}\) Recall that \(\ln 4=\int_1^4 f(x)\, dx\text{.}\)
Compute bounds for the errors in (a) the \(n=10\) trapezoidal estimate of \(\ln 4\) and (b) the \(n=10\) Simpson’s rule estimate of \(\ln 4\text{.}\)
Solution.
Throughout, let \(I=\int_1^4\frac{1}{x}\, dx\text{,}\) let \(T_n\) be the \(n\)-th trapezoidal estimate of \(I\text{,}\) and let \(S_n\) be the \(n\)-th Simpson’s rule estimate of \(I\text{.}\)
  1. To bound the error estimate \(\abs{T_{10}-I}\) we first must find an upper bound of \(\abs{f''(x)}=\abs{\frac{2}{x^3}}\) on \([1,4]\text{.}\) Since \(\abs{\frac{2}{x^3}}=\frac{2}{x^3}\) is decreasing and positive on \([1,4]\text{,}\) it attains its largest value at \(x=1\text{,}\) the left endpoint of the interval. We conclude that
    \begin{equation*} \abs{f''(x)}\leq 2 \text{ for all } x\in [1,4] \end{equation*}
    and thus we may take \(M=2\) in the error bound formula (1.23.3). Thus
    \begin{align*} \abs{T_{10}-I} \amp \leq \frac{2(4-1)^3}{12\cdot 10^2}\\ \amp = \frac{2\cdot 3^3}{1200}\\ \amp = \frac{9}{200}=0.045\text{.} \end{align*}
    We conclude that \(T_{10}\) is at most \(0.045\) off of the true value of \(I\text{.}\) Using the computational cell in Interactive example 1.22.1 you can see that in fact we have \(\abs{T_{10}-I}\approx .0069\text{.}\) We are of course not bothered by the fact that the true error is significantly less than the error bound provided by Theorem 1.23.1. The theorem says simply the error can be no worse than \(0.045\text{.}\)
  2. To bound the error \(\abs{S_{10}-I}\) we must first find a bound of \(\abs{f^{(4)}(x)=\frac{24}{x^5}}\) on \([1,4]\text{.}\) The logic is similar to the above: on \([1,4]\) we have \(\abs{f^{(4)}(x)}=\frac{24}{x^5}\text{,}\) which is a positive decreasing function. Thus
    \begin{equation*} \abs{f^{(4)}(x)}\leq \abs{f^{(4)}(1)}=24 \text{ for all } x\in [1,4] \end{equation*}
    and we may take \(M=24\) in the error bound (1.23.4). We now have
    \begin{align*} \abs{S_{10}-I} \amp \leq \frac{24(4-1)^5}{180\cdot 10^4}\\ \amp = \frac{162}{50,000}\\ \amp \leq .00324\text{.} \end{align*}
    Again, using Interactive example 1.22.1, we can see that the actual error in our estimate is \(\abs{S_{10}-I}\leq 0.0003\text{:}\) significantly smaller than the error bound provided by Theorem 1.23.1.

Example 1.23.3. Estimating \(\pi\text{:}\) error bounds.

Let \(f(x)=\frac{4}{x^2+1}\text{.}\) We have
\begin{align*} f''(x)\amp =\frac{8(3x^2-1)}{(x^2+1)^3}\\ f^{(4)}(x)\amp =\frac{96(5x^4-10x^2+1)}{(x^2+1)^5}\text{.} \end{align*}
  1. Recall that \(\pi=\int_0^1 f(x)\, dx\text{.}\) Compute bounds for the errors in estimating \(\pi\) using (a) the \(n=10\) trapezoidal rule, and (b) the \(n=10\) Simpson’s rule.
  2. Find (a) an \(n\) such that the \(n\)-th trapezoidal estimate of \(\pi\) is within \(10^{-9}\) of the actual value, and (b) an \(n\) such that the \(n\)-th Simpson’s rule estimate of \(\pi\) is within \(10^{-9}\) of the actual value.
Solution.
Throughout, let \(I=\int_0^1 f(x)\, dx\text{,}\) let \(T_n\) be the \(n\)-th trapezoidal estimate of \(I\text{,}\) and let \(S_n\) be the \(n\)-th Simpson’s rule estimate of \(I\text{.}\)
  1. For the error bound for \(T_{10}\) we first compute
    \begin{align*} \abs{f''(x)}\amp =\frac{8\abs{3x^2-1}}{(x^2+1)^3} \\ \amp \leq \frac{8\abs{3x^2-1}}{1} \amp (x\in [0,1]\implies x^2+1\geq 1) \\ \amp \leq 8\cdot 2 \amp (x\in [0,1]\implies -1\leq 3x^2-1\leq 2)\\ \amp = 16\text{.} \end{align*}
    Note: the inequality \(\abs{3x^2-1}\leq 2\) was derived simply by graphing the quadratic function \(y=3x^2-1\) on \([0,1]\text{.}\) Taking \(M=16\) in (1.23.3), we compute
    \begin{align*} \abs{T_{10}-I} \amp \leq \frac{16\cdot (1-0)^3}{12\cdot 10^2}\\ \amp = \frac{16}{1200}\\ \amp = \frac{1}{75}\\ \amp \leq .0267\text{.} \end{align*}
    Using Interactive example 1.22.1 we see that the actual error satisfies \(\abs{T_{10}-I}\leq 0.001\text{.}\)
    For the error bound for \(S_{10}\) we first compute
    \begin{align*} \abs{f^{(4)}(x)}\amp =\frac{96\abs{5x^4-10x^2+1}}{(x^2+1)^5} \\ \amp \leq \frac{96\abs{5x^4-10x^2+1}}{1} \amp (x\in [0,1]\implies (x^2+1)^5\geq 1) \\ \amp \leq 96(\abs{5x^4}+\abs{10x^2}+\abs{1}) \amp (\text{tri. ineq. }: \abs{a+b}\leq \abs{a}+\abs{b})\\ \amp = 1536\text{.} \end{align*}
    Taking \(M=1536\) in (1.23.4), we compute
    \begin{align*} \abs{T_{10}-I} \amp \leq \frac{1536\cdot (1-0)^5}{180\cdot 10^4}\\ \amp = \frac{1536}{180\cdot 10^4}\\ \amp \leq 0.00085 \text{.} \end{align*}
    Using Interactive example 1.22.1 we see that the actual error satisfies \(\abs{S_{10}-I}\leq 3\times 10^{-8}\text{.}\)
  2. Using our bounds on \(\abs{f''}\) and \(\abs{f^{(4)}}\) from above, we have using Theorem 1.23.1
    \begin{align*} \abs{T_n-I} \amp \leq \frac{16}{12\cdot n^2} \amp \abs{S_n-I}\amp \leq \frac{1536}{180\cdot n^4}\text{.} \end{align*}