(*     Module #2:  The Slope and the Derivative     *)

(*    The function f[t] defined     *)
f[t_] := 3*t + 5

(*    Make a graph of the function   *)
Plot[f[t], {t, -1 ,1 },GridLines->Automatic]

(*    Definition of the slope of a function f[t]  *)
delta=1.0;
Slope[t_] := (f[t+delta] - f[t])/delta;

(*    The slope at t=0    *)
Slope[0]

(*     The slope at t=0.5   *)
Slope[0.5]

(*     Definition of a parabolic function h[t]   *)
h[t_] := 2*(t^2)
Plot[h[t],{t,-2,2},GridLines->Automatic]

(*     Calculation of the slope of h[t]   *)
delta=1.0;
Slope[t_] := (h[t+delta] - h[t])/delta

(*     Value of the slope at t=1.0     *)
Slope[1.0]

(*     Slope of h[t] with a smaller delta   *)
delta=0.5;
Slope[t_] := (h[t+delta] - h[t])/delta
Slope[1.0]

(*     Slope of h[t] at a different point t=3.0   *)
delta=1.0;
Slope[t_] := (h[t+delta] - h[t])/delta
Slope[3.0]

(*    Graph of a sine function   *)
Plot[Sin[t], {t, 0 , 2*Pi}]

(*    Calculation of the derivative of a sine function  *)
delta = 0.1;
g[t_] := Sin[t];
Slope[t_] := (g[t+delta] - g[t])/delta

(*     Make a graph of the derivative of a sine function  *)
Plot[Slope[t], {t, 0, 2*Pi}]

(*   Illustration of built-in Mathematica  functions to
     calculate derivatives    *)
     f[t_] := (t^3);
D[f[t],t]

(*    Another example   *)
f[t_] := Sin[t];
D[f[t],t]