Condition Number Example - (Book) Integral

Thomas J. Kennedy

Contents:

1 Overview

This problem will be a bit more interesting than the previous examples. Suppose that we want compute the conditioning of…

$$ I_n = \int\limits_{t=0}^{1} \frac{t^n}{t+5} dt \text{ for } n \geq 1 $$

2 Question…

On what are we conditioning?

3 The Integral

Let us work through the integral first. We will find that $I_0$ will be on what we condition.

$$ \begin{eqnarray} I_n &=& \int\limits_{t=0}^{1} \frac{t^n}{t+5} dt \\ &=& \int\limits_{t=0}^{1} t^{n - 1} \frac{t}{t+5} dt \\ &=& \int\limits_{t=0}^{1} t^{n - 1} \left(\frac{t}{t+5}\right) dt \\ &=& \int\limits_{t=0}^{1} t^{n - 1} \left(\frac{t + 5 - 5}{t+5}\right) dt \\ &=& \int\limits_{t=0}^{1} t^{n - 1} \left(\frac{t + 5}{t+5} - \frac{5}{t+5}\right) dt \\ &=& \int\limits_{t=0}^{1} t^{n - 1} \left(1 - \frac{5}{t+5}\right) dt \\ &=& \int\limits_{t=0}^{1} t^{n - 1} - \frac{5 t^{n - 1}}{t+5} dt \\ &=& \int\limits_{t=0}^{1} t^{n - 1}dt - \int\limits_{t=0}^{1} \frac{5 t^{n - 1}}{t+5} dt \\ &=& \int\limits_{t=0}^{1} t^{n - 1}dt - 5 \int\limits_{t=0}^{1} \frac{t^{n - 1}}{t+5} dt \\ \end{eqnarray} $$

 

The second integral should look familiar… it is $I_{n-1}$. We have a recursiviely defined integral! If we rewrite our integral…

$$ \begin{eqnarray} I_n &=& \int\limits_{t=0}^{1} t^{n - 1}dt - 5 \int\limits_{t=0}^{1} \frac{t^{n - 1}}{t+5} dt \\ &=& \left(\int\limits_{0}^{1} t^{n - 1}dt\right) - 5 I_{n-1} \\ &=& \left(\frac{1}{n} t^n \Big|_{t=0}^{1}\right) - 5 I_{n-1} \\ &=& \frac{1}{n} - 5 I_{n-1} \\ I_n &=& - 5 I_{n-1} + \frac{1}{n} \\ \end{eqnarray} $$

Take note of the final step. Swapping the ordering of terms, while not necessary, does help keep us organized (since $\frac{1}{n}$ is a constant and $I_{n-1}$ is an integral).

4 The Recursion

If you recall recursive functions from your programming coursework… you know that we need a base case.

$$ \begin{eqnarray} I_0 &=& \int\limits_{t=0}^{1} \frac{t^0}{t+5} dt \\ &=& \int\limits_{t=0}^{1} \frac{1}{t+5} dt \\ &=& \ln(t + 5)\Big|_{t=0}^{1} \\ &=& \ln(6) - \ln(5) \\ &=& \ln\left(\frac{6}{5}\right)\\ \end{eqnarray} $$

Everything comes down to computing:

  1. $\frac{6}{5}$

  2. $\ln\left(\frac{6}{5}\right)$

And… we know that machine precision is not on our side (especially for the logarithm).

Now… it is time to set up the recursive cancellation…

$$ \begin{eqnarray} I_{n} &=& - 5 I_{n-1} &+& \frac{1}{n} \\ I_{n-1} &=& - 5 I_{n-2} &+& \frac{1}{n-1} \\ I_{n-2} &=& - 5 I_{n-3} &+& \frac{1}{n-2} \\ I_{n-3} &=& - 5 I_{n-4} &+& \frac{1}{n-3} \\ &\vdots& \\ I_3 &=& - 5 I_{2} &+& \frac{1}{3} \\ I_2 &=& - 5 I_{1} &+& \frac{1}{2} \\ I_1 &=& - 5 I_{0} &+& \frac{1}{1} \\ I_0 &=& \ln\left(\frac{6}{5}\right)\\ \end{eqnarray} $$

The trick is to set up the right side so that everything can be added up… with some nice cancellations. Take note of the $-5$. A quick series of multiplications leads to…

