CHAPTER 02.02: DIFFERENTIATION OF CONTINUOUS FUNCTIONS: Central Divided Difference

 

In this segment we’re going to talk about central divided difference scheme to find the derivative of a function.

 

Let’s go ahead and look at it graphically and what the central divided difference scheme means. So if we have, let’s draw a graph here, so this is x, this is the function f of x of which we want to find the derivative, so let’s suppose the function f of x looks like this, and what I want to do is I want to find the derivative of this function at this particular point x.  In the central divided difference scheme, what you’re going to do is you’re going to take a point which is delta x to the left of the point at which you want to find the derivative of the function, you’re going to take a point which is x plus delta x, so it is also delta x to the right of x now, so the distance between the two points from x is the same, so this will be delta x, and this distance also is delta x, so we take the value of the function there.  Now what we do is the secant which we are going to draw in order to be able to find the approximate value of the derivative of the function at this particular point, the first derivative, will be the line which is secant line, will be the one which is drawn from x minus . . . the value of the function at x minus delta x to the value of the function at x plus delta x.  So in this case what you are finding out is that the rise here will be the value of the function at delta x minus the value of the function at x minus delta x, however the run is going to be 2 times delta x now.  So that’s how the central divided difference scheme allows you to calculate the derivative of a function. So your f prime of x is approximately equal to the rise, which is f of x . . . which is the value of the function at x plus delta x minus the value of the function at x minus delta x, divided by 2 times delta x.  So that’s how you’re getting f prime of x there.

 

Now let’s go ahead and take an example and see that what kind of answers do we get for . . . what kind of approximations do we get for the second  . . . for the first derivative of the function for the example here.  So let’s take f of x equal to 2 e to the power of 1.5 x, we want to find out the derivative of the function at 3, we want to find out the derivative of the function at 3, so let me just erase this a little bit, 3.  And we’re going to choose delta x equal to 0.1.  So using the formula, we have f prime of x, which is central divided difference scheme, gives you f prime of x is f of x, the value of the function at x plus delta x minus the value of the function at x minus delta x divided by 2 times delta x. So that gives me, so I want to find out what the value of the function at . . . the derivative of the function at 3 is, so the approximate value of that will be f at 3 plus delta x minus the value of the function at 3 minus delta x divided by 2 times delta x.  So we are going to delta x to the right of . . . the value of the function . . . value of x at 3, and we’re going to the  left of 3 delta x value.  So since we have already chosen delta x is equal to 0.1, that means it is 3 plus 0.1 minus the value at 3 minus 0.1 divided by 2 times 0.1.  So basically in order to be able to calculate the value of the derivative of the function at 3, I will need to calculate the function at 3.1 and the value of the function at 2.9, and I will divide it by 0.2.  A mistake which students make is that they will choose this to be delta x, but you’ve got to understand that the run is 2 times delta x, that’s why it’s 2 times delta x here, in this case being 0.2. So let’s go ahead and substitute the values of x equal to 3.1 in the function, x equal to 2.9 in the function, and we’ll be able to get what the approximate value of the derivative of the function is. So f prime of 3 is approximately equal to the value of the function at 3.1 which is 2 e to the power 1.5 times 3.1 minus 2 e to the power 1.5 times 2.9, and I divide it by 0.2, and this value here turns out to be 271.06, okay.  So that’s the value I get for f prime of 3. Now the exact value which you can find for f prime of 3 is simply equal to 270.05, so you can do this as a homework exercise, and try to find out if you are able to find a differential . . . differential calculus knowledge to find out what f prime of 3 is, and it turns out to be 270.05.  So I want to look at the true error, the absolute relative true error  which is created because of this difference, will be the exact value which is 270.05 minus the approximate value divided by the exact value times 100, if I want to calculate it as a percentage, and this number I get to be is 0.375 percent.  So that’s the value of relative true error which you . . . absolute relative true error which you are getting for choosing delta x equal to 0.1.  Now what I’ve done is that I have taken different values of delta x and I am going to draw a table to show you what kind of values I get for different values of delta x for this f prime of 3. So we still have the function which we are looking at as an example is 2 e to the power 1.5 x, our delta x is going to change, and we want to find out what f prime of 3 is, and so let’s draw a table here.  So I’m going to show you the values of f prime of 3 for different values of delta x, and then I’m going to show you what the true error is.  For delta x is 0.1, then I’m going to halve that step size to 0.05, then halve the step size to 0.025.  F prime of 3 here turns out to be 271.07, this one turns out to be 270.30, let me make this 6 here, because that’s what we wrote previously, and then 270.11 here. The true error here is -1.014, the true error here is -0.2532, and the true error here is -0.06330.  So what you are finding out here is that your true error is getting quartered now as you are halving the step size.  So see, look for example, this is -1, a quarter of -1 is about 0.25, so it’s 0.25, a quarter of 0.25 is about  0.6-something . . . 0.06-something, and this is getting quartered there. 

 

So what you are finding out is that as you halve the step size, as you halve delta x, what is happening to the true error is that it is getting quartered.  Is this just a coincidence?  No it is not. So I’m going to ask you a couple of questions which you can do as homework.  One is why does true error get quartered, what I should say is approximately quartered, because it doesn’t get exactly quartered, why does the true error get approximately quartered when delta x is halved? Can you prove that?  And the second question is find f prime of 3 exactly, and that’s from your differential calculus class. And that’s the end of this segment.