next up previous
Next: About this document ... Up: Labs and Projects for Previous: Labs and Projects for

Subsections


Definition of the derivative

Purpose

The purpose of this lab is to use Maple to explore the geometric and algebraic aspects of the derivative.

Background

The derivative of a function f(x) at a point x=a, often written f'(a), can be interpreted in several different ways. Probably the second and third interpretations are the most important; they are certainly closer to what makes the derivative useful. In this lab, we will use Maple to explore each of these different aspects of the derivative.

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;

\begin{maplelatex}
\begin{displaymath}
{f} := {x} \rightarrow {x}^{2} + 3\,{x} + 5\end{displaymath}\end{maplelatex}
This command computes the difference quotient at x-1.
  > (f(1+h)-f(1))/h;

\begin{maplelatex}
\begin{displaymath}
{\displaystyle \frac {(\,1 + {h}\,)^{2} - 1 + 3\,{h}}{{h}}}\end{displaymath}\end{maplelatex}
The limit of the difference quotient as $h \rightarrow 0$ is the derivative of f at x=1.
  > limit ((f(1+h)-f(1))/h,h=0);

\begin{maplelatex}
\begin{displaymath}
5\end{displaymath}\end{maplelatex}
This command computes the derivative of f for any value of x.
  > limit((f(x+h)-f(x))/h,h=0);

\begin{maplelatex}
\begin{displaymath}
2\,{x} + 3\end{displaymath}\end{maplelatex}
This command produces the derivative of f as a Maple function.
  > D(f);

\begin{maplelatex}
\begin{displaymath}
{x} \rightarrow 2\,{x} + 3\end{displaymath}\end{maplelatex}
This evaluates the derivative at x=1.
  > D(f)(1);

\begin{maplelatex}
\begin{displaymath}
5\end{displaymath}\end{maplelatex}
This command shows how you can label the derivative for later use. It produces a Maple function for the derivative.
  > df := D(f);

\begin{maplelatex}
\begin{displaymath}
{\it df} := {x} \rightarrow 2\,{x} + 3\end{displaymath}\end{maplelatex}

  > df(x);

\begin{maplelatex}
\begin{displaymath}
2\,{x} + 3\end{displaymath}\end{maplelatex}

There is also a diff command for differentiating expresssions. You will learn more about the D and diff commands in the next lab.

The secant line with base point x=a and increment b of a function f(x) is the straight line passing through the two points (a,f(a)) and (a+b,f(a+b)). 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);

\begin{maplelatex}
\begin{eqnarray*}
\lefteqn{[{\it ArcInt}, {\it Curvature}, {\...
 ...\it tanvect}, {\it unitvect}]\mbox{\hspace{14pt}}\end{eqnarray*}\end{maplelatex}

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

\begin{maplelatex}
\begin{displaymath}
{f} := {x} \rightarrow {x}^{3} + 2\,{x} + 1\end{displaymath}\end{maplelatex}

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

\begin{maplelatex}
\begin{displaymath}
3\,{x} + 1\end{displaymath}\end{maplelatex}

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

\begin{maplelatex}
\begin{displaymath}
2.250000000\,{x} + 1\end{displaymath}\end{maplelatex}

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

\begin{maplelatex}
\begin{displaymath}
{\displaystyle \frac { \left( \! \,(\,1 +...
 ...2\,{h}
\, \! \right) \,(\,{x} - 1\,)}{{h}}} + 4\end{displaymath}\end{maplelatex}

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

\begin{maplelatex}
\begin{displaymath}
5\,{x} - 1\end{displaymath}\end{maplelatex}

Exercises

1.
Find the derivatives of the following functions using Maple, both from the definition and using the D command.
(a)
$f(x) = x\sin(x^2)$
(b)
$f(x) = \sqrt{x^2+1}$
(c)
f(x) = (2x+1)7
(d)
$f(x) = \sin(\cos(x))$
(e)
$f(x) = \frac{x}{x^4+2}$
2.
In the case that s(t) is the position of an object as a function of time, the difference quotient

\begin{displaymath}
\frac{s(b)-s(a)}{b-a} \end{displaymath}

can be interpreted as the average velocity of the object during the time interval [a,b] and the limit of the difference quotient is the instantaneous velocity. Suppose that the position in meters of an object is given by s(t) = -9.8 t2/2 +100t + 500 where t is time in seconds.
(a)
What is the average velocity of the object over the interval $0
\leq t \leq 4$? Include a plot of s(t) and an appropriate secant line whose slope is equal to this average velocity.
(b)
What is the average velocity over the time interval $4 \leq t
\leq 8$?
(c)
Is there a time between 4 and 8 at which the instantaneous velocity is equal to the average velocity over the time interval $4 \leq t
\leq 8$?
(d)
At what time is the instantaneous velocity equal to $80 \,
\mathrm{m}/\mathrm{s}$?
(e)
At what time is the instantaneous velocity equal to zero?
3.
Determine the derivative of the function f(x) defined by

\begin{displaymath}
f(x) = \left\{ \begin{array}
{ll}
5 \sin(x) & \mbox{if $x < 0$} \\ x + 2 \sin(2*x) & \mbox{otherwise}\end{array}\right. \end{displaymath}

for all values of x for which f'(x) exists. Describe how you obtained your results.

next up previous
Next: About this document ... Up: Labs and Projects for Previous: Labs and Projects for

William W. Farr
1/25/2000