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'd like to make a formula for a sum containing Derivative where the number of arguments in the latter depends on an input parameter n. Also involved is a list c calculated before and a function f that has n inputs. Here's the version for n=2


And here for n=3:


And so on. I was thinking about how I can make this more general and I think I can almost get it working using sum, doing something like (for n=4)


The problem with this is that Table outputs a list with curly brackets, and this won't work with Derivative, as seen from e.g. running


The first way works but not the second. Trying to get rid of the brackets I've tried Flatten with different inputs but that seems to only remove brackets inside brackets; I can't get rid of the outermost ones.

Does anyone know a way to get rid of the brackets from a Table, or use Derivative with a list in curly brackets? Or maybe a better way to do the whole thing?

share|improve this question
up vote 1 down vote accepted

If you want n! terms, this is the thing:

expr[n_] := Sum[c[[i, 2]] Derivative[Sequence @@ Table[c[[i, 1, j]],
{j, n}]][f][##], {i, n!}] & @@ ToExpression["z" <> ToString[#] & /@ Range[n]]

I'm not sure, but with 24 for n=4, I'm kinda convinced, even though you have 3 terms for n=2.

share|improve this answer
That works perfectly, thank you very much! And yeah it is supposed to be n!, I have a typo in the n=2 example in the OP. – jorgen Feb 28 '14 at 17:36

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.