Chapter 5 - Slope

5.3 Exact Slope

Maple knows how to perform many Calculus operations. In particular, it can calculate the slope, the derivative df/dx, of a function f(x). The "diff" command (see ?diff ) returns an analytic expression containing the derivative of an expression; the syntax is

diff( expression, var );

The result can be made into a function by using the "unapply" command to map the expression into a function. The resulting map is then assigned to a name. The syntax to compute the derivative of f(x), and label the resulting function df_dx, is

df_dx := unapply( diff( f(x), x ) , x );

For instance, the following illustrates this syntax using polynomial functions. The reader may want to check these analytical results.

It is necessary to specify the variable with respect to which the derivative is needed. The expression may contain other variables (in which case diff() returns the partial derivative) or algebraic constants in which case Maple would not know with respect to which variable the derivative is needed.

Maple knows how to handle derivative (if analytically possible) for arbitrary functions. For instance, the following illustrates that Maple also knows how to calculate derivatives of functions involving trigonometric functions.

Maple can find the derivative of fairly complicated functions.

It is always a good idea to attempt simplification if an expression is complicated. The analytical slope-function above can be simplified somewhat.

Note: Starting from a Maple function f(x), the "D()" differential operator returns the derivative of f(x) as a Maple function in one statement. So,

df_dx := D(f);

or

df_dx := D[1](f)

are totally equivalent to

df_dx := unapply( diff(f(x),x), x );

The "D()" command is more abstract (see ?D ) than the combination "unapply( diff( , ), )" and will not be used in these notes.


 
Section 5.2 Chapter 5 Section 5.4       TOC

Any questions or suggestions should be directed to
Michel Vallières at vallieres@physics.drexel.edu