[Date Index] [Thread Index] [Author Index]
Re: Why D[x', x] isn't 0 ?
On 29 Apr 2006, at 20:41, Andrzej Kozlowski wrote: > > On 29 Apr 2006, at 16:40, Vladimir wrote: > >> Hello! >> >> D[x'', x'] => 0 (* okay *) >> >> D[x', x] => x'' (* unexpected despite being similar to above *) >> >> D[f[x'], x] => x'' f'[x'] (* unexpected as well *) >> >> Why the last 2 lines don't produce zeroes and how to make them >> do so (for any function f) because it's quite common in mechanics >> where velocity is treated as independent of position, etc. >> >> -- >> Vladimir >> > > Consider the case D[x', x]. Mathematica does it as follows. The > FullForm of the expression is: > > D[Derivative[x], x] > > So Mathematica sees it as having the form f[x], where f is the > function Derivative. Next, Derivative is differentiated as a > function to obtain Derivative. Finally Derivative[x] is > returned and re-written as x''. > > Now the case D[x'', x'] > > The FullForm is D[Derivative[x], Derivative[x]]. Now the > expression that is being differentiated is not seen as an explicit > function of the expression Derivative[x] with respect to which > the differentiation is being performed, so the answer 0 is returned. > > The other case should now be obvious. > > As for your other question: the easiest way is the most obvious one: > > In:= > x'=v; > > In:= > D[f[x'], x] > > Out= > 0 > > In:= > D[x',x] > > Out= > 0 > > There are other, more elaborate ways, but I can't imagine that they > would be preferable to the above. > > Andrzej Kozlowski > Tokyo, Japan > On re-reading, I find my answer above unsatisfactory. It more or less correctly describes what Mathematica does formally but incorrectly suggests that it is mathematically meaningful. In fact it is nonsense, though not through any fault of Mathematica. The problem is of course with the phrase: > Next, Derivative is differentiated as a function to obtain > Derivative. I did not of course mean to suggest that mathematica differentiates the derivative as a function, as one does, for example, in the Calculus of Variations. All that happens is that it applies the following formal rule: In:= Derivative[n][Derivative[m]] Out= Derivative[m+n] Now, this makes perfect sense if one thinks of Derivative[n] as an operator and the above as a composition of operators, but this does not mean that the "mth derivative is differentiated" n -times in any mathematically meaningful sense. In fact all the inputs and outputs in the original post are mathematically meaningless since they mix differentiation of functions and of expressions. This makes sense: In:= Derivative[Derivative[x]] Out= Derivative[x] This really does not: In:= D[Derivative[x], x] Out= Derivative[x] The fault, however, is not Mathematica's but simply incorrect input; the result form confusing differentiation of expressions ( D [expr,x]) with differentiation of functions (x' = Derivative [x] ). So, basically this is just a case of "nonsense in -> nonsense out'. Andrzej Kozlowski