MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: Plot in a Do loop does nothing

  • To: mathgroup at smc.vnet.net
  • Subject: [mg78258] RE: [mg78229] Plot in a Do loop does nothing
  • From: José Luis Gómez <jose.luis.gomez at itesm.mx>
  • Date: Wed, 27 Jun 2007 05:23:03 -0400 (EDT)
  • References: <200706260834.EAA05750@smc.vnet.net>

Dear Tim

Solution is simple, just wrap Print[] around Plot[]. I mean:

Do[Print[Plot[Sin[x], {x, 0, 2*n*Pi}]], {n, 1, 2}]

The reason is that in previous Mathematica versions the actual graph was a
"side effect" of the evaluation of Plot, while now in version 6 the actual
graph is the "output" of Plot, and Do is a command that does Not show the
"output" of iterations.

If you are interested in learning the new great, creasy things that can be
done now that the graphs are not side effects, but actual Mathematica output
and input, check the bottom of the page in the following link: 

http://reference.wolfram.com/mathematica/tutorial/GeneralizedInput.html

Regards!

Jose




-----Mensaje original-----
De: Tim Birks [mailto:pystab at hotmail.com] 
Enviado el: Martes, 26 de Junio de 2007 03:34 a.m.
Para: mathgroup at smc.vnet.net
Asunto: [mg78229] Plot in a Do loop does nothing


Can anyone please explain why the line:
Do[Plot[Sin[x], {x, 0, 2*n*Pi}], {n, 1, 2}]

does nothing in Mathematica 6? Or, how else I can produce such a series of 
related plots? It worked fine in Mathematica 5!

T





  • Prev by Date: Re: "Elastic string" (type of traveling-salesman) paradigm for sampling
  • Next by Date: Is "Find Currently Evaluating Cell" really "Find Topmost Cell in Evaluation Queue"?
  • Previous by thread: Plot in a Do loop does nothing
  • Next by thread: Re: Plot in a Do loop does nothing