Why do I need the Evaluate[] in the code below?
cdf = CDF[NormalDistribution[0, 1], x] Plot[D[cdf, x], {x, -3, 3}] (* Doesn't work *) Plot[Evaluate[D[cdf, x]], {x, -3, 3}] (* Works *)
One more explanation:
Plot has the attribute HoldAll - for good reasons! Just mimic of not having this attirbute (and try):
Plot
HoldAll
x = 3; Plot[Evaluate@Sin[x], {x, 0, 2 Pi}]
Mathematica users must get used to this. Plot gives a numerical value to x before it evaluates the derivative, resulting in something like (d f(1)) / (d1) from (d f(x)) / (dx). Evaluate forces the symbolic calculation of the derivatives before the numerical values come in. Also compare
x
(d f(1)) / (d1)
(d f(x)) / (dx)
Evaluate
Plot[RandomReal[], {x, 0, 1}] Plot[Evaluate[RandomReal[]], {x, 0, 1}]
Plot can be thought of as an extended Table, with the difference that Plot gives a graphical output.
Table
Testing your example with Table gives some insight from the error messages and in the output: