The derivative of a function at a point **x=a**, often written
, can be interpreted in several different ways.

- Algebraically as the following limit
- Geometrically as the slope of the tangent line to the graph of
at
**x=a**. - Functionally as the instantaneous rate of change of
**f**at**x=a**.

You can use the definition and the Maple `limit` command to
compute derivatives directly, as shown below. Maple also knows the
derivatives of most functions. The main command for differentiating
functions is `D`, also shown in the examples below. The last
example shows how to use the `D` command to define a function
`df` that is the derivative of `f`.

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

> (f(1+h)-f(1))/h;

The following limit determines .

> limit ((f(1+h)-f(1))/h,h=0);

The following limit determines .

> limit((f(x+h)-f(x))/h,h=0);

The main command for differentiating functions is `D`, also shown
in the examples below. The last example shows how to use the `D`
command to define a function `df` that is the derivative of f.

> D(f);

> D(f)(1);

> df := D(f);

> df(x);

There is also a `diff` command for differentiating
expresssions. Some examples are given below.

> diff(cos(x),x);

> p := x^3+sin(x);

> diff(p,x);

> f(x);

> diff(f(x),x);

To learn more about how to use the `D` and `diff` commands,
see the help pages.

The secant line with base point **x=a** and increment **b-a** of a function
is the straight line passing through the two points
and . Given this information, it isn't too hard to write
down the equation for the secant line, given a function, base point,
and increment. However, to save you some trouble, the `secantline`
function has been written. This function is not a standard part of
Maple, but is one of about thirty Maple commands that have been
written at WPI for calculus. In the examples below, the first command
shows you how to load the `CalcP` package containing these
commands. You must do this before you
can use `secantline`. If the output from the `with(CalcP);`
command is different from what you see below, or the `secantline`
command doesn't seem to work, ask for help.

The `secantline` command takes three arguments. The first is a
function or expression, the next one is the base point, and the third
is the increment. Try the commands in the examples below to learn how
to use this command. If you want to learn more, consult the help page.

Also new in the examples is the Maple `
animate` command, which is part of the Maple `plots` package. You
must issue the `with(plots);` command before you can use animate.
The `animate` command pops up a separate window with controls like
those on a VCR. You should be able to figure out how they work by
experimenting. In the examples below, the animate command shows the
tangent line as the limit of secant lines.

> with(CalcP);

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

> secantline(f,x=0,1);

> secantline(f,x=0,0.5);

> plot({f(x),secantline(f,x=0,1),secantline(f,x=0,0.5)},x=0..1);

> with(plots):

> animate({f(x),secantline(f,x=1,1-t)},x=0.5..2.5,t=0..0.99);

> secantline(f,x=1,h);

> limit(secantline(f,x=1,h),h=0);

Wed Sep 13 09:46:20 EDT 1995