Return to my Mathematics
Go to my home page
© Copyright 1999, Jim Loy
Derivatives are very important in sciences. dy/dx (the derivative of y with respect to x) is merely the slope of a curve at the point (x,y). The definition involves limits, and some symbols which I do not have access to in HTML.
Bear with me as I define it in words. dy/dx is the limit as delta x approaches zero of delta y over delta x. Delta x is a change in x. And the limit means that we want delta x to get smaller and smaller. As delta x gets smaller and smaller, delta y over delta x gets closer and closer to the slope (dy/dx) of the curve. Why would we want to know the slope of a curve. Well, if we graph the position of a moving object, over time, then the slope is its velocity. If we graph its velocity, the slope is its acceleration. This is very important in Physics.
It makes sense to use a computer to find derivatives. A computer can do a process like this over and over, using smaller and smaller delta x's, supposedly getting more and more accurate. I'm going to try that. My function is y=x². I will try to find the derivative at (10/9,100/81) or (1.111111...,1.234567901234...). y=x² is a well known function, and the derivative (slope) at this point is known to be 2.222222... (twice x). Let's see how close we get with my computer:
1.1111111111111110 1.2345679012345680 delta x delta y delta y/delta x 1 0.1000000000000000 0.2322222222222220 2.3222222222222200 2 0.0100000000000000 0.0223222222222217 2.2322222222221700 3 0.0009999999999999 0.0022232222222214 2.2232222222216200 4 0.0001000000000000 0.0002222322222216 2.2223222222164300 5 0.0000100000000001 0.0000222223222219 2.2222322221786400 6 0.0000009999999999 0.0000022222232214 2.2222232216203200 7 0.0000001000000001 0.0000002222222317 2.2222223159743900 8 0.0000000099999999 0.0000000222222216 2.2222221753461400 9 0.0000000010000001 0.0000000022222220 2.2222217781330500 10 0.0000000001000000 0.0000000002222218 2.2222177813304900 11 0.0000000000100000 0.0000000000222218 2.2221778133049100 12 0.0000000000010001 0.0000000000022218 2.2215808170515100 13 0.0000000000000999 0.0000000000002216 2.2177777777777800 14 0.0000000000000000 0.0000000000000000******************** 15 0.0000000000000000 0.0000000000000000********************
On the first line, I printed y and x, to give some idea if any digits are already inaccurate. Below that we see smaller and smaller delta x's. The eighth one produced the most accurate estimate of the slope (should have been 2.222222...). We got 8 digits of accuracy, when the computer was giving us 17 digits of accuracy in general. Then the estimates got progressively worse, until the program blew up in the 14th estimate, where we lost all accuracy in delta x and delta y, giving us division by zero. Here (1/10) to the 14th power comes out zero. I didn't have to use powers of ten, but our estimate was getting worse and worse anyway.
This should look a little scary, if you thought you might use a computer for derivatives. The problem, of course, is that we divide a tiny number by a tiny number. Both tiny numbers lose accuracy as they get tinier. So we have lost accuracy before we ever divide.
I used the classic definition of a derivative in my program, choosing intervals to the right of x (which was 1.111111...). The central difference method makes x sit right in the middle of each interval. This method gives much greater accuracy, before it blows up. So, you still have to stop before you start losing accuracy.
Another way to get more accuracy is to use multiple precision. 17 digits of accuracy sounded pretty good, until I saw the results. Some computer languages allow you to choose higher precision. You can also go to some trouble to create your own multiple precision, maybe hundreds of digits of accuracy. This may be very difficult, or impossible, for most functions.
The question here is, "When do you stop?" How do you know that you are losing too much accuracy? We knew about how much accuracy we were losing, because we knew the answer beforehand. Normally, you don't know the answer beforehand. I don't know the answer to our question, "When do you stop?"
Return to my Mathematics
Go to my home page