Module 8 : Differential Calculus

803 : Fun With Derivatives

O B J E C T I V E

In the project, we will learn various ways to take the derivative of functions, how to create derivative tables to see trends, how to take higher order derivatives, how to construct tangent lines, and how to graph a function together with its derivatives.

S E T U P

In this project we will use the following command packages. Type and execute this line before beginning the project below. If you re-enter the worksheet for this project, be sure to re-execute this statement before jumping to any point iin the worksheet.

> restart; with(linalg):

Warning, the protected names norm and trace have been redefined and unprotected

___________________________________________________________________________________

A. The Derivative

___________________________________________________________________________________

In the last project, we learned how to find derivatives the "long way". We will now take them directly in a single command. there are two different ways to compute derivatives using Maple - using the diff and the D commands.

> f := x -> sqrt( 1 + x^2 );

f := proc (x) options operator, arrow; sqrt(1+x^2) ...

The diff command requires two parameters - the function and the variable with to respect to which the derivative is being taken.

> diff( f(x), x);

x/(sqrt(1+x^2))

Although you may not be as familiar with the differential operator, D , which acts on functions by taking their derivative, it is a very convenient way to compute the derivative.

> D(f)(x);

x/(sqrt(1+x^2))

Here is another way to compute derivatives. Using the diff command, Maple will create an expression showing a derivative but not actually compute it. the value command forces an answer.

> f := x -> x^100:

> Diff( f(x), x); % = value(%);

Diff(x^100,x)

Diff(x^100,x) = 100*x^99

___________________________________________________________________________________

B. Derivative Tables

___________________________________________________________________________________

Instead of taking the derivative of a single function, we can create a command which will create a tabular array of derivatives of similar functions. This makes it easy to see patterns and trends.

Here are powers of x and their derivatives.

> transpose(array( [seq( [ x^k, diff(x^k,x) ],k = 1..11)]));

matrix([[x, x^2, x^3, x^4, x^5, x^6, x^7, x^8, x^9,...

Here is a table showing the derivatives of both positive and negative powers of x. Do you see a pattern?

> traspose(array( [ seq( [ x^k, diff(x^k,x) ], k= -5..5)]));

traspose(matrix([[1/(x^5), -5*1/(x^6)], [1/(x^4), -...

Here is table of derivatives of sin(x), sin(2x), sin(3x), sin(4x), and sin(5x). Do you see a pattern?

> transpose(array( [seq( [sin(k*x), diff( sin(k*x),x) ], k =1..5)]));

matrix([[sin(x), sin(2*x), sin(3*x), sin(4*x), sin(...

___________________________________________________________________________________

C. Evaluating A Derivative

___________________________________________________________________________________

Since the derivative of a function is a function itself, it can be evaluated at various values of x. In order words, we can plug in a value like x = a into f'(x) to find the value f'(a). what we are doing geometrically is finding the slope of the tangent line at (a,f(a)). There are two ways to do this in Maple.

The diff command requires one statement to compute the derivative and a second statement to evaluate it. On the other hand, using the D command you can do this in one quick step.

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

f := proc (x) options operator, arrow; x^4+x^3-5*x^...

> diff( f(x), x); eval(%, x=3);

4*x^3+3*x^2-10*x

105

> (D)(f)(3);

105

As you can see, the D command is more convenient in this case.

___________________________________________________________________________________

D. Tangent Lines

___________________________________________________________________________________

Evaluating the derivative at x=a gives the slope of the tangent line at (a,f(a)). To find the equation of this tangent line requires a little more information. If we begin with the point-slope formula: y-y1 = m(x -x1 ) where x1 a, y1 = f(a), and m = f'(a), and then solve for y, we get y = f(a) + f'(a)*(x-a) as the linear function which represents the equation of the tangent line.

Here we define a target value, a, a function, f(x), the tangent line as a function, T(x), and then graph them together.

> a :=2;

a := 2

> f :=x -> 2+ sin(x^2)/(x-1);

f := proc (x) options operator, arrow; 2+sin(x^2)/(...

> T := x -> f(a) + D(f)(a) *(x-a);

T := proc (x) options operator, arrow; f(a)+D(f)(a)...

> plot( {f(x), T(x)}, x=-2..5, y=-10..10, discont = true);

[Maple Plot]

___________________________________________________________________________________

E. Higher Order Derivatives

___________________________________________________________________________________

There are occasions when we wish to find the 2nd derivative of a function or even higher order derivatives such as the 3rd or 4th derivative. There is a way to do this either the diff or D commands.

> f := x -> x^3 + x^2 + x +7;

f := proc (x) options operator, arrow; x^3+x^2+x+7 ...

> diff( f(x), x); diff( f(x), x $ 2); diff( f(x), x $ 3 );

3*x^2+2*x+1

6*x+2

6

> D(f)(x); (D@@2)(f)(x); (D@@3)(f)(x);

3*x^2+2*x+1

6*x+2

6

We can also create tables which show the various derivatives of a function. In this case, we let f(x) = sin(7x), and then create a table showing f(x) and its first four derivatives.

> f := x -> sin(7*x);

f := proc (x) options operator, arrow; sin(7*x) end...

> transpose(array( [ seq( [k,(D@@k)(f)(x) ], k=0..4)]));

matrix([[0, 1, 2, 3, 4], [sin(7*x), 7*cos(7*x), -49...

Here is another table showing the square root of x and its first four derivatives.

> f := x -> sqrt(x);

f := sqrt

> transpose(array ( [seq( [ k,(D@@k)(f)(x) ], k =0..4)]));

matrix([[0, 1, 2, 3, 4], [sqrt(x), 1/2*1/(sqrt(x)),...

___________________________________________________________________________________

F. Graphing A Function & Its Derivatives

___________________________________________________________________________________

The derivative of a function is a funcion itself. The same is true for the 2nd derivative and higher order derivatives also. These functions (f(x), f'(x), f''(x),etc) can be graphed together on the same set of axes with interesting results.

> f := x -> sqrt( 1 + x^2); plot( { (D@@k)(f)(x) $ k = 0..2}, x=-2..2);

f := proc (x) options operator, arrow; sqrt(1+x^2) ...

[Maple Plot]

It takes some careful inspection of the graph to determine which graph is which. Here are some clues:

Wherever f(x) is smooth and has a local maximum or minimum, f'(x) will have an x-intercept.

Wherever f(x) is increasing, f'(x) will be above the x-axis.

Wherever f(x) is decreasing, f'(x) will be below the x-axis.

Wherever f(x) is concave up, f'(x) will be increasing, and f''(x) will be above the x-axis.

Wherever f(x) is concave down, f'(x) will be decreasing, and f''(x) will be below the x-axis.

>