Re: Re: V6 evaluation inside Table and plot
- To: mathgroup at smc.vnet.net
- Subject: [mg76747] Re: [mg76669] Re: V6 evaluation inside Table and plot
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Sat, 26 May 2007 04:50:28 -0400 (EDT)
- References: <f33onq$l4v$1@smc.vnet.net> <200705251043.GAA08270@smc.vnet.net>
On 25 May 2007, at 19:43, Szabolcs wrote:
>
> P.S. It is also interesting to note that while the documentation
> says that
> "Whenever Derivative[n][f] is generated, Mathematica rewrites it as
> D[f[#],{#,n}]&",
> Derivative[] doesn't seem to work this way.
This statement (in the documentation) is badly misleading. I am
pretty sure that "rewrites" is not meant to suggest that Derivative
actually uses D since one can easily show that it does not. I think
all that statment is trying to convey is the "form" of the output
that Derivative tries to produce. Even this is strictly speaking
wrong, for, if anything it should say
Evaluate[D[f[#],{#, n}]] &
We can see this just by taking f=Sin. Then:
Derivative[3][Sin]
-Cos[#1] &
while
D[Sin[#1], {#1, 3}] &
D[Sin[#1], {#1, 3}] &
which takes a lot of imagination to see as "the same". On the other
hand:
Evaluate[D[Sin[#1],{#1, 3}]] &
-Cos[#1] &
which does have the same form. But, as I wrote above, one can easily
show that this is not what Derivative actually does:
Unprotect[D];
D[f_, n_] := Null /; (Print[d[f, n]]; False)
Derivative[3][Sin]
-Cos[#1] &
while
Evaluate[D[Sin[#1],{#1, 3}]] &
d[Sin[#1], {#1, 3}]
-Cos[#1] &
So that piece of documentation was a kind of "figurative"
description, and since it is misleading it would be better not to
have it at all.
As for the original problem: I think it is safest to define functions
with named variables like this:
f = Function[x, x^2] /. x -> Unique[x]
This, I beleive, should never run into any problems (except, of
course, deliberately contrived ones).
Andrzej Kozlowski
- References:
- Re: V6 evaluation inside Table and plot
- From: Szabolcs <szhorvat@gmail.com>
- Re: V6 evaluation inside Table and plot