Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I can extract the parameters of a single variable derivative with the rule

D[f[x], x] /. Derivative[order_][fcn_][variable_] ->
  {order, fcn, variable}


{1, f, x}

How do I generalize this to the multivariate case? For example,

D[f[x, y], x, y] /. Derivative[order_][fcn_][variable_] ->
  {order, fcn, variable}


Mathematica graphics

The match didn't work -- but I can't seem to reproduce the actual Mathematica display.

I'm sure there's some magic syntax that will accomplish the match. I tried a few variations to no avail. Can anyone help?

Thanks much.

share|improve this question

You have to look at the FullForm or InputForm to see, how you can match your expression.

InputForm[D[f[x, y], x, y]]

  Derivative[1, 1][f][x, y]

The order in your second example is a sequence of numbers. The same is true for the variables you try to match. Therefore you have to use BlankSequence in your pattern

D[f[x, y], x, y] /. 
 Derivative[order__][fcn_][variable__] -> {{order}, fcn, {variable}}

  {{1, 1}, f, {x, y}}
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.