next up previous
Next: Exercises Up: The linear approximation Previous: Purpose


Suppose that is a differentiable function and that a is some fixed number in the domain of f. We define the linear approximation to 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 and 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 at x=a and has the same slope as 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.

  > with(CalcP);

  > f := x -> x^5+4*x^2+1;

  > tangentline(f,x=-1);

  > plot({f(x),tangentline(f,x=-1)},x=-2..2);

  > plot({f(x),tangentline(f,x=-1),tangentline(f,x=1)},x=-2..2);

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);

  > f_T(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.

  > with(plots):

  > animate({x^2,tangentline(x^2,x=t)},x=-2..2,t=-1..1);

The next two examples show how to apply tangentline to arbitrary functions and . 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(g(x)+h(x),x=a);

  > tangentline(g(x),x=a) + tangentline(h(x),x=a);

The last Maple command in the previous example shows that if is the sum of two functions, , then , which means that is tangent to at x=a. To check that this is true, you need to show that the values and are equal at x=a and that the derivatives of and are equal at x=a. Maple commands that do this are shown below.

  > t1 := tangentline(g(x),x=a) + tangentline(h(x),x=a);

  > subs(x=a,t1);

  > subs(x=a,diff(t1,x));

next up previous
Next: Exercises Up: The linear approximation Previous: Purpose

Sean O Anderson
Wed Sep 20 11:01:11 EDT 1995