Re: How to use "Apply" to do differentiation ?
- To: mathgroup at smc.vnet.net
- Subject: [mg114514] Re: How to use "Apply" to do differentiation ?
- From: Roland Franzius <roland.franzius at uos.de>
- Date: Mon, 6 Dec 2010 06:13:16 -0500 (EST)
- References: <idd7ts$nja$1@smc.vnet.net> <idhjal$9cc$1@smc.vnet.net>
Am 06.12.2010 03:55, schrieb WetBlanket: > On Dec 4, 3:16 am, Mayasky<alix.zh... at gmail.com> wrote: >> 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? > > You need to place x^5 in parenthesis > Apply[D[#, x]&,{ x^5}] You should not Apply D, its the wrong way of thinking. In mainstream mathematics, D needs a function to operate on, providing the linear approximation of a function in direction locally, pointed to by the vector x->x+dx. Applying D means to map the d_x-operation on the first argument of the function and projecting the result in the first Slot. Compare eg. Apply[D[#, x] &, f[a[x, y], b[x, y]]] -> Derivative[1, 0][a][x, y] Map[D[#, x] &, f[a[x, y], b[x, y]]] -> f[Derivative[1, 0][a][x, y], Derivative[1, 0][b][x, y]] Map[D[#, x] &, f[a[x, y], b[x, y]]]//First -> Derivative[1, 0][a][x, y] -- Roland Franzius