% Definition of a Derivative
% MATH266A Exercise
%%%% spaces removed from def of g so it fits on one line
%%%% comment after def removed
%%% hacked margins so 2 pages
\documentclass[12pt]{article}
\usepackage{times}
%%%\pagestyle{empty}
\pagestyle{myheadings}%%%
\markright{MATH266A \hfill Definition of a Derivative\hfill}
\thispagestyle{empty}
\addtolength{\topmargin}{-1.5cm}
\addtolength{\textheight}{1.5cm}
\addtolength{\textwidth}{1.2in}
\addtolength{\textheight}{1.2in}
\addtolength{\oddsidemargin}{-.58in}
\addtolength{\evensidemargin}{-.58in}
\renewcommand{\baselinestretch}{1.0}
\parindent = 0cm
\parskip = .1cm
\begin{document}
\begin{center}
{\Large Definition of a Derivative
\footnote{Copyright \copyright 2002 Winfried Just, Department of Mathematics,
Ohio University. All rights reserved.}}
\end{center}
\bigskip
In this \textsc{MatLab} exercise you will see how the definition of a derivative works.
Open \textsc{MatLab} and define a function:
\smallskip
\verb$>> f = inline('0.5*x^4 + x^2 - 2', 'x')$
\smallskip
Graph this function:
\smallskip
\verb$>> ezplot(f, [0,2])$
\smallskip
Enter:
\verb$>> hold on$
\smallskip
Now we want to find the derivative $f' (1.2)$. As you learned in class, this derivative is equal to:
\begin{equation}
f' (1.2) = \lim_{h \rightarrow 0}
{f(1.2 + h) - f(1.2) \over h}
\end{equation}
\smallskip
Let us create a new inline function that signifies this quotient:
\smallskip
\verb$>> g=inline('(0.5*(1.2+h)^4+(1.2+h)^2-2-(0.5*1.2^4+1.2^2-2))/h','h')$
\smallskip
Note that in the above definition, $g$ is assumed to be a function of $h$.
%%%\emph{Caution:} You need to enter the definition of $g$ exactly as it appears above; in particular, you cannot omit any characters that appear in the second line of this command.
Now let us evaluate $g(h)$ for several values of $h$. To find $g(1)$, enter:
\smallskip
\verb$>> g(1)$
\smallskip
Now find: $g(0.1)$, $g(0.01)$, $g(0.001)$, $g(-0.001)$, $g(0.0001)$, $g(-0.0001)$
Does $g(h)$ seem to get closer and closer to a fixed value? What would this fixed value be? To get an idea what the limit would be, enter:
\smallskip
\verb$>> g(0.0000001)$
\smallskip
Your output should be $5.8560$, which is in fact the derivative of $f$ at $1.2$. However, $g(0.0000001)$ \emph{is not} exactly equal to this derivative. To see this, enter:
\smallskip
\verb$>> format long$
and
\verb$>> g(0.0000001)$
\smallskip
You will see that the seemingly exact value of the derivative $f' (1.2)$ that we had obtained previously is an artifact of \textsc{MatLab's} rounding. Here you have an example of the relationship between computing limits and using ``instruments of measurement with increasingly better precision.'' The ``instrument of measurement'' is \textsc{MatLab's} output routine in this case.
Now let us have a look at the graphical interpretation of the derivative. As we mentioned in class, the derivative $f'(1.2)$ is the slope of the tangent line to the graph of $f$ at the point $(1.2, f(1.2))$. By entering:
\smallskip
\verb$>> f(1.2)$
\smallskip
we find that $f(1.2) = 0.4768$. As was mentioned above, $f'(1.2) = 5.856$. Thus an equation of the tangent line in point-slope form is given by the formula:
\begin{equation}
y = 5.856(x - 1.2) + 0.4768
\end{equation}
Let \textsc{MatLab} graph this function by entering:
\smallskip
\verb$>> y = inline('5.856*(x - 1.2) + 0.4768', 'x')$
and
\verb$>> ezplot(y, [0,2])$
\smallskip
Now let us see what the term ``tangent line'' means. Let us zoom in on the interesting part of the picture. Enter:
\smallskip
\verb$>> axis([1 1.4 0 1])$
\smallskip
and look at your picture again. Can you figure out what the ``axis'' command does? Now let us try to zoom in even more closely. Enter:
\smallskip
\verb$>> axis([1.15 1.25 0 1])$
\smallskip
As you can see, as you concentrate on the neighborhood of the point where the tangent line touches the graph of the function, the two graphs become practically indistinguishable. In particular, the graph of the function $f$ becomes more and more similar to the graph of a linear function. You may want to explore this phenomenon further by experimenting with other settings for the axes.
The official definition of the tangent line at $(1.2, f(1.2))$ is that it is \emph{the graph of the linear function which best approximates the graph of $f(x)$ for $x$-values that are close to $1.2$}. We will explore this interpretation of the tangent line in later parts of this course.
Now let us zoom out again by entering:
\smallskip
\verb$>> axis([0 2 -5 10])$
\smallskip
Let us see how the tangent line is related to various secant lines by entering:
\smallskip
\verb$>> g(-1)$
\smallskip
We find that the slope of the secant line through the points $(0.2, f(0.2))$ and $(1.2, f(1.2))$ has slope $2.436$. We can instruct \textsc{MatLab} to draw it by entering:
\smallskip
\verb$>> y = inline('2.436*(x - 1.2) + 0.4768', 'x')$
and
\verb$>> ezplot(y, [0,2])$
\smallskip
You don't have to retype the whole instructions. You can use the upwards arrow key to retrieve the previous definition of the inline function $y$, edit it by changing the slope, and then hit ENTER.
Now add to your picture the following secant lines:
\begin{itemize}
\item The line through $(0.7, f(0.7))$ and $(1.2, f(1.2))$
\item The line through $(1, f(1))$ and $(1.2, f(1.2))$
\item The line through $(1.15, f(1.15))$ and $(1.2, f(1.2))$
\end{itemize}
Can you see how these secant lines are getting closer and closer to the tangent line?
Now add the title ``\textsc{MatLab} Exercise on definition of the derivative''
to your picture and print it
%%%%for possible submission as part of the next test.
if submission is required.
\end{document}