Worksheet for trig derivatives
Andy Long
Calculus I
Thanks to Aimee Krug for the idea....

ClearAll["Global`*"] (* This command clears everything that you've defined so far. *)

Here we plot Sin and Cos, on one full period (-Pi to Pi, for a length of 2Pi): The functions repeats forever in either direction -- is periodic. 

Note that Sine and Cosine expect their arguments in radians, by default, and not by degrees. In calculus, you want to think almost exclusively in terms of radians, and not in degrees.

f[x_]:=Sin[x]
g[x_]:=Cos[x]
PlotA=Plot[f[x],{x,-Pi,Pi},PlotLabel->Sine];
PlotB=Plot[g[x],{x,-Pi,Pi},PlotLabel->Cosine];
{PlotA,PlotB}

1. What do you notice about the derivative of Sine? What is the derivative of Sine?

Plot[{f[x],f'[x]},{x,-Pi,Pi}]

2. What do you notice about the derivative of Cosine? What is the derivative of Cosine?

Plot[{g[x],g'[x]},{x,-Pi,Pi}]

3. We can see how to create a function from a bunch of individual slope calculations, in the following animation. Note: sometimes this animation chokes up, and you have to restart it. Check out this demo, and then, once you’ve done it for the default function (Sin[x]), try it with Cos[x]. 

Then try it with some functions of your own choosing. 

You will need to change the window, perhaps, for your function (the current window works fine for Cos[x]).   Notice that we also require a choice for h: you’re using a discrete approximation for the true value. The smaller you make h, the better your approximation (up to a point: if you make h too small, you’ll start to see a breakdown, which is all numerical -- ficticious.)

If you make h large, you will see that your discrete approximation becomes bad, because your “tangent line” doesn’t look much a tangent line anymore. It’s a secant line that’s clearly not doing a very good job of capturing the slope of the tangent line -- which is the graphical meaning of the derivative.

f[x_]:=Sin[x]
xmin=-Pi;
xmax=Pi;
ymin=-1.5;
ymax=1.5;
(* set your value of h: *)
h=.1

list={};
Manipulate[
Module[
{},
m=(f[a+h]-f[a])/h;
list=Append[list,{a,m}];
PlotA=Plot[{f[x],m(x-a)+f[a]},{x,xmin,xmax}];
PlotB=ListPlot[list];
Show[PlotA,PlotB,PlotRange->{ymin,ymax}]
]
,{a,xmin,xmax}
]

4. I hope that you notice that cosine is just a shifted version of sine (or vice versa). What, then, can we say about their derivatives? If you simply shift a function left or right, what happens to its derivative?