next up previous
Next: About this document ... Up: lab_template Previous: lab_template

Subsections


Derivatives

Purpose

The purpose of this lab is to teach you how to use Maple to find and plot tangent lines.

Background

The Maple D and diff commands

These commands can be summarized as follows.

When you use the D operator to compute the derivative of a function, the result is also a function, as shown below.

> D(f);
If you provide a label, then you get a function you can use later in the session,
> df := D(f);
However, this is usually not necessary. See the examples below.

If you want to evaluate the derivative at a specific value of $x$ or just get the expression for the derivative, you can use the following forms of the D operator.

> D(f)(2);
> D(f)(x);
This last form is the one to use for plotting, as shown below.
> plot(D(f)(x),x=-2..2);

Suppose you want to find the equaton of the line tangent to the graph of $f(x)$ at the point $x=5$. This can be done in Maple using the point slope form of a line as shown below.

> tanline := D(f)(5)*(x-5)+f(5);
> plot([f(x),tanline],x=0..10);

The D operator cannot be used on expressions, for example trying to use it to differentiate the expresssion we defined above results in an error.

> D(p);
If you recall that Maple uses f(x) to refer to the expresssion that is used to define $f$, then the following error shouldn't surprise you.
> D(f(x));

To differentiate expressions, you need to use the diff command. Here is an example.

> diff(p,x);
The diff command can also be applied to functions as shown below.
> diff(f(x),x);
Note, however, that the result of the diff command is an expression, not a function. This means that computing the value of the derivative at a specific value of $x$ requires you to use the subs command as follows:
> der := diff(p,x);
> subs(x=Pi/2,der);
Suppose you want to find the equaton of the line tangent to the graph of $f(x)=\ln(x)$ at the point $x=5$. This can be done in Maple using the point slope form of a line as shown below.
> f:=x->ln(x);
> tanline := D(f)(5)*(x-5)+f(5);
> plot([f(x),tanline],x=0..10);

Exercises

  1. Find the equation of the line tangent to the graph of the function $\displaystyle f(x)=\cos(x)+\sin(x)-x^3+12x-1$ at $x=3$. When calculating the derivative at a point, use the $D$ command. Include a plot of the function and the tangent line on the same graph over the interval $0 \leq x \leq 5$.

  2. The tangent line to a function at a particular value of x intersects the graph of the function at least once, at the point of tangency. However, the tangent line may intersect the graph at other points. In this problem, we investigate whether the tangent line at one point can also be tangent to the graph at another point. For example, consider the function

    \begin{displaymath}g(x) = (x^2-1)^2+1 \end{displaymath}

    Show that the tangent line to $g(x)$ at $x=-1$ is also tangent to the graph at $x=1$ by finding the equation of both lines and plotting on the same graph as the function. Use plotting ranges $-2 \leq x \leq 2$ and $0 \leq y \leq 10$.

    Next, suppose we change the function slightly.

    \begin{displaymath}h(x) = (x^2-1)^2 +x/2 \end{displaymath}

    Is it still possible to find two different values of $x$ such that the tangent lines coincide? The answer is yes. Find them and plot the function and tangent line on the same graph over the interval $-2 \leq x \leq 2$.

  3. Find the equation of the tangent line to

    \begin{displaymath}f(x) = 4x^3+8x^2-24x+1 \end{displaymath}

    at the point $x=1$. Find another point on the graph that has the same slope as this point. Find the equation of the line tangent to $f(x)$ at this point. Plot the function and both tangent lines on the same graph.

next up previous
Next: About this document ... Up: lab_template Previous: lab_template
Dina J. Solitro-Rassias
2017-09-16