Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

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

  • To: mathgroup at smc.vnet.net
  • 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]


  • Prev by Date: Re: Pi is not a real number?
  • Next by Date: Re: Pi is not a real number?
  • Previous by thread: RE: Re: Operate on Heads
  • Next by thread: Re: Clearing selected variables