Here’s a tricky one:
Sorry for the extension and the mathematical terminology; I tried to shorten the post as much as possible and to make my point clear. Used WinRar to compress and then zipped, because a ZIP compression would exceed the 100K limit and RAR is not among the allowed formats for upload.
I was playing with geometric progressions in Excel. Just in case, a geometric progression a(t) is a sequence such that a(t) = a(t-1)r, where r is the so-called common ratio (a constant), and a(1) needs to be defined as an initial condition.
The problem I found is that since Excel works with 15 significant digits, errors occur for large t: from a certain t=T on, Excel runs out of numbers to make calculations and starts rounding and cutting figures.
In my first go at it, I filled a column with values for t, and to its right I made a column for a(t), where the cells were formulated as mentioned above: a(t) = a(t-1)r. I verified there was an error indeed, which grew bigger as t grew larger.
So I thought what would happen if I used a theoretically equivalent formula for a(t): a(t) = a(1)r^(t-1). Knowing very, very little about how Excel works, I had two hypotheses for how it handles r^(t-1):
1) Excel successively multiplies r r r r…r (t-1) times. There exists a certain t=T that causes a rounded a(T); so the following term, a(T+1), will contain the error of the previous term plus an error caused by another rounding. This approach is somehow implied in my first formulation a(t) = a(t-1)r, because Excel is forced to multiply one by one each number.
2) Maybe Excel could calculate by some method r^(t-1) in a more accurate way; once it has the result, it makes the number “fit” in the 15-digit scheme. I didn’t think this made much sense, but I decided to give it a try anyway. This would imply using the second formulation: a(t) = a(1)r^(t-1).
What I found was that Excel really does make calculations in a different way, or at least the results differ significantly for t large enough. So I decided to fill one column, A, with values for t; make a second column, B, with formulation 1: a(t)_1; a third column, C, with formulation 2: a(t)_2, and a fourth column, D, with the difference of the two: z(t) = a(t)_1 – a(t)_2. I made Excel show enough decimal places, and started checking where the first non-zero difference occurred. See the attached book.
For the values of Common Ratio = 1.015 and Scale Factor a(1) = 10, the first difference occurs at t=29. I coloured the row red for easier identification. So, D33 = 0,000000000000015987211554602300. If we go forward to the last value of t I filled in column A, t=2210, we see that the difference has increased a lot: D2214 = 181,25000000000000000000. Again, this difference is supposedly attributable simply to the use of a different (but equivalent) formulation. But there’s more.
Go back to D33. Yes, the difference is small. But do check the numbers Excel displays in B33 and in D33. THEY ARE EQUAL!!!.
So I’m now completely clueless on two points: 1) how does Excel make calculations?; and 2) how can it be that to Excel two numbers are equal but their difference is NOT zero? Is this related to the binary base in which Excel stores numbers?
Finally, another detail: if you set the value of a(1) to 1, the difference in D33 IS zero; but it isn’t zero in D38, when it should be (since B38=C38). For different combinations of a(1) and r you get similar crazy results.
Any clues?