why “DO” loop does not work with “PLOT” function? (i’m using mathematica 9)
You need to wrap a Print around the Plot
Do[Print[Plot[x^n, {x, -5, 5}]], {n, 1, 10}]
Do evaluates its arguments but does not return a value.
Although Print is a convenient hack to get a graphic (or something else) output from a Do loop, it is strongly discouraged. Print’s main use is as a tool to employ in debugging. If you want to see the graphics that you generate from within a Do loop you should do something like assign each of them to a parameter or place them in a list that is assigned to a parameter and then execute that parameter to return the graphics in an Output cell. Or you could create a formatted expression with those graphics in, for example, a GraphicsGrid or a Grid or a Column.
Here is an example:
plots = {};
Do[AppendTo[plots, Plot[x^n, {x, -10, 10}]], {n, 1, 5}];
Column[plots]
David’s suggestion is precise. You can also improve from David’s suggestion by using Table instead of appending list. The reason is that every time you append something to a list, the kernel dynamically increase the size of the list, which is pretty slow if you have more items being created.
Like this:
Table[Plot[x^n, {x, -5, 5}], {n, 1, 10}]