Re: How to use "Apply" to do differentiation ?
- To: mathgroup at smc.vnet.net
- Subject: [mg114469] Re: How to use "Apply" to do differentiation ?
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Sun, 5 Dec 2010 21:51:32 -0500 (EST)
On 12/4/10 at 6:16 AM, alix.zhang at gmail.com (Mayasky) 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. Given Apply[f, expr] is supposed to replace the head of expr with f, any function of x and something else will get replaced with your function. x^n for any n is Power[x,n], So, Apply strips the head Power as it is supposed to do which results in taking the derivative of x with respect to x which of course evaluates to 1. What were you expecting? Did you intend D[#, x] & [x^5] rather than what you did?