Why does the Derivative function not appear in the tree form? [closed]

I was learning that set delay doesn’t evaluate things until its calling time. Hence, I thought that something like the followng:

dfdt := D[f[t],t]

would not evaluate the derivative until dfdt was called. Let me show you what I tried:

as you can tell, the Head is not the derivative, as I would ave thought. Why is this? Is there a misconception that I have about how mathematica works?

It still doesn’t work (display the Derivative in the tree even if I say “unevaluate”):



1 Answer


Assuming that you have defined

f[a_, cs_List, ts_List] := cs.Exp[-(ts – a)^2]


dfd2 := D[f[a, {c1, c2, c3}, {t1, t2, t3}], t1]

defines dfd2 without taking into consideration the current value of f. You can inspect the definition of dfd2 by evaluating ?dfd2, which returns exactly what you typed above. Then, whenever dfd2 is evaluated, it looks for any definition associated with the symbol f at that moment in order to manipulate the expression. This means that dfd2 returns

2 c1 Exp[-(a – t1)^2] (a – t1)

You can compare this behavior with that of

immediate = D[f[a, {c1, c2, c3}, {t1, t2, t3}], t1]

Check the expression returned by ?immediate. You’ll see that, while in the definition of dfd2 the expression f[___] is kept in an unevaluated form, in immediate the right hand side is simplified at definition time.

Among other things, this means that if you redefine f, as with Clear[f]; f[___] := 0, dfd2 will evaluate to 0, reflecting the change in f, while immediate will remain unmodified. This, again, is because f does not appear in the definition of immediate, which you can check through ?immediate.