Now we’re going to take a more complicated expression and approximate it by a polynomial function. The function we’re going to look at is , but we could choose any function which is well behaved close to where we want to approximate it (there is a much more precise way to phrase this, but for the current discussion, this is enough).
This function looks like:
OK, so how are we going to go about approximating this function? Well, let’s ask about approximating it close to the point (this value is arbitrary and we could have asked for any value). What would be the most naive approximation we could make? Well, if we have a function which is a constant, and equal to the original function at then that’s a start. At least it matches the value of the function at that point, if nothing else. What is the value of this function at ? Well, it’s about 1.37. So is perhaps the most naive approximation we could make for our function close to . Let’s see how the two compare:
We will call this the zeroth approximation. Indeed it matches our original function perfectly at but apart from that it’s pretty rubbish. Maybe we can do better by approximating our function by a straight line that at least has the same gradient as our function? Well, clearly we want to it to pass through the point but now we also want it to have a slope. We are going to try and approximate it by the function:
for some . If we want this to have the same gradient as our original function then we must have that:
So in fact we must have:
How does this function compare with the original function? Let’s look at them together:
Ah, now maybe we’re getting somewhere! The purple line now has the same value and derivative as our original function at exactly . It’s looking a bit more like the function close to that point, at least very approximately.
How about if we want to get a bit more accurate. Let’s say that we want to include another power of ? We can try and approximate the function by a quadratic, but asking that the value, the first derivative and the second derivative all match with our original function at the value .
Well we will set up our approximating function as:
Matching the value, the first and second derivatives of this function with our original function we will find:
as before. Now let’s take two derivatives of our original function and match it to the second derivative of our approximating function at x=2.5:
so now . If we plug this into our quadratic expression and see how this compares with we see:
Now the polynomial is exactly the same value, derivative and second derivative as our original function. We could continue this with higher and higher polynomials. If we go up to 14th order ie. we get the following approximation, which matches the value, first, second, ….up to fourteenth derivative of our function. As you can see, close to it’s a really good approximation now!
Great, so we can see that we can take a pretty arbitrary looking function, and approximate it to good accuracy by a polynomial expression. We still haven’t written this in a general form, but in the next post we will do just that.
[…] MAM1000 lecture notes part 20, part iii – Taylor polynomials […]