Why are you using _delayed_ assignment here? Why not use Set:
f[z_] = 1-Cos[z]
You can also write
fd[z_] = D[ f[z] , z ]
to compute the derivative immediately (rather than _each time_ fd is
called). The difference between immediate and delayed assignment is
important, at least in Mathematica. For example, compare
r = Random[]
Table[r, {3}]
with
r := Random[]
Table[r, {3}]
This simple example indicates why both types of assignment are
implemented. Sometimes you might want to work with a fixed random number
and at other times you want a different random number upon each invocation.
Either use immediate assignment, as above, and then
Plot[fd[z], {z, -8, 8}];
works without problem or Evaluate the argument of Plot:
Plot[Evaluate[D[ f[z] , z ]], {z,-8,8}];
You can also do
Plot[Evaluate[f'[z]], {z,-8,8}];
which is a little more elegant.
Cheers,
Paul
--
Paul Abbott Phone: +61 8 9380 2734
School of Physics, M013 Fax: +61 8 9380 1014
The University of Western Australia (CRICOS Provider No 00126G)
35 Stirling Highway
Crawley WA 6009 mailto

aul@physics.uwa.edu.au
AUSTRALIA http://physics.uwa.edu.au/~paul