Bounding Error in Evaluating Functions

# Bounding Error in Evaluating Functions

Suppose that we have an approximate value $x_A$ of the true value $x_T$. We saw from the Propagation of Error in Evaluating Functions page that if $y = f(x)$ is a differentiable function for $x \in [a, b]$ and $x_A, x_T \in [a, b]$ then we can approximate the error of $f(x_A)$ to $f(x_T)$

(1)

More generally, the true error of $f(x_A)$ to $f(x_T)$ by $\mathrm{Error} (f(x_A)) = f'(\xi) (x_T - x_A)$ where $\xi$ is between $x_T$ and $x_A$.

The following examples will show that we can bound the error between $f(x_A)$ and $f(x_T)$.

## Example 1

Find bounds on both the error and relative error in $f(x_A)$ from $f(x_T)$ where $f(x) = \sqrt{x}$ and $x_A = 0.0425$ where $x_A$ is correctly rounded to the number of significant digits shown.

We note that $x_A = 0.0425$ has three significant digits and so:

(2)
\begin{align} \quad \mid \mathrm{Error} (x_A) \mid = \mid x_T - x_A \mid = \mid x_T - 0.0425 \mid ≤ \frac{1}{2} \cdot 10^{-4} \end{align}

Let $\epsilon = \frac{1}{2} 10^{-4} = 0.00005$. Then we have that $\mid x_T - 0.0425 \mid ≤ 0.00005$. If we expand the absolute value then we see that:

(3)
\begin{align} \quad x_A - \epsilon = 0.0425 - 0.00005 ≤ x_T ≤ 0.0425 + 0.00005 = x_A + \epsilon \Leftrightarrow 0.04245 ≤ x_T ≤ 0.04255 \end{align}

Now note that for some $\xi$ between $x_A$ and $x_T$ we have that:

(4)
\begin{align} \quad \mid f(x_T) - f(x_A) \mid = \mid f'(\xi) \mid \mid x_T - x_A \mid ≤ \max_{x_A - \epsilon ≤ x ≤ x_A + \epsilon} \mid f'(x) \mid \mid x_T - x_A \mid \end{align}

Note that $f(x) = \sqrt{x}$ and so $f'(x) = -\frac{1}{2 \sqrt{x}}$ and $\mid f'(x) \mid = \frac{1}{2 \sqrt{x}}$. It's not hard to see that this is a continuous decreasing function on the interval $[x_A - \epsilon, x_A + \epsilon] = [0.04245, 0.04255]$ and thus the maximum is achieved at the left endpoint, $0.04245$, that is $\max_{0.04255 ≤ x ≤ 0.04255} \mid f'(x) \mid = \frac{1}{2 \sqrt{0.04255}} \approx 2.42393…$ and thus:

(5)
\begin{align} \quad \mid f(x_T) - f(x_A) \mid ≤ \max_{0.04245 ≤ x ≤ 0.04255} \mid f'(x) \mid \mid x_T - x_A \mid \approx 2.42393 \cdot \frac{1}{2} 10^{-4} \approx 1.21 \cdot 10^{-4} \end{align}

## Example 2

Find bounds on both the error in $f(x_A)$ from $f(x_T)$ where $f(x) = \sin (x)$ and $x_A = 0.04512$ where $x_A$ is correctly rounded to the number of significant digits shown.

We note that $x_A = 0.04512$ has four significant digits, and thus:

(6)
\begin{align} \quad \mid \mathrm{Error} (x_A) \mid = \mid x_T - x_A \mid = \mid x_T - 0.4512 \mid ≤ \frac{1}{2} \cdot 10^{-5} = 0.000005 \end{align}

Let $\epsilon = 0.000005$. Expanding the absolute value above and we have that $0.04512 - 0.000005 ≤ x_T ≤ 0.04512 + 0.000005$. Now we note that since $f(x) = \sin x$ then the derivative of $f$ is $f'(x) = \cos x$. On the interval $[x_A - \epsilon, x_A + \epsilon] = [0.045115, 0.045125]$ the function $f'(x) = \cos x$ is a positive function, so $\mid f'(x) \mid = \mid \cos x \mid = \cos x$ on this interval. Furthermore, $f'(x)$ is continuous and decreasing on this interval and so the maximum is achieved at the left endpoint, so:

(7)
\begin{align} \quad \max_{0.045115 ≤ x ≤ 0.045125} \mid f'(x) \mid = f'(0.045115) \approx 0.998982… \end{align}

Thus we have that:

(8)
\begin{align} \quad \mid f(x_T) - f(x_A) \mid ≤ \max_{0.045115 ≤ x ≤ 0.045125} \mid f'(x) \mid \mid x_T - x_A \mid = 0.998982 \cdot \frac{1}{2} \cdot 10^{-5} \approx 0.49949 \cdot 10^{-5} \end{align}

## Example 3

Find bounds on the error in $f(x_A)$ from $f(x_T)$ where $f(x) = e^x$ and $x_A = 0.032$ where $x_A$ is correctly round to the number of significant digits shown.

We note that $x_A = 0.032$ has two significant digits and thus:

(9)
\begin{align} \quad \mid \mathrm{Error} (x_A) \mid = \mid x_T - x_A \mid = \mid x_T - 0.032 \mid ≤ \frac{1}{2} \cdot 10^{-3} = 0.0005 \end{align}

Let $\epsilon = 0.0005$. Expanding the absolute value above and we have that $0.032 - 0.0005 ≤ x_T ≤ 0.032 + 0.0005$ and so $0.0315 ≤ x_T ≤ 0.0325$. We note that since $f(x) = e^x$ then the derivative of $f$ is $f'(x) = e^x$. On the interval $[x_A - \epsilon, x_A + \epsilon] = [0.0315, 0.0325]$, we note that $f'(x) = e^x$ is a positive function so $\mid f'(x) \mid = f'(x)$ on this interval. Furthermore, $f'(x)$ is continuous and increasing on this interval and so the maximum is achieved at the right endpoint so:

(10)
\begin{align} \quad \max_{0.0315 ≤ x ≤ 0.0325} \mid f'(x) \mid = f'(0.0325) = e^{0.0325} \approx 1.033033… \end{align}

Thus we have that:

(11)
\begin{align} \quad \mid f(x_T) - f(x_A) \mid ≤ \max_{0.0315 ≤ x ≤ 0.0325}\mid f'(x) \mid \mid x_T - x_A \mid = 1.033033... \cdot \frac{1}{2} \cdot 10^{-3} = 0.5165165 \cdot 10^{-3} \end{align}