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

Subsections


Limits and Derivatives

Limits

Limits of functions and expressions can be computed in Maple using the limit command. To evaluate the familiar limit, $\displaystyle\lim_{x \rightarrow 0} \frac{\sin(x)}{x}$, using Maple, you would use the following command.

  > limit(sin(x)/x,x=0);


\begin{maplelatex}
\begin{displaymath}
1\end{displaymath}\end{maplelatex}

Notice that the first arguement in the parentheses is the expression that you are taking the limit of; the second is the c-value that x is approaching. As in the previous example, you can type the expression directly into the limit command. Another approach is to first define the function in Maple and use the function name within the limit command.

  > limit(x^2+8*sin(-3*x*Pi), x=1/2);


\begin{maplelatex}
\begin{displaymath}
{\displaystyle \frac {33}{4}}\end{displaymath}\end{maplelatex}

  > f:=x->(cos(x)-1)/x;


\begin{maplelatex}
\begin{displaymath}
f := x\rightarrow {\displaystyle \frac {\cos(x)-1}{x}}\end{displaymath}\end{maplelatex}

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


\begin{maplelatex}
\begin{displaymath}
{\displaystyle 0}\end{displaymath}\end{maplelatex}

If the limit exists, Maple can usually find it. In cases where the limit doesn't exist, such as $\displaystyle\lim_{x \rightarrow 0} \frac{1}{x}$ or $\displaystyle\lim_{x \rightarrow 0} f(x)$ where $f(x) = \left\{ \begin{array}
{cc}
 -x^2+4 & \mbox{if $x<0$} \\  x-2 & \mbox{if $\space x \geq 0$}
 \end{array} \right. $, Maple gives the answer undefined. Look at the plots of the functions to see why the limits are undefined.

  > limit(1/x,x=0);


\begin{maplelatex}
% latex2html id marker 91
\begin{displaymath}
{\it undefined}\end{displaymath}\end{maplelatex}

  > plot(1/x,x=-5..5,y=-10..10);

  > p := piecewise(x<0,-x^2+4,x>=0,x-2);

  > limit(p,x=0);

  > plot(p,x=-5..5);

Another reason the limit does not exist at x0 is because of oscillations. The limit as x approaches 0 of $\cos(\frac{1}{x})$is undefined. To get a better idea of why, look at the plot. When evaluating the limit using Maple, the result is the range -1..1. When the limit doesn't exist, but the expression or function is bounded, this is the type of answer that Maple will give.

  > plot(cos(1/x),x=-2..2);
  > limit(cos(1/x),x=0);

\begin{maplelatex}
\begin{displaymath}
-1 .. 1\end{displaymath}\end{maplelatex}

Maple also can find one-sided limits. Suppose that you want to find the limit as x approaches 0 from the right for the following function:

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

  > f:=x->x*sin(1/x);

\begin{maplelatex}
\begin{displaymath}
{f} := {x} \rightarrow {x}\,{\rm sin} \le...
 ...\,{\displaystyle 
\frac {1}{{x}}}\, \! \right) \end{displaymath}\end{maplelatex}
  > limit(f(x),x=0,right);

\begin{maplelatex}
\begin{displaymath}
0\end{displaymath}\end{maplelatex}

Similarly, you can find the limit of f(x) as x approaches 0 from the left.

Derivatives

The derivative of a function f(x), often written f'(x), is defined by the following limit.

\begin{displaymath}
\lim_{h \rightarrow 0} \frac{f(x+h)-f(x)}{h}. \end{displaymath}

When using the definition to compute a derivative in Maple, it is easiest to first define the function f. You can then find the difference quotient of f and take the limit as h approaches 0 in either one or two steps. Both examples are 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}

  > DQ:=(f(x+h)-f(x))/h;

\begin{maplelatex}
\begin{displaymath}
{\it DQ} := {\displaystyle \frac {(x + h)^{2} + 3\,h - x^{2}}{h}
}\end{displaymath}\end{maplelatex}
  > derivative:=limit(DQ,h=0);


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

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

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

To evaluate the derivative at a given x value, you can use one of two methods. Both are given below.

  > subs(x=1,derivative);

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

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

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

Exercises

1.
Estimate each of the following limits from graphs. Check your answer using the limit command.
(a)
$\displaystyle\lim_{x\rightarrow 0} \frac{\tan(\vert x\vert)}{x}$
(b)
$\displaystyle\lim_{x\rightarrow 2}\frac{3x^2-x-2}{6x^2-10x-4}$
(c)
$\displaystyle\lim_{x\rightarrow \frac{1}{\pi}}
 \frac{1+\cos(\frac{1}{x})}{\pi x-1}$
(d)
$\displaystyle\lim_{x\rightarrow \pi} \frac{\sin(x^3+5x)}{\tan(x)}$

2.
Given $f(x) = \displaystyle\frac{sin(\frac{\pi}{2}+t)-1}{t} $, do the following.
(a)
Give the difference quotient for f.
(b)
Find f'(x) by taking the limit of the difference quotient.
(c)
For what x values does the derivative exist? If the derivative does not exist for some x value, explain why not.
(d)
Find all points on the graph of f where there is a horizontal tangent line on the interval [0,20].

3.
Let s(t)=15-6.729t2 be a function representing the position of a penny dropped at time 0 from the roof of a building. The distance is measured in meters and the time is measured in seconds.
(a)
From what height was the penny dropped?
(b)
At what time is the penny 3 meters off the ground?
(c)
What is the average velocity of the penny over the time it was dropped and the time that it hit the ground?
(d)
Find the instantaneous velocity of the ball for any time t.
(e)
What is the velocity when the ball hits the ground?
(f)
When is the instantaneous velocity the same as the average velocity over the entire drop time?
(g)
Suppose that the penny is dropped from the same height and before it reaches the ground, it hits a 1.75-meter tall man in the head. When is the instantaneous velocity the same as the average velocity over the time of release to the time of bouncing off the head of the pedestrian?

4.
Let $f(x) = \displaystyle\left\{ \begin{array}
{cc}
 \sin(x^2)+32x & \mbox{if $x\leq...
 ...x{if $\space 0<x <6$}\\  25.6(x+4)^2 & \mbox{$if \geq 6$}
 \end{array} \right. $
(a)
Where is f continuous? Explain your answer.
(b)
What is the derivative of f?
(c)
Where is f differentiable? Be sure to explain your answer.

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

Christine M Palmer
12/18/1997