We want to compute the relative condition number of:
$$x_1+x_2+x_3+\cdots$$
We assume all values are positive, and we will do a limit of a large $x_1=10^{8}$, and smaller values for all the other numbers $x_2=x_3=\cdots=10^{-3}$, as a worse-case scenario:
1 term
For
$$f(x_1) = x_1$$
the relative condition number is:
$$\kappa={\|J\|\|x\|\over \|f(x)\|}={1\cdot x \over x} = 1$$
2 terms
For
$$f(x_1, x_2) = x_1+x_2$$
we get in the infinity norm:
$$\kappa={\|J\|_\infty \|x\|_\infty\over \|f(x)\|}={2\cdot \max(x_1, x_2) \over x_1 + x_2} \rightarrow 2$$
Which for $x_1=10^{8}$ and $x_2=10^{-3}$ approaches 2.
The exact value is:
In [1]: x1 = 1e8; x2 = 1e-3; 2*max(x1, x2)/(x1+x2)
Out[1]: 1.99999999998
3 terms
For
$$f(x_1, x_2, x_3) = x_1+x_2+x_3$$
we get in the infinity norm:
$$\kappa={\|J\|_\infty \|x\|_\infty\over \|f(x)\|}={3\cdot \max(x_1, x_2, x_3) \over x_1 + x_2 + x_3} \rightarrow 3$$
Which for $x_1=10^{8}$ and $x_2=x_3=10^{-3}$ approaches 3. The exact value is:
In [2]: x1 = 1e8; x2 = 1e-3; x3 = 1e-3; 3*max(x1, x2, x3)/(x1+x2+x3)
Out[2]: 2.99999999994
n terms
The relative condition number for summing n-terms of the type:
$$10^8 + 10^{-3} + 10^{-3} + \cdots$$
is
$$\kappa=n$$
Is that correct? So for large $n$, the sum of such values becomes ill-conditioned?
And the only way it becomes well-conditioned is if the magnitude of the numbers is similar, since then the condition number seems to stay low even for large $n$, e.g.:
In [3]: x1 = 1e-3; x2 = 2e-3; x3 = 3e-3; x4 = 4e-3; 4*max(x1, x2, x3, x4)/(x1+x2+x3+x4)
Out[3]: 1.6