MathGroup Archive 2009

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

Search the Archive

Re: Why does Derivative fail in this case?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg96580] Re: Why does Derivative fail in this case?
  • From: Pillsy <pillsbury at gmail.com>
  • Date: Mon, 16 Feb 2009 16:39:41 -0500 (EST)
  • References: <gnbkcl$3ej$1@smc.vnet.net>

On Feb 16, 6:58 am, Aaron Fude <aaronf... at gmail.com> wrote:

> f[x_, y_] := x y
> g = f[##]*f[##] &;
> h = Derivative[1, 0][g];
> g[x, y]
> h[x, y]

> I should expect that h[x, y] is 2 x y^2, but instead it is zero. How
> come?

You've written g so that it's a function of SlotSequence[1] (which is
what FullForm[##1] will give you), while Derivative[1,0][g]
effectively takes the derivative with respect to Slot[1] (a.k.a. #1).
Writing

g = f[#1,#2] * f[#1,#2] &;

will do what you want.

Cheers,
Pillsy


  • Prev by Date: Re: Logarithmic Plot
  • Next by Date: Re: Division by zero, despite strong hint
  • Previous by thread: Re: Why does Derivative fail in this case?
  • Next by thread: Re: Why does Derivative fail in this case?