Suppose that f(x) is a differentiable function and that a is some fixed number in the domain of f. We define the linear approximation to f(x) at x=a, by the equation
In this equation, the parameter a is called the base point, and x is the independent variable. It might help you understand the definition better if you keep in mind that a stands for a fixed number.
For example if , then would be the straight line that is tangent to the graph of at x=1. We can use the definition to find this tangent line by evaluating f(1) = 1 and f'(1) = 2 and then plugging these numbers into the definition to obtain
The straight line has the two properties that and . That is, intersects the graph of f(x) at x=a and has the same slope as f(x) at x=a. To see this, first set x=a in the definition, giving
Then differentiate the definition with respect to x to get the slope of the line, which is
Unfortunately, Maple does not provide the linear approximation directly, so a procedure called tangentline has been written as part of the CalcP package. Its syntax is similar to that of the secantline command introduced in the previous lab. The Maple commands below show how to load the CalcP package into your Maple session and provide several examples of how to use the tangentline function.
> f := x -> x^5+4*x^2+1;
The tangentline procedure produces an expression, which can be manipulated using standard Maple commands. In the next example, we show how to use the Maple unapply command to turn the result of tangentline into a function.
> f_T := unapply(tangentline(f,x=-1),x);
As shown in the next example, the animate command from the plots package can be used to see how the tangent line changes as the base point is changed.
The next two examples show how to apply tangentline to arbitrary functions g(x) and h(x). Note that Maple uses the notation D(g) to stand for the derivative of g, and the notation D(g)(a) to stand for the derivative of g evaluated at x=a.
> tangentline(g(x),x=a) + tangentline(h(x),x=a);
The last Maple command in the previous example shows that if p(x) is the sum of two functions, p(x)=h(x)+g(x), then , which means that is tangent to h(x)+g(x) at x=a. To check that this is true, you need to show that the values and h(x)+g(x) are equal at x=a and that the derivatives of and h(x)+g(x) are equal at x=a. Maple commands that do this are shown below.
> t1 := tangentline(g(x),x=a) + tangentline(h(x),x=a);