|
[Date Index]
[Thread Index]
[Author Index]
Re: How to use "Apply" to do differentiation ?
- To: mathgroup at smc.vnet.net
- Subject: [mg114460] Re: How to use "Apply" to do differentiation ?
- From: Murray Eisenberg <murray at math.umass.edu>
- Date: Sun, 5 Dec 2010 21:49:53 -0500 (EST)
Why are you surprised at the result? Recall that what Apply[fn, expr]
does is to replace Head[expr] by fn and then evaluate that.
For simplicity, let's use the name:
d = D[#, x] &
Now Head[x^5] is Power, so the result from Apply[d, x^5] is the same (as
your trace will show you) as that from D[x,x], which is of course 1.
I presume the whole point of what you were doing was to use a name for
the first-derivative operator. Why not just the following?
d[x^5]
On 12/4/2010 6:16 AM, 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.
> 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?
>
--
Murray Eisenberg murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower phone 413 549-1020 (H)
University of Massachusetts 413 545-2859 (W)
710 North Pleasant Street fax 413 545-1801
Amherst, MA 01003-9305
Prev by Date:
Re: How to use "Apply" to do differentiation ?
Next by Date:
Re: I look for a bi-modal distribution
Previous by thread:
Re: How to use "Apply" to do differentiation ?
Next by thread:
Re: How to use "Apply" to do differentiation ?
|