0

In William T. Shaw's Complex Analysis with Mathematica textbook, written for Mathematica 5, he has this command in his exercises:

Do[Plot[x^2 + c, {x, -2, 2}, PlotRange -> {-1, 3}], {c, -1, 1, 0.2}]

But it does not work in Mathematica 11.1.0. Is there a reason for this?

David
  • 14,883
  • 4
  • 44
  • 117
  • 3
    In V6 they changed the default behavior for printing. I think wrapping a Print around the Plot might work for you Do[Print[Plot[x^2+c, {x,-2,2}, PlotRange->{-1,3}]], {c,-1,1,0.2}] – Bill May 10 '17 at 05:41
  • 1
    I can confirm that Bill's suggestion works. – m_goldberg May 10 '17 at 07:34
  • 1
    Column @ Table[Plot[x^2 + c, {x, -2, 2}, PlotRange -> {-1, 3}], {c, -1, 1, 1}] also works and puts the output in a single cell. – m_goldberg May 10 '17 at 07:39
  • 1
    In v5 and earlier, Graphics expressions did not automatically render as the graphics they represented. Rendering was explicitly triggered with Show. Show worked a bit like Print: it inserted a new cell in the notebook with rendered graphics. Plotting functions (but not Graphics) invoked Show automatically. This is why the Do loop you quote had the side effect of rendering graphics. Now you know why a function for combining (and not showing) graphics is called Show. It's because in the past that's what it did: it showed the picture. – Szabolcs May 10 '17 at 14:20
  • Take a look at Plot functions do not print output in common pitfalls thread. – Kuba Nov 15 '18 at 08:25

0 Answers0