Subject: [mg86636] Bug: Derivative[] does not work with functions having slots in their

From: Szabolcs Horvát <szhorvat at gmail.com>

Date: Sat, 15 Mar 2008 17:44:06 -0500 (EST)

Organization: University of Bergen

There is a bug in Derivative. It does not seem to like slots.
For example, let f[x_] := Sin[x + #]&[1] (Yes, I know that this looks
silly. It is a simplified example.)
D can be used for calculating the derivative, but Derivative cannot.
In[2]:= D[f[a], a]
Out[2]= Cos[1 + a]
In[3]:= f'[a]
Out[3]= 0
A workaround is to use pure functions with explicitly named parameters:
In[4]:= g[x_] := Function[{p}, Sin[x + p]][1]
In[5]:= g'[a]
Out[5]= Cos[1 + a]