Watching h shrink
Put the difference quotient in a loop, divide the step by ten each pass, and read down the column.
The last lesson used four values of h, chosen by hand. Choosing them by hand is the part worth automating. Start h at 1 and divide it by ten on every pass, and the answers arrange themselves into a column that can be read straight down.
The code below writes the step as and lets k count up. That is the same sequence 1, 0.1, 0.01 and so on, written in a way that makes the size of the step easy to say out loud.
Change range(8) to range(4) and read those four lines slowly first. Then put it back, and change a to 10.
| Step h | Quotient | Gap the algebra predicts, h |
|---|---|---|
| 1 | 7.000000000000 | 1 |
| 0.1 | 6.100000000000 | 0.1 |
| 0.01 | 6.010000000000 | 0.01 |
| 0.001 | 6.000999999999 | 0.001 |
| 0.0001 | 6.000100000012 | 0.0001 |
| 0.00001 | 6.000009999951 | 0.00001 |
The algebra from the last lesson said this quotient equals , which at is . So it predicts a gap from 6 of exactly , and that is the third column. For the first three rows the printed quotient really is 6 plus it. From the fourth row it is not: the loop prints 6.000999999999 where the algebra says 6.001, and 6.000009999951 where it says 6.00001. Hold on to that. It is the whole subject of the next lesson.
What the column is doing, and what it is not
The numbers are not reaching 6. No row is 6. Every row sits a little above it, and no row can ever be the row where h is zero, because that row would ask the program to divide by zero. Whatever is going on, arriving is not it.
What the column does is get as close to 6 as you care to demand, and then stay there. That last clause is the important half. It is not enough that some step landed near 6; the claim is that from a certain step onward, every smaller step is near 6 too.
Say it as a bargain. You name a distance, as small as you like. One thousandth, say. I must then produce a step size such that every step smaller than mine keeps the quotient within one thousandth of 6. Here I can: any h below 0.001 does it, because the gap is exactly h. Name one millionth instead and I answer with 0.000001. You have no distance I cannot answer.
The notation
That bargain is what the word limit means, and it has a symbol. Writing under a condition like says: this is the number the expression stays arbitrarily close to as h gets small.
The arrow is not an instruction to substitute. There is no point in this statement at which h takes the value 0, and the expression has no value there to take. The whole statement is about the neighbourhood of zero, with zero itself removed.
- Step
- 0.001
- Difference quotient
- 6.001
- What the algebra predicts,
- 6
- Gap between them
- 0.000999999999
The curve is the gap itself, computed at every starting point rather than only at yours, and the dot on it is your . Drag k from 0 to 8 and watch the curve settle onto the zero line: every step of k divides the gap by ten. Then keep dragging past 12. The curve breaks up into noise, and by k = 16 it has dived clean off the bottom of the frame. That reversal is not mathematics, and it is the next lesson.
Both sides of the point
So far h has been positive, which means measuring forward: from 3 seconds to slightly after 3 seconds. Nothing stops it being negative. The interval from 2.9 to 3 is just as good an interval, and the same formula handles it, because both the rise and the run change sign and the two changes cancel.
The algebra predicts this too. at with is 5.9, which is a little below 6 rather than a little above it. Both sides close in on the same number, from opposite directions.
Change f to return abs(x) and a to 0.0. The two directions now settle on different numbers, and the last lesson of this section is about what that means.
One more function, so that none of this looks like a peculiarity of squaring. Take at . The quotients run -0.1667, then -0.2381, then -0.2488, then -0.2499. They are closing in on , and the sign says something real: the function is falling as increases, so the slope of every secant is negative.
Change a to 1.0 and run it again, then to 4.0. Line the three answers up against and see whether that guess survives.
By hand, simplify until no is left in the denominator, and say what is left when goes to zero.
Put the top over a common denominator: . Dividing that by cancels the and leaves . As goes to zero this heads for , which is the number the loop was closing in on.