evaluations of derivative functions



Hello,
  I have a question about how maxima handles function definitions and
  derivatives.  I am mainly interested in plotting functions associated
  with other functions

For instance, consider the following lines.

(%i1) f(x):= x^2;
                                            2
(%o1)                             f(x) := x
(%i2) g(x):= diff(f(x),x);
(%o2)                        g(x) := diff(f(x), x)
(%i3) g(2);

Non-variable 2nd argument to diff:
2
#0: g(x=2)
  -- an error.  To debug this try debugmode(true);
(%i4) g(t):= subst(x=t,diff(f(x),x));
(%o4)                 g(t) := subst(x = t, diff(f(x), x))
(%i5) g(t);
(%o5)                                 2 t
(%i6) g(x);
(%o6)                                 2 x
(%i7) g(2);
(%o7)                                  4


Why is it necessary to put in the 'subst' command?  Is there a better
way to do this?

TIA,
  -sen



  ---------------------------------------------------------------------------
  | Sheldon E. Newhouse            |    e-mail: sen1 at math.msu.edu           |
  | Mathematics Department         |       				   |
  | Michigan State University      | telephone: 517-355-9684                |
  | E. Lansing, MI 48824-1027 USA  |       FAX: 517-432-1562                |
  ---------------------------------------------------------------------------