Skip to main content
edited tags
Link
Tweeted twitter.com/StackMma/status/682203760819613696
edited title
Link
QuantumDot
  • 19.8k
  • 7
  • 48
  • 124

Behavior of D and Derivative when acting on functions with Rules as arguments

Source Link
QuantumDot
  • 19.8k
  • 7
  • 48
  • 124

Behavior of D and Derivative when acting functions with Rules as arguments

I was (pleasantly) surprised that when a Derivative is taken of a symbolic function for which the last few arguments are Rules, a Derivative object is returned with just the right number of arguments to ignore the Rules:

D[f[x,y,a->b],x] // InputForm
(*  Derivative[0,1][f][x,y,a->b]  *)

(*  NOT:  Derivative[0,1,0][f][x,y,a->b] *)

This makes sense since the Rules could represents options to the function f.

Question: Has this behavior of D and Derivative been with Mathematica since v1?

But, then there is a strange behavior when D is taken of a function in which a Rule appears in a middle argument:

D[f[x,a->b,y],x]
(*  (0 -> 0) Derivative[0, 1, 0][f][x, a -> b, y] + Derivative[1, 0, 0][f][x, a -> b, y] *)

D[f[x,a->b,y],y]
(*  Derivative[0, 0, 1][f][x, a -> b, y] + (0 -> 0)*Derivative[0, 1, 0][f][x, a -> b, y] *)

Question: what is the interpretation of this output? In particular, what is the meaning of the term proportional to 0 -> 0?