Re: How to use "Apply" to do differentiation ?
- To: mathgroup at smc.vnet.net
- Subject: [mg114452] Re: How to use "Apply" to do differentiation ?
- From: Roland Franzius <roland.franzius at uos.de>
- Date: Sun, 5 Dec 2010 21:48:27 -0500 (EST)
- References: <idd7ts$nja$1@smc.vnet.net>
Am 04.12.2010 12:16, schrieb Mayasky:
> Something simple yet unbelievable occurred when I use:
>
> Apply[D[#, x]&, x^5]
>
> The output is invariably 1 whether I use x^5 or x^100.
> Also I suggest you to try "Trace" command to see
> the weirdness -- the output is messy if pasted as
> text here.
>
> Finally I have to take a detour and use:
> Nest[D[#, x]&, x^5, 1]
>
> I have been using Mathematica for several years and
> never found that. I myself is wordless, but can anyone
> explain that?
>
Its very easy to trace unexpected evaluation results
Trace[D[#, x] & @@ (x^5)] // FullForm
FullForm[{HoldForm[(D[#1, x] & ) @@ (x^5)],
HoldForm[(D[#1, x] & )[x, 5]], HoldForm[D[x, x]], HoldForm[1]}]
which is the correct formal answer, because Power[x,5] is a function of
two variables.
Of cause, one can doubt, if an automatic application rule for
diffentiating sequences of variables without any function head is a
useful concept.
It is comparable to a concept of differentiating tensor products of
spaces with respect to position by replacing a factor space V at
position i in V_1 \times ... \times V_i \times ... by the
one-dimensional spaces of multiples of the field unit 1.
--
Roland Franzius