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 );
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);
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);
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(%);
___________________________________________________________________________________
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)]));
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)]));
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)]));
___________________________________________________________________________________
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;
> diff( f(x), x); eval(%, x=3);
> (D)(f)(3);
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;
> f :=x -> 2+ sin(x^2)/(x-1);
> T := x -> f(a) + D(f)(a) *(x-a);
> plot( {f(x), T(x)}, x=-2..5, y=-10..10, discont = true);
___________________________________________________________________________________
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;
> diff( f(x), x); diff( f(x), x $ 2); diff( f(x), x $ 3 );
> D(f)(x); (D@@2)(f)(x); (D@@3)(f)(x);
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);
> transpose(array( [ seq( [k,(D@@k)(f)(x) ], k=0..4)]));
Here is another table showing the square root of x and its first four derivatives.
> f := x -> sqrt(x);
> transpose(array ( [seq( [ k,(D@@k)(f)(x) ], k =0..4)]));
___________________________________________________________________________________
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);
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.
>