Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Could someone explain the odd behavior of the Derivative function when drawing arguments from lists? We have,

Derivative[1][a + #*(b - c) &]
(* b - c & *)

and analogously,

Derivative[1][{a1, a2} + #*({b1, b2} - {c1, c2}) &]
(* {0, 0} + {b1, b2} - {c1, c2} + ({0, 0} + {0, 0}) #1 & *)

So far so good. However,

lst = {{a1, a2}, {b1, b2}, {c1, c2}};
Derivative[1][lst[[1]] + #*(lst[[2]] - lst[[3]]) &]
(* {lst[[2]] - lst[[3]], lst[[2]] - lst[[3]]} & *)

Why is the output in the last case not,

lst[[2]] - lst[[3]] &

as one would expect based on the previous examples? Why do I get a list of lists as an answer, instead of just a list? (And what should I do to get the expected result?)

share|improve this question
What version are you running? I cannot reproduce your final result on v9.0.1. –  rcollyer Apr 29 '13 at 20:53
I'm running Could it be a bug that's been corrected? –  Ted Pudlik Apr 29 '13 at 20:57
Quite possibly. I can reproduce it on v8.0.1, and v8.0.4, but not on v9.0.0, or higher. So, retagging. I'll let someone else add bugs. –  rcollyer Apr 29 '13 at 20:59
@rcollyer Reproduced here too. Tagged. –  belisarius Apr 29 '13 at 21:48
I updated to v9.0.1 and get the expected result now. Thanks for your help! –  Ted Pudlik Apr 29 '13 at 22:01

Your Answer


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

Browse other questions tagged or ask your own question.