next up previous
Next: About this document ... Up: No Title Previous: No Title

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 from the definition, as shown below.

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

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

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

\begin{maplelatex}
\begin{displaymath}
{\displaystyle \frac {(\,1 + {h}\,)^{2} - 1 + 3\,{h}}{{h}}}\end{displaymath}\end{maplelatex}

The following limit determines f'(1).

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

\begin{maplelatex}
\begin{displaymath}
5\end{displaymath}\end{maplelatex}

The following limit determines f'(x).

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

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

Maple also knows how to compute 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.

  > D(f);

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

  > D(f)(1);

\begin{maplelatex}
\begin{displaymath}
5\end{displaymath}\end{maplelatex}

  > 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. Some examples are given below.

  > diff(cos(x),x);

\begin{maplelatex}
\begin{displaymath}
 - {\rm sin}(\,{x}\,)\end{displaymath}\end{maplelatex}

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

\begin{maplelatex}
\begin{displaymath}
{p} := {x}^{3} + {\rm sin}(\,{x}\,)\end{displaymath}\end{maplelatex}

  > diff(p,x);

\begin{maplelatex}
\begin{displaymath}
3\,{x}^{2} + {\rm cos}(\,{x}\,)\end{displaymath}\end{maplelatex}

  > f(x);

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

  > diff(f(x),x);

\begin{maplelatex}
\begin{displaymath}
2\,{x} + 3\end{displaymath}\end{maplelatex}
  > subs(x=1,diff(f(x),x));

\begin{maplelatex}
\begin{displaymath}
5\end{displaymath}\end{maplelatex}

To learn more about how to use the D and diff commands, see the help pages. In general, the D command is useful for computing the derivative of a function at a point because it produces a function. The output of the diff command, on the other hand, is an expression. Expressions are easy to plot, but putting in numbers to evaluate an expression requires the subs command, as shown in the last command in the examples above.

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

\begin{displaymath}
y = \frac{f(b)-f(a)}{b-a} (x-a) + f(a).\end{displaymath}

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 b-a. Try the commands in the examples below to learn how to use this command. If you want to learn more, consult the help page.Note especially that the third argument to secantline is not b, but b-a.

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 first produces what looks like an ordinary plot in the worksheet. However, if you click on the plot to make it active, controls for the animation appear in the context bar that are similar to 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}
-{x} + 1\end{displaymath}\end{maplelatex}

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

\begin{maplelatex}
\begin{displaymath}
-1.750000000\,{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=0,1.5-t)},x=-0.5..1.5,t=0..1.49);

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

\begin{maplelatex}
\begin{displaymath}
{\frac {\left ({h}^{3}-2\,h\right )x}{h}}+1\end{displaymath}\end{maplelatex}

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

\begin{maplelatex}
\begin{displaymath}
-2\,{x} + 1\end{displaymath}\end{maplelatex}

Exercises

1.
Find the derivatives of the following functions three different ways using Maple. From the definition, using the D command, and using the diff command. Note that Maple has its own ideas of what form the answer should take, so some of your answers may look unfamiliar or be more complicated than you think they should.
(a)

\begin{displaymath}
f(x) = \cos(\sin(x))\end{displaymath}

(b)

\begin{displaymath}
f(x) = \tan(x^2)\end{displaymath}

(c)

\begin{displaymath}
f(x) = \frac{3x^2+2x}{11x^3+15x^2+5}\end{displaymath}

2.
Given the function f(x) =x4-0.5x3-6x2 + 0.5 x +5,
(a)
Plot f(x) between $-3 \leq x \leq 3$.
(b)
Find the slope of the line tangent to the graph at x=0.5.
(c)
Find any other points on the graph of f(x) that have the same slope as the tangent line at x=0.5.
3.
For the function given below,

\begin{displaymath}
f(x) = \frac{\sin(x)}{x^2\cos(x)+2} \end{displaymath}

(a)
Use Maple to define the function as a function of x.
(b)
Use Maple to define the difference quotient as a function of h.
(c)
Evaluate the limit of the difference quotient and compare this result with the derivative of the function using the Maple D command. Explain why you are grateful to have Maple to answer this question.
(d)
Find the equation of the line tangent to the graph of f(x) at the point $x=\pi/2$.
(e)
Plot the function and the tangent line on the same graph.
4.
Suppose that s(t), defined as

\begin{displaymath}
s(t) = \sin(t)+t^2\cos(t) \end{displaymath}

for $0 \leq t \leq 3$, describes motion of a particle in one dimension. That is, s is the distance of the particle from some reference point as a function of time.
(a)
Find the secant line of the graph of s between t=1 and t=2.
(b)
Describe how you can use your answer to the first part of this exercise to compute the average velocity of the particle over the time interval $1 \leq t \leq 2$. Report the value of the average velocity.

next up previous
Next: About this document ... Up: No Title Previous: No Title

Dina Solitro
9/21/1999