There was a question on mathgroup, and while I was looking at it, I noticed this thing, and I can’t understand why, I thought some expert here would know.
When doing Dt [ x[1] ]
it gives zero, because during evaluation of x[1], the last value left is 1, as can be seen from the TracePrint below. And hence ‘1’ is what is seen by Dt, and so Dt[1] is 0.
Hence Dt[ x[1] ] is zero
In[86]:= TracePrint[ Dt[x[1] ]]
During evaluation of In[86]:= Dt[x[1]]
During evaluation of In[86]:= Dt
During evaluation of In[86]:= x[1]
During evaluation of In[86]:= x
During evaluation of In[86]:= 1
During evaluation of In[86]:= 0
Out[86]= 0
That made sense to me, until I typed x[1], and got back x[1]
In[84]:= x[1]
Out[84]= x[1]
But x[1] returning x[1] also made sense to me, since x[1] has no value, so it should return unevaluated.
So, my question, is why it seems that x[1] was evaluated all the way down to ‘1’ during the call above, but at the top level notebook interface, it did not evaluate to 1?
In[87]:= Evaluate[ x[1] ]
Out[87]= x[1]
Thanks
The expression
does not evaluate to 1 – it is an indexed variable with undefined value. The problem is that when you use the form of
Dtwith 1 argument, thenxis considered a function, and1– its argument, and you get 0. This becomes clearer when you considerIf you now use
you get
1, since now you differentiate overx[1]considered as a variable. Or,You were confused by evaluation printout since indeed, when evaluating an expression, all parts are normally evaluated – but (in the absense of any rules for
x),x[1]evaluates back to itself also insideDt, to be sure. What you observed is related to howDtwith one argument interprets that argument.