MathGroup Archive 2009

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

Search the Archive

Re: Show doesn't work inside Do loop ?

  • To: mathgroup at
  • Subject: [mg102013] Re: Show doesn't work inside Do loop ?
  • From: AES <siegman at>
  • Date: Sun, 26 Jul 2009 03:56:52 -0400 (EDT)
  • Organization: Stanford University
  • References: <32390795.1248259308283.JavaMail.root@n11> <h4951e$q2e$> <21621663.1248432817472.JavaMail.root@n11> <h4eeul$spv$>

In article <h4eeul$spv$1 at>,
 "David Park" <djmpark at> wrote:  (emphasis added)

> _On the other hand, Show does not generally generate a cell._ 
> Of course, it is easier to just apply Print to the Show or Plot statements.
> So it is possible to make Show generate output cells, but it _normally_
> doesn't do so. It normally only generates expressions, which because of its
> special behavior a Do statement does not display.

1)  Re your statements above: executing a single Input cell containing 

   Show[ Graphics[ Circle[ {0, 0}, 1] ] ]

certainly generates an Output cell containing what looks like a 
"graphic" or "plot" to me.

Is executing a cell containing a simple expression somehow an "abnormal" 
process or action?

2)  On a more general note:  Suppose you have an expression which 
contains an explicit symbol x , such that if you execute three 
consecutive cells containing

   x=1; expr
   x=2; expr
   x=3; expr

or maybe


you get three output cells containing three successive instances of expr 
(whatever that is) -- or appropriate error messages if executing expr 
one of those times has some side effect that messes up a subsequent 

Would it not be reasonable to expect a cell containing

   Do[ expr, {x,1,3} ]

to do _exactly_ the same thing?

In other words, would it not be reasonable -- consistent -- sensible -- 
helpful -- the most useful -- to expect Do[ ] to be simply a "wrapper" 
that functioned in exactly that manner?

I appreciate that Mathematica's Do[] apparently doesn't function that 
way -- or functions that way sometimes, based on mysterious criteria, 
but not other times; and suggest that this is not helpful or useful or 
consistent behavior for many users.  

Are there any fundamental reasons why a DoConsistently[ ] command could 
not be defined, such that DoConsistently[ expr, iterator ]  would 
repeatedly put expr into a cell with each iterator instance applied to 
it, and churn out the sequential outputs?  That, it seems to me, is what 
many users would want and expect.

  • Prev by Date: Re: model for early cosmological symmetry breaking as a 3d surface
  • Next by Date: Re: Re: Show doesn't work inside Do loop ?
  • Previous by thread: Re: Re: Show doesn't work inside Do loop ?
  • Next by thread: Re: Re: Show doesn't work inside Do loop ?