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 am new to Mathematica, but not so new to programming. What I'd like to do in Mathematica (not using an API) is to display on each line, the nth derivative of a function, e.g. for n = 1..10. Is there a way to accomplish this in Mathematica? (without explicitly typing the command for each derivative of course. e.g. does Mathematica have iterative constructs to do this).

share|improve this question
Column[D[Sin[x] Log[x], {x, #}] & /@ Range[10]] ? – b.gatessucks Aug 18 '12 at 16:49
@b.gatessucks looks good; how about: Print@D[Sin[x] Log[x], {x, #}] & ~Array~ 10; ? – Mr.Wizard Aug 18 '12 at 16:51
...or Scan[Print[D[Sin[x] Log[x], {x, #}]] &, Range[10]] or Do[Print[D[Sin[x] Log[x], {x, k}]], {k, 10}]. – J. M. Aug 18 '12 at 16:56
@J.M. not enough infix. :^) – Mr.Wizard Aug 18 '12 at 16:57
@Mr.Wizard, but I am forced to think when reading infix... ;) – J. M. Aug 18 '12 at 16:59
up vote 2 down vote accepted

Avoiding cleverness as much as possible, you can just use a Do loop:

Do[Print[D[Exp[-a*x], {x, n}]], {n, 0, 10}]

Mathematica graphics

Or for example

Grid@(List@D[Exp[-a*x], {x, #}] & /@ Range[0, 10])

Mathematica graphics


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.