Summing series - Error propagation

86 Views Asked by At

Why sum down and sum up given different results? I know that this has a relation with error propagation, but I can't figure why. ( You can use whatever programming language you want, if you choose a N big enough sumDown and sumUp will differ )

I mean, for what I know, in a sum, the absolute error of the result is just a sum of the absolute error of both operands, so It shouldn't matter the order that I do the sums, they would end up with the same error, but evidently this is not what occurs...

$$ sumDown = \sum_{n=1}^{N} 1/n $$

$$ sumUp = \sum_{n=N}^{n=1} 1/n $$

( This is from a question of a book, COMPUTATIONAL PHYSICS by Morten Hjorth-Jensen )

1

There are 1 best solutions below

0
On BEST ANSWER

Remember that the computer will calculate the sums by adding the first two values, then adding the third value to the result of that, then adding the fourth value to the result of that, and so on, meaning that both sums will be calculated through $n - 1$ individual additions.

In the sumDown calculation, since the first term is $1$, it means that the result of every sum will be a value $\geq 1$, and so if the relative error on any individual number is $r$ the absolute error on each calculation will be at least $r$, hence after $N$ calculations you will be accumulating something on the order of $rN$ in error. (This is very hand-wavey, by the way.)

At some point, if the machine precision is $2^{-k}$, the terms will be smaller than that value and will essentially disappear from the total.

In the sumUp calculation, you start with the smallest term $\frac{1}{N}$ and add the next-smallest term $\frac{1}{N - 1}$. These are both small numbers, so the absolute error on their sum will also be small - if they're close to $2^{-m}$, then the combined error will be about $2^{-m-k+1}$. Then the next term is a little bigger, and the next one is a bit bigger than that, but you can bound the absolute error much more tightly than you could for sumUp because the values don't get big for a while.