$$ \begin{eqnarray} I_{n} &=& (-5)^{1} I_{n-1} &+& \frac{1}{n} \\ (-5)^{1} I_{n-1} &=& (-5)^{2} I_{n-2} &+& \frac{1}{n-1} \\ (-5)^{2} I_{n-2} &=& (-5)^{3} I_{n-3} &+& \frac{1}{n-2} \\ (-5)^{3} I_{n-3} &=& (-5)^{4} I_{n-4} &+& \frac{1}{n-3} \\ &\vdots& \\ (-5)^{n-3} I_3 &=& (-5)^{n-2} I_{2} &+& \frac{1}{3} \\ (-5)^{n-2} I_2 &=& (-5)^{n-1} I_{1} &+& \frac{1}{2} \\ (-5)^{n-1} I_1 &=& (-5)^{n} I_{0} &+& \frac{1}{1} \\ (-5)^{n} I_0 &=& (-5)^{n} \ln\left(\frac{6}{5}\right) \\ \end{eqnarray} $$

Let us make a quick change… by dropping the $I_0$ term. We are going to treat it as a variable.

$$ \begin{eqnarray} I_{n} &=& (-5)^{1} I_{n-1} &+& \frac{1}{n} \\ (-5)^{1} I_{n-1} &=& (-5)^{2} I_{n-2} &+& \frac{1}{n-1} \\ (-5)^{2} I_{n-2} &=& (-5)^{3} I_{n-3} &+& \frac{1}{n-2} \\ (-5)^{3} I_{n-3} &=& (-5)^{4} I_{n-4} &+& \frac{1}{n-3} \\ &\vdots& \\ (-5)^{n-3} I_3 &=& (-5)^{n-2} I_{2} &+& \frac{1}{3} \\ (-5)^{n-2} I_2 &=& (-5)^{n-1} I_{1} &+& \frac{1}{2} \\ (-5)^{n-1} I_1 &=& (-5)^{n} I_{0} &+& \frac{1}{1} \\ \end{eqnarray} $$

Now… if we add things up…

$$ \begin{eqnarray} I_{n} &=& (-5)^{n} I_{0} + \left(\frac{1}{n} + \frac{1}{n-1} + \frac{1}{n-2} + \dots + \frac{1}{2} + 1\right) \\ &=& (-5)^{n} I_{0} + \rho_n \\ \end{eqnarray} $$

Take not of the substitution. Everything after the $I_0$ is a constant. Let us refer to the collected terms as $\rho_n$.

5 Conditioning & Notation

We normally look at the condition number as…

$$ (\text{cond }f)(x) = \left| \frac{xf^{\prime}(x)}{f(x)} \right| $$

where

However, our notation differs for this problem. We have a function ($f_n$) that takes an integral ($I_0$) as input and generates an output integral ($I_n$)…

The result is a more intimidating (yet benevolent) condition number.

$$ (\text{cond }f)(x) = \left| \frac{I_0 f_{n}^{\prime}(I_0)}{f_n(I_0)} \right| $$

At the end of the day $f_n$ is just $I_n$… $$ f_n(I_0) = I_n = (-5)^{n} I_{0} + \rho_n $$

The derivative is therefore…

$$ \begin{eqnarray} f_n^{\prime}(I_0) &=& \frac{d}{dI_0}(-5)^{n} I_{0} + \frac{d}{dI_0}\rho_n \\ &=& (-5)^n \frac{d}{dI_0} I_{0} + 0 \\ &=& (-5)^n \\ \end{eqnarray} $$

Using this result and $f_n = I_n$…

$$ \begin{eqnarray} (\text{cond }f)(x) &=& \left| \frac{I_0 (-5)^n}{I_n} \right| \\ &=& \left| \frac{I_0 (5)^n (-1)^n}{I_n} \right| \\ &=& \left| \frac{I_0 (5)^n}{I_n} \right| \\ &=& (5^n) \left| \frac{I_0}{I_n} \right| \\ \end{eqnarray} $$

We know that $ t \in (0, 1)$ which means that

$$ t^n < t^{n-1} < t^{n-2} < \dots < t^3 < t^2 < t $$

Since $t^n$ is monotonically decreasing… we know that…

$$ I_n < I_{n-1} < \dots < I_0 $$

Let us find a lower bound for the condition number. On our absolute best day… is the problem well conditioned?

$$ \begin{eqnarray} (\text{cond }f)(x) &=& (5^n) \left| \frac{I_0}{I_n} \right| \\ &>& (5^n) \left| \frac{I_0}{I_0} \right| \\ &>& (5^n) \\ \end{eqnarray} $$

Since $n \geq 1$…

$$ \begin{eqnarray} (\text{cond }f)(x) &>& 5 \therefore \text{ill conditioned}\\ \end{eqnarray} $$

This approach is not well conditioned. Refer to the Chapter 1 supplemental reading for the well-conditioned approach.