Re: How to use "Apply" to do differentiation ?

• To: mathgroup at smc.vnet.net
• Subject: [mg114503] Re: How to use "Apply" to do differentiation ?
• From: Chenguang Zhang <alix.zhang at gmail.com>
• Date: Sun, 5 Dec 2010 21:57:48 -0500 (EST)

```I tried to recursively apply differentiation to a normal
distribution function,
and before using Nest command I wanted to check if pure function worked...
Now I know that I missed "{}" in my command and Apply[D[#,x]&, {x^5}] is
the correct one. Thanks to all!

On Sun, Dec 5, 2010 at 1:45 PM, Andrzej Kozlowski <akoz at mimuw.edu.pl> wrote:

> On 4 Dec 2010, at 12:16, 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?
> >
>
> I don't see anything very strange in this. Note that the full form of x^5
> is Power[x,5]. Observe that in general
>
> Apply[f[#] &, p[x, y]]
>
> f(x)
>
> So not Apply[D[#,x]&,Power[x,5]] will give D[x,x] which is 1.
>
> What I do not understand is what you actually intended to achieve. If you
> wanted simply to differentiate x^5 the way to do it is
>
> D[#, x] &@(x^5)
>
> or (if you really must):
>
> Compose[D[#, x] &, x^5]
>
> 5 x^4
>
>
> Andrzej Kozlowski
>
>

```

• Prev by Date: Re: Cyclical Decimal Expansion
• Next by Date: Re: How to bring up specific doc page programmatically?
• Previous by thread: Re: How to use "Apply" to do differentiation ?
• Next by thread: Re: Re: How to use "Apply" to do differentiation ?